1.file "asin.s" 2 3 4// Copyright (c) 2000 - 2003 Intel Corporation 5// All rights reserved. 6// 7// 8// Redistribution and use in source and binary forms, with or without 9// modification, are permitted provided that the following conditions are 10// met: 11// 12// * Redistributions of source code must retain the above copyright 13// notice, this list of conditions and the following disclaimer. 14// 15// * Redistributions in binary form must reproduce the above copyright 16// notice, this list of conditions and the following disclaimer in the 17// documentation and/or other materials provided with the distribution. 18// 19// * The name of Intel Corporation may not be used to endorse or promote 20// products derived from this software without specific prior written 21// permission. 22 23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 27// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 31// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING 32// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34// 35// Intel Corporation is the author of this code, and requests that all 36// problem reports or change requests be submitted to it directly at 37// http://www.intel.com/software/products/opensource/libraries/num.htm. 38 39// History 40//============================================================== 41// 02/02/00 Initial version 42// 08/17/00 New and much faster algorithm. 43// 08/31/00 Avoided bank conflicts on loads, shortened |x|=1 path, 44// fixed mfb split issue stalls. 45// 12/19/00 Fixed small arg cases to force inexact, or inexact and underflow. 46// 08/02/02 New and much faster algorithm II 47// 02/06/03 Reordered header: .section, .global, .proc, .align 48 49// Description 50//========================================= 51// The asin function computes the principal value of the arc sine of x. 52// asin(0) returns 0, asin(1) returns pi/2, asin(-1) returns -pi/2. 53// A doman error occurs for arguments not in the range [-1,+1]. 54// 55// The asin function returns the arc sine in the range [-pi/2, +pi/2] radians. 56// 57// There are 8 paths: 58// 1. x = +/-0.0 59// Return asin(x) = +/-0.0 60// 61// 2. 0.0 < |x| < 0.625 62// Return asin(x) = x + x^3 *PolA(x^2) 63// where PolA(x^2) = A3 + A5*x^2 + A7*x^4 +...+ A35*x^32 64// 65// 3. 0.625 <=|x| < 1.0 66// Return asin(x) = sign(x) * ( Pi/2 - sqrt(R) * PolB(R)) 67// Where R = 1 - |x|, 68// PolB(R) = B0 + B1*R + B2*R^2 +...+B12*R^12 69// 70// sqrt(R) is approximated using the following sequence: 71// y0 = (1 + eps)/sqrt(R) - initial approximation by frsqrta, 72// |eps| < 2^(-8) 73// Then 3 iterations are used to refine the result: 74// H0 = 0.5*y0 75// S0 = R*y0 76// 77// d0 = 0.5 - H0*S0 78// H1 = H0 + d0*H0 79// S1 = S0 + d0*S0 80// 81// d1 = 0.5 - H1*S1 82// H2 = H1 + d0*H1 83// S2 = S1 + d0*S1 84// 85// d2 = 0.5 - H2*S2 86// S3 = S3 + d2*S3 87// 88// S3 approximates sqrt(R) with enough accuracy for this algorithm 89// 90// So, the result should be reconstracted as follows: 91// asin(x) = sign(x) * (Pi/2 - S3*PolB(R)) 92// 93// But for optimization perposes the reconstruction step is slightly 94// changed: 95// asin(x) = sign(x)*(Pi/2 - PolB(R)*S2) + sign(x)*d2*S2*PolB(R) 96// 97// 4. |x| = 1.0 98// Return asin(x) = sign(x)*Pi/2 99// 100// 5. 1.0 < |x| <= +INF 101// A doman error occurs for arguments not in the range [-1,+1] 102// 103// 6. x = [S,Q]NaN 104// Return asin(x) = QNaN 105// 106// 7. x is denormal 107// Return asin(x) = x + x^3, 108// 109// 8. x is unnormal 110// Normalize input in f8 and return to the very beginning of the function 111// 112// Registers used 113//============================================================== 114// Floating Point registers used: 115// f8, input, output 116// f6, f7, f9 -> f15, f32 -> f63 117 118// General registers used: 119// r3, r21 -> r31, r32 -> r38 120 121// Predicate registers used: 122// p0, p6 -> p14 123 124// 125// Assembly macros 126//========================================= 127// integer registers used 128// scratch 129rTblAddr = r3 130 131rPiBy2Ptr = r21 132rTmpPtr3 = r22 133rDenoBound = r23 134rOne = r24 135rAbsXBits = r25 136rHalf = r26 137r0625 = r27 138rSign = r28 139rXBits = r29 140rTmpPtr2 = r30 141rTmpPtr1 = r31 142 143// stacked 144GR_SAVE_PFS = r32 145GR_SAVE_B0 = r33 146GR_SAVE_GP = r34 147GR_Parameter_X = r35 148GR_Parameter_Y = r36 149GR_Parameter_RESULT = r37 150GR_Parameter_TAG = r38 151 152// floating point registers used 153FR_X = f10 154FR_Y = f1 155FR_RESULT = f8 156 157 158// scratch 159fXSqr = f6 160fXCube = f7 161fXQuadr = f9 162f1pX = f10 163f1mX = f11 164f1pXRcp = f12 165f1mXRcp = f13 166fH = f14 167fS = f15 168// stacked 169fA3 = f32 170fB1 = f32 171fA5 = f33 172fB2 = f33 173fA7 = f34 174fPiBy2 = f34 175fA9 = f35 176fA11 = f36 177fB10 = f35 178fB11 = f36 179fA13 = f37 180fA15 = f38 181fB4 = f37 182fB5 = f38 183fA17 = f39 184fA19 = f40 185fB6 = f39 186fB7 = f40 187fA21 = f41 188fA23 = f42 189fB3 = f41 190fB8 = f42 191fA25 = f43 192fA27 = f44 193fB9 = f43 194fB12 = f44 195fA29 = f45 196fA31 = f46 197fA33 = f47 198fA35 = f48 199fBaseP = f49 200fB0 = f50 201fSignedS = f51 202fD = f52 203fHalf = f53 204fR = f54 205fCloseTo1Pol = f55 206fSignX = f56 207fDenoBound = f57 208fNormX = f58 209fX8 = f59 210fRSqr = f60 211fRQuadr = f61 212fR8 = f62 213fX16 = f63 214// Data tables 215//============================================================== 216RODATA 217.align 16 218LOCAL_OBJECT_START(asin_base_range_table) 219// Ai: Polynomial coefficients for the asin(x), |x| < .625000 220// Bi: Polynomial coefficients for the asin(x), |x| > .625000 221data8 0xBFDAAB56C01AE468 //A29 222data8 0x3FE1C470B76A5B2B //A31 223data8 0xBFDC5FF82A0C4205 //A33 224data8 0x3FC71FD88BFE93F0 //A35 225data8 0xB504F333F9DE6487, 0x00003FFF //B0 226data8 0xAAAAAAAAAAAAFC18, 0x00003FFC //A3 227data8 0x3F9F1C71BC4A7823 //A9 228data8 0x3F96E8BBAAB216B2 //A11 229data8 0x3F91C4CA1F9F8A98 //A13 230data8 0x3F8C9DDCEDEBE7A6 //A15 231data8 0x3F877784442B1516 //A17 232data8 0x3F859C0491802BA2 //A19 233data8 0x9999999998C88B8F, 0x00003FFB //A5 234data8 0x3F6BD7A9A660BF5E //A21 235data8 0x3F9FC1659340419D //A23 236data8 0xB6DB6DB798149BDF, 0x00003FFA //A7 237data8 0xBFB3EF18964D3ED3 //A25 238data8 0x3FCD285315542CF2 //A27 239data8 0xF15BEEEFF7D2966A, 0x00003FFB //B1 240data8 0x3EF0DDA376D10FB3 //B10 241data8 0xBEB83CAFE05EBAC9 //B11 242data8 0x3F65FFB67B513644 //B4 243data8 0x3F5032FBB86A4501 //B5 244data8 0x3F392162276C7CBA //B6 245data8 0x3F2435949FD98BDF //B7 246data8 0xD93923D7FA08341C, 0x00003FF9 //B2 247data8 0x3F802995B6D90BDB //B3 248data8 0x3F10DF86B341A63F //B8 249data8 0xC90FDAA22168C235, 0x00003FFF // Pi/2 250data8 0x3EFA3EBD6B0ECB9D //B9 251data8 0x3EDE18BA080E9098 //B12 252LOCAL_OBJECT_END(asin_base_range_table) 253 254 255.section .text 256GLOBAL_LIBM_ENTRY(asin) 257asin_unnormal_back: 258{ .mfi 259 getf.d rXBits = f8 // grab bits of input value 260 // set p12 = 1 if x is a NaN, denormal, or zero 261 fclass.m p12, p0 = f8, 0xcf 262 adds rSign = 1, r0 263} 264{ .mfi 265 addl rTblAddr = @ltoff(asin_base_range_table),gp 266 // 1 - x = 1 - |x| for positive x 267 fms.s1 f1mX = f1, f1, f8 268 addl rHalf = 0xFFFE, r0 // exponent of 1/2 269} 270;; 271{ .mfi 272 addl r0625 = 0x3FE4, r0 // high 16 bits of 0.625 273 // set p8 = 1 if x < 0 274 fcmp.lt.s1 p8, p9 = f8, f0 275 shl rSign = rSign, 63 // sign bit 276} 277{ .mfi 278 // point to the beginning of the table 279 ld8 rTblAddr = [rTblAddr] 280 // 1 + x = 1 - |x| for negative x 281 fma.s1 f1pX = f1, f1, f8 282 adds rOne = 0x3FF, r0 283} 284;; 285{ .mfi 286 andcm rAbsXBits = rXBits, rSign // bits of |x| 287 fmerge.s fSignX = f8, f1 // signum(x) 288 shl r0625 = r0625, 48 // bits of DP representation of 0.625 289} 290{ .mfb 291 setf.exp fHalf = rHalf // load A2 to FP reg 292 fma.s1 fXSqr = f8, f8, f0 // x^2 293 // branch on special path if x is a NaN, denormal, or zero 294(p12) br.cond.spnt asin_special 295} 296;; 297{ .mfi 298 adds rPiBy2Ptr = 272, rTblAddr 299 nop.f 0 300 shl rOne = rOne, 52 // bits of 1.0 301} 302{ .mfi 303 adds rTmpPtr1 = 16, rTblAddr 304 nop.f 0 305 // set p6 = 1 if |x| < 0.625 306 cmp.lt p6, p7 = rAbsXBits, r0625 307} 308;; 309{ .mfi 310 ldfpd fA29, fA31 = [rTblAddr] // A29, fA31 311 // 1 - x = 1 - |x| for positive x 312(p9) fms.s1 fR = f1, f1, f8 313 // point to coefficient of "near 1" polynomial 314(p7) adds rTmpPtr2 = 176, rTblAddr 315} 316{ .mfi 317 ldfpd fA33, fA35 = [rTmpPtr1], 16 // A33, fA35 318 // 1 + x = 1 - |x| for negative x 319(p8) fma.s1 fR = f1, f1, f8 320(p6) adds rTmpPtr2 = 48, rTblAddr 321} 322;; 323{ .mfi 324 ldfe fB0 = [rTmpPtr1], 16 // B0 325 nop.f 0 326 nop.i 0 327} 328{ .mib 329 adds rTmpPtr3 = 16, rTmpPtr2 330 // set p10 = 1 if |x| = 1.0 331 cmp.eq p10, p0 = rAbsXBits, rOne 332 // branch on special path for |x| = 1.0 333(p10) br.cond.spnt asin_abs_1 334} 335;; 336{ .mfi 337 ldfe fA3 = [rTmpPtr2], 48 // A3 or B1 338 nop.f 0 339 adds rTmpPtr1 = 64, rTmpPtr3 340} 341{ .mib 342 ldfpd fA9, fA11 = [rTmpPtr3], 16 // A9, A11 or B10, B11 343 // set p11 = 1 if |x| > 1.0 344 cmp.gt p11, p0 = rAbsXBits, rOne 345 // branch on special path for |x| > 1.0 346(p11) br.cond.spnt asin_abs_gt_1 347} 348;; 349{ .mfi 350 ldfpd fA17, fA19 = [rTmpPtr2], 16 // A17, A19 or B6, B7 351 // initial approximation of 1 / sqrt(1 - x) 352 frsqrta.s1 f1mXRcp, p0 = f1mX 353 nop.i 0 354} 355{ .mfi 356 ldfpd fA13, fA15 = [rTmpPtr3] // A13, A15 or B4, B5 357 fma.s1 fXCube = fXSqr, f8, f0 // x^3 358 nop.i 0 359} 360;; 361{ .mfi 362 ldfe fA5 = [rTmpPtr2], 48 // A5 or B2 363 // initial approximation of 1 / sqrt(1 + x) 364 frsqrta.s1 f1pXRcp, p0 = f1pX 365 nop.i 0 366} 367{ .mfi 368 ldfpd fA21, fA23 = [rTmpPtr1], 16 // A21, A23 or B3, B8 369 fma.s1 fXQuadr = fXSqr, fXSqr, f0 // x^4 370 nop.i 0 371} 372;; 373{ .mfi 374 ldfe fA7 = [rTmpPtr1] // A7 or Pi/2 375 fma.s1 fRSqr = fR, fR, f0 // R^2 376 nop.i 0 377} 378{ .mfb 379 ldfpd fA25, fA27 = [rTmpPtr2] // A25, A27 or B9, B12 380 nop.f 0 381(p6) br.cond.spnt asin_base_range; 382} 383;; 384 385{ .mfi 386 nop.m 0 387(p9) fma.s1 fH = fHalf, f1mXRcp, f0 // H0 for x > 0 388 nop.i 0 389} 390{ .mfi 391 nop.m 0 392(p9) fma.s1 fS = f1mX, f1mXRcp, f0 // S0 for x > 0 393 nop.i 0 394} 395;; 396{ .mfi 397 nop.m 0 398(p8) fma.s1 fH = fHalf, f1pXRcp, f0 // H0 for x < 0 399 nop.i 0 400} 401{ .mfi 402 nop.m 0 403(p8) fma.s1 fS = f1pX, f1pXRcp, f0 // S0 for x > 0 404 nop.i 0 405} 406;; 407{ .mfi 408 nop.m 0 409 fma.s1 fRQuadr = fRSqr, fRSqr, f0 // R^4 410 nop.i 0 411} 412;; 413{ .mfi 414 nop.m 0 415 fma.s1 fB11 = fB11, fR, fB10 416 nop.i 0 417} 418{ .mfi 419 nop.m 0 420 fma.s1 fB1 = fB1, fR, fB0 421 nop.i 0 422} 423;; 424{ .mfi 425 nop.m 0 426 fma.s1 fB5 = fB5, fR, fB4 427 nop.i 0 428} 429{ .mfi 430 nop.m 0 431 fma.s1 fB7 = fB7, fR, fB6 432 nop.i 0 433} 434;; 435{ .mfi 436 nop.m 0 437 fma.s1 fB3 = fB3, fR, fB2 438 nop.i 0 439} 440;; 441{ .mfi 442 nop.m 0 443 fnma.s1 fD = fH, fS, fHalf // d0 = 1/2 - H0*S0 444 nop.i 0 445} 446;; 447{ .mfi 448 nop.m 0 449 fma.s1 fR8 = fRQuadr, fRQuadr, f0 // R^4 450 nop.i 0 451} 452{ .mfi 453 nop.m 0 454 fma.s1 fB9 = fB9, fR, fB8 455 nop.i 0 456} 457;; 458{.mfi 459 nop.m 0 460 fma.s1 fB12 = fB12, fRSqr, fB11 461 nop.i 0 462} 463{.mfi 464 nop.m 0 465 fma.s1 fB7 = fB7, fRSqr, fB5 466 nop.i 0 467} 468;; 469{.mfi 470 nop.m 0 471 fma.s1 fB3 = fB3, fRSqr, fB1 472 nop.i 0 473} 474;; 475{ .mfi 476 nop.m 0 477 fma.s1 fH = fH, fD, fH // H1 = H0 + H0*d0 478 nop.i 0 479} 480{ .mfi 481 nop.m 0 482 fma.s1 fS = fS, fD, fS // S1 = S0 + S0*d0 483 nop.i 0 484} 485;; 486{.mfi 487 nop.m 0 488 fma.s1 fPiBy2 = fPiBy2, fSignX, f0 // signum(x)*Pi/2 489 nop.i 0 490} 491;; 492{ .mfi 493 nop.m 0 494 fma.s1 fB12 = fB12, fRSqr, fB9 495 nop.i 0 496} 497{ .mfi 498 nop.m 0 499 fma.s1 fB7 = fB7, fRQuadr, fB3 500 nop.i 0 501} 502;; 503{.mfi 504 nop.m 0 505 fnma.s1 fD = fH, fS, fHalf // d1 = 1/2 - H1*S1 506 nop.i 0 507} 508{ .mfi 509 nop.m 0 510 fnma.s1 fSignedS = fSignX, fS, f0 // -signum(x)*S1 511 nop.i 0 512} 513;; 514{ .mfi 515 nop.m 0 516 fma.s1 fCloseTo1Pol = fB12, fR8, fB7 517 nop.i 0 518} 519;; 520{ .mfi 521 nop.m 0 522 fma.s1 fH = fH, fD, fH // H2 = H1 + H1*d1 523 nop.i 0 524} 525{ .mfi 526 nop.m 0 527 fma.s1 fS = fS, fD, fS // S2 = S1 + S1*d1 528 nop.i 0 529} 530;; 531{ .mfi 532 nop.m 0 533 // -signum(x)* S2 = -signum(x)*(S1 + S1*d1) 534 fma.s1 fSignedS = fSignedS, fD, fSignedS 535 nop.i 0 536} 537;; 538{.mfi 539 nop.m 0 540 fnma.s1 fD = fH, fS, fHalf // d2 = 1/2 - H2*S2 541 nop.i 0 542} 543;; 544{ .mfi 545 nop.m 0 546 // signum(x)*(Pi/2 - PolB*S2) 547 fma.s1 fPiBy2 = fSignedS, fCloseTo1Pol, fPiBy2 548 nop.i 0 549} 550{ .mfi 551 nop.m 0 552 // -signum(x)*PolB * S2 553 fma.s1 fCloseTo1Pol = fSignedS, fCloseTo1Pol, f0 554 nop.i 0 555} 556;; 557{ .mfb 558 nop.m 0 559 // final result for 0.625 <= |x| < 1 560 fma.d.s0 f8 = fCloseTo1Pol, fD, fPiBy2 561 // exit here for 0.625 <= |x| < 1 562 br.ret.sptk b0 563} 564;; 565 566 567// here if |x| < 0.625 568.align 32 569asin_base_range: 570{ .mfi 571 nop.m 0 572 fma.s1 fA33 = fA33, fXSqr, fA31 573 nop.i 0 574} 575{ .mfi 576 nop.m 0 577 fma.s1 fA15 = fA15, fXSqr, fA13 578 nop.i 0 579} 580;; 581{ .mfi 582 nop.m 0 583 fma.s1 fA29 = fA29, fXSqr, fA27 584 nop.i 0 585} 586{ .mfi 587 nop.m 0 588 fma.s1 fA25 = fA25, fXSqr, fA23 589 nop.i 0 590} 591;; 592{ .mfi 593 nop.m 0 594 fma.s1 fA21 = fA21, fXSqr, fA19 595 nop.i 0 596} 597{ .mfi 598 nop.m 0 599 fma.s1 fA9 = fA9, fXSqr, fA7 600 nop.i 0 601} 602;; 603{ .mfi 604 nop.m 0 605 fma.s1 fA5 = fA5, fXSqr, fA3 606 nop.i 0 607} 608;; 609{ .mfi 610 nop.m 0 611 fma.s1 fA35 = fA35, fXQuadr, fA33 612 nop.i 0 613} 614{ .mfi 615 nop.m 0 616 fma.s1 fA17 = fA17, fXQuadr, fA15 617 nop.i 0 618} 619;; 620{ .mfi 621 nop.m 0 622 fma.s1 fX8 = fXQuadr, fXQuadr, f0 // x^8 623 nop.i 0 624} 625{ .mfi 626 nop.m 0 627 fma.s1 fA25 = fA25, fXQuadr, fA21 628 nop.i 0 629} 630;; 631{ .mfi 632 nop.m 0 633 fma.s1 fA9 = fA9, fXQuadr, fA5 634 nop.i 0 635} 636;; 637{ .mfi 638 nop.m 0 639 fma.s1 fA35 = fA35, fXQuadr, fA29 640 nop.i 0 641} 642{ .mfi 643 nop.m 0 644 fma.s1 fA17 = fA17, fXSqr, fA11 645 nop.i 0 646} 647;; 648{ .mfi 649 nop.m 0 650 fma.s1 fX16 = fX8, fX8, f0 // x^16 651 nop.i 0 652} 653;; 654{ .mfi 655 nop.m 0 656 fma.s1 fA35 = fA35, fX8, fA25 657 nop.i 0 658} 659{ .mfi 660 nop.m 0 661 fma.s1 fA17 = fA17, fX8, fA9 662 nop.i 0 663} 664;; 665{ .mfi 666 nop.m 0 667 fma.s1 fBaseP = fA35, fX16, fA17 668 nop.i 0 669} 670;; 671{ .mfb 672 nop.m 0 673 // final result for |x| < 0.625 674 fma.d.s0 f8 = fBaseP, fXCube, f8 675 // exit here for |x| < 0.625 path 676 br.ret.sptk b0 677} 678;; 679 680// here if |x| = 1 681// asin(x) = sign(x) * Pi/2 682.align 32 683asin_abs_1: 684{ .mfi 685 ldfe fPiBy2 = [rPiBy2Ptr] // Pi/2 686 nop.f 0 687 nop.i 0 688} 689;; 690{.mfb 691 nop.m 0 692 // result for |x| = 1.0 693 fma.d.s0 f8 = fPiBy2, fSignX, f0 694 // exit here for |x| = 1.0 695 br.ret.sptk b0 696} 697;; 698 699// here if x is a NaN, denormal, or zero 700.align 32 701asin_special: 702{ .mfi 703 nop.m 0 704 // set p12 = 1 if x is a NaN 705 fclass.m p12, p0 = f8, 0xc3 706 nop.i 0 707} 708{ .mlx 709 nop.m 0 710 // smallest positive DP normalized number 711 movl rDenoBound = 0x0010000000000000 712} 713;; 714{ .mfi 715 nop.m 0 716 // set p13 = 1 if x = 0.0 717 fclass.m p13, p0 = f8, 0x07 718 nop.i 0 719} 720{ .mfi 721 nop.m 0 722 fnorm.s1 fNormX = f8 723 nop.i 0 724} 725;; 726{ .mfb 727 // load smallest normal to FP reg 728 setf.d fDenoBound = rDenoBound 729 // answer if x is a NaN 730(p12) fma.d.s0 f8 = f8,f1,f0 731 // exit here if x is a NaN 732(p12) br.ret.spnt b0 733} 734;; 735{ .mfb 736 nop.m 0 737 nop.f 0 738 // exit here if x = 0.0 739(p13) br.ret.spnt b0 740} 741;; 742// if we still here then x is denormal or unnormal 743{ .mfi 744 nop.m 0 745 // absolute value of normalized x 746 fmerge.s fNormX = f1, fNormX 747 nop.i 0 748} 749;; 750{ .mfi 751 nop.m 0 752 // set p14 = 1 if normalized x is greater than or 753 // equal to the smallest denormalized value 754 // So, if p14 is set to 1 it means that we deal with 755 // unnormal rather than with "true" denormal 756 fcmp.ge.s1 p14, p0 = fNormX, fDenoBound 757 nop.i 0 758} 759;; 760{ .mfi 761 nop.m 0 762(p14) fcmp.eq.s0 p6, p0 = f8, f0 // Set D flag if x unnormal 763 nop.i 0 764} 765{ .mfb 766 nop.m 0 767 // normalize unnormal input 768(p14) fnorm.s1 f8 = f8 769 // return to the main path 770(p14) br.cond.sptk asin_unnormal_back 771} 772;; 773// if we still here it means that input is "true" denormal 774{ .mfb 775 nop.m 0 776 // final result if x is denormal 777 fma.d.s0 f8 = f8, fXSqr, f8 778 // exit here if x is denormal 779 br.ret.sptk b0 780} 781;; 782 783// here if |x| > 1.0 784// error handler should be called 785.align 32 786asin_abs_gt_1: 787{ .mfi 788 alloc r32 = ar.pfs, 0, 3, 4, 0 // get some registers 789 fmerge.s FR_X = f8,f8 790 nop.i 0 791} 792{ .mfb 793 mov GR_Parameter_TAG = 61 // error code 794 frcpa.s0 FR_RESULT, p0 = f0,f0 795 // call error handler routine 796 br.cond.sptk __libm_error_region 797} 798;; 799GLOBAL_LIBM_END(asin) 800libm_alias_double_other (asin, asin) 801 802 803 804LOCAL_LIBM_ENTRY(__libm_error_region) 805.prologue 806{ .mfi 807 add GR_Parameter_Y=-32,sp // Parameter 2 value 808 nop.f 0 809.save ar.pfs,GR_SAVE_PFS 810 mov GR_SAVE_PFS=ar.pfs // Save ar.pfs 811} 812{ .mfi 813.fframe 64 814 add sp=-64,sp // Create new stack 815 nop.f 0 816 mov GR_SAVE_GP=gp // Save gp 817};; 818{ .mmi 819 stfd [GR_Parameter_Y] = FR_Y,16 // STORE Parameter 2 on stack 820 add GR_Parameter_X = 16,sp // Parameter 1 address 821.save b0, GR_SAVE_B0 822 mov GR_SAVE_B0=b0 // Save b0 823};; 824.body 825{ .mib 826 stfd [GR_Parameter_X] = FR_X // STORE Parameter 1 on stack 827 add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address 828 nop.b 0 829} 830{ .mib 831 stfd [GR_Parameter_Y] = FR_RESULT // STORE Parameter 3 on stack 832 add GR_Parameter_Y = -16,GR_Parameter_Y 833 br.call.sptk b0=__libm_error_support# // Call error handling function 834};; 835{ .mmi 836 add GR_Parameter_RESULT = 48,sp 837 nop.m 0 838 nop.i 0 839};; 840{ .mmi 841 ldfd f8 = [GR_Parameter_RESULT] // Get return result off stack 842.restore sp 843 add sp = 64,sp // Restore stack pointer 844 mov b0 = GR_SAVE_B0 // Restore return address 845};; 846{ .mib 847 mov gp = GR_SAVE_GP // Restore gp 848 mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs 849 br.ret.sptk b0 // Return 850};; 851 852LOCAL_LIBM_END(__libm_error_region) 853.type __libm_error_support#,@function 854.global __libm_error_support# 855