1.file "tancot.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// 04/04/00 Unwind support added 43// 12/27/00 Improved speed 44// 02/21/01 Updated to call tanl 45// 05/30/02 Added cot 46// 02/10/03 Reordered header: .section, .global, .proc, .align 47// 48// API 49//============================================================== 50// double tan(double x); 51// double cot(double x); 52// 53// Overview of operation 54//============================================================== 55// If the input value in radians is |x| >= 1.xxxxx 2^10 call the 56// older slower version. 57// 58// The new algorithm is used when |x| <= 1.xxxxx 2^9. 59// 60// Represent the input X as Nfloat * pi/2 + r 61// where r can be negative and |r| <= pi/4 62// 63// tan_W = x * 2/pi 64// Nfloat = round_int(tan_W) 65// 66// tan_r = x - Nfloat * (pi/2)_hi 67// a) tan_r = tan_r - Nfloat * (pi/2)_lo (for tan) 68// b) tan_r = Nfloat * (pi/2)_lo - tan_r (for cot) 69// 70// We have two paths: p8, when Nfloat is even and p9. when Nfloat is odd. 71// a) for tan: p8: tan(X) = tan(r) 72// p9: tan(X) = -cot(r) 73// b) for cot: p9: cot(X) = cot(r) 74// p8: cot(X) = -tan(r) 75// 76// Each is evaluated as a series. The p9 path requires 1/r. 77// 78// The coefficients used in the series are stored in a table as 79// are the pi constants. 80// 81// Registers used 82//============================================================== 83// 84// predicate registers used: 85// p6-12 86// 87// floating-point registers used: 88// f10-15, f32-106 89// f8, input 90// 91// general registers used 92// r14-26, r32-39 93// 94// Assembly macros 95//============================================================== 96TAN_INV_PI_BY_2_2TO64 = f10 97TAN_RSHF_2TO64 = f11 98TAN_2TOM64 = f12 99TAN_RSHF = f13 100TAN_W_2TO64_RSH = f14 101TAN_NFLOAT = f15 102 103tan_Inv_Pi_by_2 = f32 104tan_Pi_by_2_hi = f33 105tan_Pi_by_2_lo = f34 106 107 108tan_P0 = f35 109tan_P1 = f36 110tan_P2 = f37 111tan_P3 = f38 112tan_P4 = f39 113tan_P5 = f40 114tan_P6 = f41 115tan_P7 = f42 116tan_P8 = f43 117tan_P9 = f44 118tan_P10 = f45 119tan_P11 = f46 120tan_P12 = f47 121tan_P13 = f48 122tan_P14 = f49 123tan_P15 = f50 124 125tan_Q0 = f51 126tan_Q1 = f52 127tan_Q2 = f53 128tan_Q3 = f54 129tan_Q4 = f55 130tan_Q5 = f56 131tan_Q6 = f57 132tan_Q7 = f58 133tan_Q8 = f59 134tan_Q9 = f60 135tan_Q10 = f61 136 137tan_r = f62 138tan_rsq = f63 139tan_rcube = f64 140 141tan_v18 = f65 142tan_v16 = f66 143tan_v17 = f67 144tan_v12 = f68 145tan_v13 = f69 146tan_v7 = f70 147tan_v8 = f71 148tan_v4 = f72 149tan_v5 = f73 150tan_v15 = f74 151tan_v11 = f75 152tan_v14 = f76 153tan_v3 = f77 154tan_v6 = f78 155tan_v10 = f79 156tan_v2 = f80 157tan_v9 = f81 158tan_v1 = f82 159tan_int_Nfloat = f83 160tan_Nfloat = f84 161 162tan_NORM_f8 = f85 163tan_W = f86 164 165tan_y0 = f87 166tan_d = f88 167tan_y1 = f89 168tan_dsq = f90 169tan_y2 = f91 170tan_d4 = f92 171tan_inv_r = f93 172 173tan_z1 = f94 174tan_z2 = f95 175tan_z3 = f96 176tan_z4 = f97 177tan_z5 = f98 178tan_z6 = f99 179tan_z7 = f100 180tan_z8 = f101 181tan_z9 = f102 182tan_z10 = f103 183tan_z11 = f104 184tan_z12 = f105 185 186arg_copy = f106 187 188///////////////////////////////////////////////////////////// 189 190tan_GR_sig_inv_pi_by_2 = r14 191tan_GR_rshf_2to64 = r15 192tan_GR_exp_2tom64 = r16 193tan_GR_n = r17 194tan_GR_rshf = r18 195tan_AD = r19 196tan_GR_10009 = r20 197tan_GR_17_ones = r21 198tan_GR_N_odd_even = r22 199tan_GR_N = r23 200tan_signexp = r24 201tan_exp = r25 202tan_ADQ = r26 203 204GR_SAVE_B0 = r33 205GR_SAVE_PFS = r34 206GR_SAVE_GP = r35 207GR_Parameter_X = r36 208GR_Parameter_Y = r37 209GR_Parameter_RESULT = r38 210GR_Parameter_Tag = r39 211 212 213RODATA 214 215.align 16 216 217LOCAL_OBJECT_START(double_tan_constants) 218 data8 0xC90FDAA22168C234, 0x00003FFF // pi/2 hi 219 data8 0xBEEA54580DDEA0E1 // P14 220 data8 0x3ED3021ACE749A59 // P15 221 data8 0xBEF312BD91DC8DA1 // P12 222 data8 0x3EFAE9AFC14C5119 // P13 223 data8 0x3F2F342BF411E769 // P8 224 data8 0x3F1A60FC9F3B0227 // P9 225 data8 0x3EFF246E78E5E45B // P10 226 data8 0x3F01D9D2E782875C // P11 227 data8 0x3F8226E34C4499B6 // P4 228 data8 0x3F6D6D3F12C236AC // P5 229 data8 0x3F57DA1146DCFD8B // P6 230 data8 0x3F43576410FE3D75 // P7 231 data8 0x3FD5555555555555 // P0 232 data8 0x3FC11111111111C2 // P1 233 data8 0x3FABA1BA1BA0E850 // P2 234 data8 0x3F9664F4886725A7 // P3 235LOCAL_OBJECT_END(double_tan_constants) 236 237LOCAL_OBJECT_START(double_Q_tan_constants) 238 data8 0xC4C6628B80DC1CD1, 0x00003FBF // pi/2 lo 239 data8 0x3E223A73BA576E48 // Q8 240 data8 0x3DF54AD8D1F2CA43 // Q9 241 data8 0x3EF66A8EE529A6AA // Q4 242 data8 0x3EC2281050410EE6 // Q5 243 data8 0x3E8D6BB992CC3CF5 // Q6 244 data8 0x3E57F88DE34832E4 // Q7 245 data8 0x3FD5555555555555 // Q0 246 data8 0x3F96C16C16C16DB8 // Q1 247 data8 0x3F61566ABBFFB489 // Q2 248 data8 0x3F2BBD77945C1733 // Q3 249 data8 0x3D927FB33E2B0E04 // Q10 250LOCAL_OBJECT_END(double_Q_tan_constants) 251 252 253.section .text 254 255//////////////////////////////////////////////////////// 256 257LOCAL_LIBM_ENTRY(cot) 258// The initial fnorm will take any unmasked faults and 259// normalize any single/double unorms 260 261{ .mlx 262 cmp.eq p12, p11 = r0, r0 // set p12=1, p11=0 for cot 263 movl tan_GR_sig_inv_pi_by_2 = 0xA2F9836E4E44152A // significand of 2/pi 264} 265{ .mlx 266 addl tan_AD = @ltoff(double_tan_constants), gp 267 movl tan_GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+63+1) 268} 269;; 270 271{ .mlx 272 mov tan_GR_exp_2tom64 = 0xffff-64 // exponent of scaling factor 2^-64 273 movl tan_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift 274} 275{ .mfb 276 ld8 tan_AD = [tan_AD] 277 fnorm.s0 tan_NORM_f8 = f8 278 br.cond.sptk COMMON_PATH 279} 280;; 281 282LOCAL_LIBM_END(cot) 283 284 285GLOBAL_IEEE754_ENTRY(tan) 286// The initial fnorm will take any unmasked faults and 287// normalize any single/double unorms 288 289{ .mlx 290 cmp.eq p11, p12 = r0, r0 // set p11=1, p12=0 for tan 291 movl tan_GR_sig_inv_pi_by_2 = 0xA2F9836E4E44152A // significand of 2/pi 292} 293{ .mlx 294 addl tan_AD = @ltoff(double_tan_constants), gp 295 movl tan_GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+63+1) 296} 297;; 298 299{ .mlx 300 mov tan_GR_exp_2tom64 = 0xffff-64 // exponent of scaling factor 2^-64 301 movl tan_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift 302} 303{ .mfi 304 ld8 tan_AD = [tan_AD] 305 fnorm.s0 tan_NORM_f8 = f8 306 nop.i 0 307} 308;; 309 310 311// Common path for both tan and cot 312COMMON_PATH: 313// Form two constants we need 314// 2/pi * 2^1 * 2^63, scaled by 2^64 since we just loaded the significand 315// 1.1000...000 * 2^(63+63+1) to right shift int(W) into the significand 316{ .mmi 317 setf.sig TAN_INV_PI_BY_2_2TO64 = tan_GR_sig_inv_pi_by_2 318 setf.d TAN_RSHF_2TO64 = tan_GR_rshf_2to64 319 mov tan_GR_17_ones = 0x1ffff ;; 320} 321 322 323// Form another constant 324// 2^-64 for scaling Nfloat 325// 1.1000...000 * 2^63, the right shift constant 326{ .mmf 327 setf.exp TAN_2TOM64 = tan_GR_exp_2tom64 328 adds tan_ADQ = double_Q_tan_constants - double_tan_constants, tan_AD 329(p11) fclass.m.unc p6,p0 = f8, 0x07 // Test for x=0 (tan) 330} 331;; 332 333 334// Form another constant 335// 2^-64 for scaling Nfloat 336// 1.1000...000 * 2^63, the right shift constant 337{ .mmf 338 setf.d TAN_RSHF = tan_GR_rshf 339 ldfe tan_Pi_by_2_hi = [tan_AD],16 340 fclass.m.unc p7,p0 = f8, 0x23 // Test for x=inf 341} 342;; 343 344{ .mfb 345 ldfe tan_Pi_by_2_lo = [tan_ADQ],16 346 fclass.m.unc p8,p0 = f8, 0xc3 // Test for x=nan 347(p6) br.ret.spnt b0 ;; // Exit for x=0 (tan only) 348} 349 350{ .mfi 351 ldfpd tan_P14,tan_P15 = [tan_AD],16 352(p7) frcpa.s0 f8,p9=f0,f0 // Set qnan indef if x=inf 353 mov tan_GR_10009 = 0x10009 354} 355{ .mib 356 ldfpd tan_Q8,tan_Q9 = [tan_ADQ],16 357 nop.i 999 358(p7) br.ret.spnt b0 ;; // Exit for x=inf 359} 360 361{ .mfi 362 ldfpd tan_P12,tan_P13 = [tan_AD],16 363(p12) fclass.m.unc p6,p0 = f8, 0x07 // Test for x=0 (cot) 364 nop.i 999 365} 366{ .mfb 367 ldfpd tan_Q4,tan_Q5 = [tan_ADQ],16 368(p8) fma.d.s0 f8=f8,f1,f8 // Set qnan if x=nan 369(p8) br.ret.spnt b0 ;; // Exit for x=nan 370} 371 372{ .mmf 373 getf.exp tan_signexp = tan_NORM_f8 374 ldfpd tan_P8,tan_P9 = [tan_AD],16 375 fmerge.s arg_copy = f8, f8 ;; // Save input for error call 376} 377 378// Multiply x by scaled 2/pi and add large const to shift integer part of W to 379// rightmost bits of significand 380{ .mmf 381 alloc r32=ar.pfs,0,4,4,0 382 ldfpd tan_Q6,tan_Q7 = [tan_ADQ],16 383 fma.s1 TAN_W_2TO64_RSH = tan_NORM_f8,TAN_INV_PI_BY_2_2TO64,TAN_RSHF_2TO64 384};; 385 386{ .mmf 387 ldfpd tan_P10,tan_P11 = [tan_AD],16 388 and tan_exp = tan_GR_17_ones, tan_signexp 389(p6) frcpa.s0 f8, p0 = f1, f8 ;; // cot(+-0) = +-Inf 390} 391 392 393// p7 is true if we must call DBX TAN 394// p7 is true if f8 exp is > 0x10009 (which includes all ones 395// NAN or inf) 396{ .mmb 397 ldfpd tan_Q0,tan_Q1 = [tan_ADQ],16 398 cmp.ge.unc p7,p0 = tan_exp,tan_GR_10009 399(p7) br.cond.spnt TAN_DBX ;; 400} 401 402 403{ .mmb 404 ldfpd tan_P4,tan_P5 = [tan_AD],16 405(p6) mov GR_Parameter_Tag = 226 // (cot) 406(p6) br.cond.spnt __libm_error_region ;; // call error support if cot(+-0) 407} 408 409 410{ .mmi 411 ldfpd tan_Q2,tan_Q3 = [tan_ADQ],16 412 nop.m 999 413 nop.i 999 ;; 414} 415 416 417 418// TAN_NFLOAT = Round_Int_Nearest(tan_W) 419{ .mfi 420 ldfpd tan_P6,tan_P7 = [tan_AD],16 421 fms.s1 TAN_NFLOAT = TAN_W_2TO64_RSH,TAN_2TOM64,TAN_RSHF 422 nop.i 999 ;; 423} 424 425 426{ .mfi 427 ldfd tan_Q10 = [tan_ADQ] 428 nop.f 999 429 nop.i 999 ;; 430} 431 432 433{ .mfi 434 ldfpd tan_P0,tan_P1 = [tan_AD],16 435 nop.f 999 436 nop.i 999 ;; 437} 438 439 440{ .mmi 441 getf.sig tan_GR_n = TAN_W_2TO64_RSH 442 ldfpd tan_P2,tan_P3 = [tan_AD] 443 nop.i 999 ;; 444} 445 446// tan_r = -tan_Nfloat * tan_Pi_by_2_hi + x 447{ .mfi 448(p12) add tan_GR_n = 0x1, tan_GR_n // N = N + 1 (for cot) 449 fnma.s1 tan_r = TAN_NFLOAT, tan_Pi_by_2_hi, tan_NORM_f8 450 nop.i 999 ;; 451} 452 453 454// p8 ==> even 455// p9 ==> odd 456{ .mmi 457 and tan_GR_N_odd_even = 0x1, tan_GR_n ;; 458 nop.m 999 459 cmp.eq.unc p8,p9 = tan_GR_N_odd_even, r0 ;; 460} 461 462 463.pred.rel "mutex", p11, p12 464// tan_r = tan_r -tan_Nfloat * tan_Pi_by_2_lo (tan) 465{ .mfi 466 nop.m 999 467(p11) fnma.s1 tan_r = TAN_NFLOAT, tan_Pi_by_2_lo, tan_r 468 nop.i 999 469} 470// tan_r = -(tan_r -tan_Nfloat * tan_Pi_by_2_lo) (cot) 471{ .mfi 472 nop.m 999 473(p12) fms.s1 tan_r = TAN_NFLOAT, tan_Pi_by_2_lo, tan_r 474 nop.i 999 ;; 475} 476 477 478{ .mfi 479 nop.m 999 480 fma.s1 tan_rsq = tan_r, tan_r, f0 481 nop.i 999 ;; 482} 483 484 485{ .mfi 486 nop.m 999 487(p9) frcpa.s1 tan_y0, p0 = f1,tan_r 488 nop.i 999 ;; 489} 490 491 492{ .mfi 493 nop.m 999 494(p8) fma.s1 tan_v18 = tan_rsq, tan_P15, tan_P14 495 nop.i 999 496} 497{ .mfi 498 nop.m 999 499(p8) fma.s1 tan_v4 = tan_rsq, tan_P1, tan_P0 500 nop.i 999 ;; 501} 502 503 504 505{ .mfi 506 nop.m 999 507(p8) fma.s1 tan_v16 = tan_rsq, tan_P13, tan_P12 508 nop.i 999 509} 510{ .mfi 511 nop.m 999 512(p8) fma.s1 tan_v17 = tan_rsq, tan_rsq, f0 513 nop.i 999 ;; 514} 515 516 517 518{ .mfi 519 nop.m 999 520(p8) fma.s1 tan_v12 = tan_rsq, tan_P9, tan_P8 521 nop.i 999 522} 523{ .mfi 524 nop.m 999 525(p8) fma.s1 tan_v13 = tan_rsq, tan_P11, tan_P10 526 nop.i 999 ;; 527} 528 529 530 531{ .mfi 532 nop.m 999 533(p8) fma.s1 tan_v7 = tan_rsq, tan_P5, tan_P4 534 nop.i 999 535} 536{ .mfi 537 nop.m 999 538(p8) fma.s1 tan_v8 = tan_rsq, tan_P7, tan_P6 539 nop.i 999 ;; 540} 541 542 543 544{ .mfi 545 nop.m 999 546(p9) fnma.s1 tan_d = tan_r, tan_y0, f1 547 nop.i 999 548} 549{ .mfi 550 nop.m 999 551(p8) fma.s1 tan_v5 = tan_rsq, tan_P3, tan_P2 552 nop.i 999 ;; 553} 554 555 556 557{ .mfi 558 nop.m 999 559(p9) fma.s1 tan_z11 = tan_rsq, tan_Q9, tan_Q8 560 nop.i 999 561} 562{ .mfi 563 nop.m 999 564(p9) fma.s1 tan_z12 = tan_rsq, tan_rsq, f0 565 nop.i 999 ;; 566} 567 568 569{ .mfi 570 nop.m 999 571(p8) fma.s1 tan_v15 = tan_v17, tan_v18, tan_v16 572 nop.i 999 573} 574{ .mfi 575 nop.m 999 576(p9) fma.s1 tan_z7 = tan_rsq, tan_Q5, tan_Q4 577 nop.i 999 ;; 578} 579 580 581{ .mfi 582 nop.m 999 583(p8) fma.s1 tan_v11 = tan_v17, tan_v13, tan_v12 584 nop.i 999 585} 586{ .mfi 587 nop.m 999 588(p9) fma.s1 tan_z8 = tan_rsq, tan_Q7, tan_Q6 589 nop.i 999 ;; 590} 591 592 593 594{ .mfi 595 nop.m 999 596(p8) fma.s1 tan_v14 = tan_v17, tan_v17, f0 597 nop.i 999 598} 599{ .mfi 600 nop.m 999 601(p9) fma.s1 tan_z3 = tan_rsq, tan_Q1, tan_Q0 602 nop.i 999 ;; 603} 604 605 606 607 608{ .mfi 609 nop.m 999 610(p8) fma.s1 tan_v3 = tan_v17, tan_v5, tan_v4 611 nop.i 999 612} 613{ .mfi 614 nop.m 999 615(p8) fma.s1 tan_v6 = tan_v17, tan_v8, tan_v7 616 nop.i 999 ;; 617} 618 619 620 621{ .mfi 622 nop.m 999 623(p9) fma.s1 tan_y1 = tan_y0, tan_d, tan_y0 624 nop.i 999 625} 626{ .mfi 627 nop.m 999 628(p9) fma.s1 tan_dsq = tan_d, tan_d, f0 629 nop.i 999 ;; 630} 631 632 633{ .mfi 634 nop.m 999 635(p9) fma.s1 tan_z10 = tan_z12, tan_Q10, tan_z11 636 nop.i 999 637} 638{ .mfi 639 nop.m 999 640(p9) fma.s1 tan_z9 = tan_z12, tan_z12,f0 641 nop.i 999 ;; 642} 643 644 645{ .mfi 646 nop.m 999 647(p9) fma.s1 tan_z4 = tan_rsq, tan_Q3, tan_Q2 648 nop.i 999 649} 650{ .mfi 651 nop.m 999 652(p9) fma.s1 tan_z6 = tan_z12, tan_z8, tan_z7 653 nop.i 999 ;; 654} 655 656 657 658{ .mfi 659 nop.m 999 660(p8) fma.s1 tan_v10 = tan_v14, tan_v15, tan_v11 661 nop.i 999 ;; 662} 663 664 665 666{ .mfi 667 nop.m 999 668(p9) fma.s1 tan_y2 = tan_y1, tan_d, tan_y0 669 nop.i 999 670} 671{ .mfi 672 nop.m 999 673(p9) fma.s1 tan_d4 = tan_dsq, tan_dsq, tan_d 674 nop.i 999 ;; 675} 676 677 678{ .mfi 679 nop.m 999 680(p8) fma.s1 tan_v2 = tan_v14, tan_v6, tan_v3 681 nop.i 999 682} 683{ .mfi 684 nop.m 999 685(p8) fma.s1 tan_v9 = tan_v14, tan_v14, f0 686 nop.i 999 ;; 687} 688 689 690{ .mfi 691 nop.m 999 692(p9) fma.s1 tan_z2 = tan_z12, tan_z4, tan_z3 693 nop.i 999 694} 695{ .mfi 696 nop.m 999 697(p9) fma.s1 tan_z5 = tan_z9, tan_z10, tan_z6 698 nop.i 999 ;; 699} 700 701 702{ .mfi 703 nop.m 999 704(p9) fma.s1 tan_inv_r = tan_d4, tan_y2, tan_y0 705 nop.i 999 706} 707{ .mfi 708 nop.m 999 709(p8) fma.s1 tan_rcube = tan_rsq, tan_r, f0 710 nop.i 999 ;; 711} 712 713 714 715{ .mfi 716 nop.m 999 717(p8) fma.s1 tan_v1 = tan_v9, tan_v10, tan_v2 718 nop.i 999 719} 720{ .mfi 721 nop.m 999 722(p9) fma.s1 tan_z1 = tan_z9, tan_z5, tan_z2 723 nop.i 999 ;; 724} 725 726 727 728{ .mfi 729 nop.m 999 730(p8) fma.d.s0 f8 = tan_v1, tan_rcube, tan_r 731 nop.i 999 732} 733{ .mfb 734 nop.m 999 735(p9) fms.d.s0 f8 = tan_r, tan_z1, tan_inv_r 736 br.ret.sptk b0 ;; 737} 738GLOBAL_IEEE754_END(tan) 739libm_alias_double_other (__tan, tan) 740 741 742LOCAL_LIBM_ENTRY(__libm_callout) 743TAN_DBX: 744.prologue 745 746{ .mfi 747 nop.m 0 748 fmerge.s f9 = f0,f0 749.save ar.pfs,GR_SAVE_PFS 750 mov GR_SAVE_PFS=ar.pfs 751} 752;; 753 754{ .mfi 755 mov GR_SAVE_GP=gp 756 nop.f 0 757.save b0, GR_SAVE_B0 758 mov GR_SAVE_B0=b0 759} 760 761.body 762{ .mmb 763 nop.m 999 764 nop.m 999 765(p11) br.cond.sptk.many call_tanl ;; 766} 767 768// Here if we should call cotl 769{ .mmb 770 nop.m 999 771 nop.m 999 772 br.call.sptk.many b0=__libm_cotl# ;; 773} 774 775{ .mfi 776 mov gp = GR_SAVE_GP 777 fnorm.d.s0 f8 = f8 778 mov b0 = GR_SAVE_B0 779} 780;; 781 782{ .mib 783 nop.m 999 784 mov ar.pfs = GR_SAVE_PFS 785 br.ret.sptk b0 786;; 787} 788 789// Here if we should call tanl 790call_tanl: 791{ .mmb 792 nop.m 999 793 nop.m 999 794 br.call.sptk.many b0=__libm_tanl# ;; 795} 796 797{ .mfi 798 mov gp = GR_SAVE_GP 799 fnorm.d.s0 f8 = f8 800 mov b0 = GR_SAVE_B0 801} 802;; 803 804{ .mib 805 nop.m 999 806 mov ar.pfs = GR_SAVE_PFS 807 br.ret.sptk b0 808;; 809} 810 811LOCAL_LIBM_END(__libm_callout) 812 813.type __libm_tanl#,@function 814.global __libm_tanl# 815.type __libm_cotl#,@function 816.global __libm_cotl# 817 818LOCAL_LIBM_ENTRY(__libm_error_region) 819.prologue 820 821// (1) 822{ .mfi 823 add GR_Parameter_Y=-32,sp // Parameter 2 value 824 nop.f 0 825.save ar.pfs,GR_SAVE_PFS 826 mov GR_SAVE_PFS=ar.pfs // Save ar.pfs 827} 828{ .mfi 829.fframe 64 830 add sp=-64,sp // Create new stack 831 nop.f 0 832 mov GR_SAVE_GP=gp // Save gp 833};; 834 835// (2) 836{ .mmi 837 stfd [GR_Parameter_Y] = f1,16 // STORE Parameter 2 on stack 838 add GR_Parameter_X = 16,sp // Parameter 1 address 839.save b0, GR_SAVE_B0 840 mov GR_SAVE_B0=b0 // Save b0 841};; 842 843.body 844// (3) 845{ .mib 846 stfd [GR_Parameter_X] = arg_copy // STORE Parameter 1 on stack 847 add GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address 848 nop.b 0 849} 850{ .mib 851 stfd [GR_Parameter_Y] = f8 // STORE Parameter 3 on stack 852 add GR_Parameter_Y = -16,GR_Parameter_Y 853 br.call.sptk b0=__libm_error_support# // Call error handling function 854};; 855{ .mmi 856 nop.m 0 857 nop.m 0 858 add GR_Parameter_RESULT = 48,sp 859};; 860 861// (4) 862{ .mmi 863 ldfd f8 = [GR_Parameter_RESULT] // Get return result off stack 864.restore sp 865 add sp = 64,sp // Restore stack pointer 866 mov b0 = GR_SAVE_B0 // Restore return address 867};; 868{ .mib 869 mov gp = GR_SAVE_GP // Restore gp 870 mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs 871 br.ret.sptk b0 // Return 872};; 873 874LOCAL_LIBM_END(__libm_error_region) 875 876.type __libm_error_support#,@function 877.global __libm_error_support# 878