1 !
   2 ! CDDL HEADER START
   3 !
   4 ! The contents of this file are subject to the terms of the
   5 ! Common Development and Distribution License (the "License").
   6 ! You may not use this file except in compliance with the License.
   7 !
   8 ! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 ! or http://www.opensolaris.org/os/licensing.
  10 ! See the License for the specific language governing permissions
  11 ! and limitations under the License.
  12 !
  13 ! When distributing Covered Code,  this CDDL HEADER in each
  14 ! file and  the License file at usr/src/OPENSOLARIS.LICENSE.
  15 ! If applicable, add the following below this CDDL HEADER, with the
  16 ! fields enclosed by brackets "[]" replaced with your own identifying
  17 ! information: Portions Copyright [yyyy] [name of copyright owner]
  18 !
  19 ! CDDL HEADER END
  20 !
  21 ! Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  22 !
  23 ! Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24 ! Use is subject to license terms.
  25 !
  26 
  27 ! Portions of this file are duplicated as GCC inline assembly in
  28 ! libm_inlines.h.  Keep them in sync.
  29 
  30         .inline __ieee754_sqrt,1
  31         fsqrtd  %f0,%f0
  32         .end
  33 
  34         .inline __inline_sqrtf,1
  35         fsqrts  %f1,%f0
  36         .end
  37 
  38         .inline __inline_sqrt,1
  39         fsqrtd  %f0,%f0
  40         .end
  41 
  42         .inline __sqrtf,1
  43         fsqrts  %f1,%f0
  44         .end
  45 
  46         .inline __sqrt,1
  47         fsqrtd  %f0,%f0
  48         .end
  49 
  50         .inline __ceil,1
  51         sethi   %hi(0x43300000),%o0
  52         sllx    %o0,32,%o0
  53         stx     %o0,[%sp+0x87f]
  54         ldd     [%sp+0x87f],%f2
  55         fabsd   %f0,%f4
  56         fsubd   %f2,%f2,%f6
  57         fcmpd   %fcc0,%f4,%f2
  58         fbl,pt  %fcc0,1f
  59         nop
  60         sethi   %hi(0x3ff00000),%o0
  61         sllx    %o0,32,%o0
  62         stx     %o0,[%sp+0x87f]
  63         ldd     [%sp+0x87f],%f6
  64         fmuld   %f0,%f6,%f0
  65         ba      4f
  66         nop
  67 1:
  68         fcmpd   %fcc1,%f0,%f6
  69         fbg,pt  %fcc1,2f
  70         nop
  71         fbe,pn  %fcc1,4f
  72         nop
  73         fnegd   %f2,%f2
  74 2:
  75         faddd   %f0,%f2,%f4
  76         fsubd   %f4,%f2,%f4
  77         fcmpd   %fcc0,%f4,%f0
  78         fbge,pt %fcc0,3f
  79         nop
  80         sethi   %hi(0x3ff00000),%o0
  81         st      %o0,[%sp+0x87f]
  82         ldd     [%sp+0x87f],%f2
  83         faddd   %f4,%f2,%f4
  84 3:
  85         fabsd   %f4,%f0
  86         fbge,pt %fcc1,4f
  87         nop
  88         fnegd   %f0,%f0
  89 4:
  90         .end
  91 
  92         .inline __floor,1
  93         sethi   %hi(0x43300000),%o0
  94         sllx    %o0,32,%o0
  95         stx     %o0,[%sp+0x87f]
  96         ldd     [%sp+0x87f],%f2
  97         fabsd   %f0,%f4
  98         fsubd   %f2,%f2,%f6
  99         fcmpd   %fcc0,%f4,%f2
 100         fbl,pt  %fcc0,1f
 101         nop
 102         sethi   %hi(0x3ff00000),%o0
 103         sllx    %o0,32,%o0
 104         stx     %o0,[%sp+0x87f]
 105         ldd     [%sp+0x87f],%f6
 106         fmuld   %f0,%f6,%f0
 107         ba      4f
 108         nop
 109 1:
 110         fcmpd   %fcc1,%f0,%f6
 111         fbg,pt  %fcc1,2f
 112         nop
 113         fbe,pn  %fcc1,4f
 114         nop
 115         fnegd   %f2,%f2
 116 2:
 117         faddd   %f0,%f2,%f4
 118         fsubd   %f4,%f2,%f4
 119         fcmpd   %fcc0,%f4,%f0
 120         fble,pt %fcc0,3f
 121         nop
 122         sethi   %hi(0x3ff00000),%o0
 123         st      %o0,[%sp+0x87f]
 124         ldd     [%sp+0x87f],%f2
 125         fsubd   %f4,%f2,%f4
 126 3:
 127         fabsd   %f4,%f0
 128         fbge,pt %fcc1,4f
 129         nop
 130         fnegd   %f0,%f0
 131 4:
 132         .end
 133 
 134         .inline __ilogb,1
 135         st      %f0,[%sp+0x87f]
 136         ld      [%sp+0x87f],%o0
 137         sethi   %hi(0x7ff00000),%o1
 138         andcc   %o0,%o1,%o0
 139         bne,pt  %icc,2f
 140         nop
 141         sethi   %hi(0x43500000),%o0
 142         sllx    %o0,32,%o0
 143         stx     %o0,[%sp+0x87f]
 144         ldd     [%sp+0x87f],%f2
 145         fmuld   %f0,%f2,%f0
 146         st      %f0,[%sp+0x87f]
 147         ld      [%sp+0x87f],%o0
 148         andcc   %o0,%o1,%o0
 149         bne,pt  %icc,1f
 150         nop
 151         sethi   %hi(0x80000001),%o0
 152         or      %o0,%lo(0x80000001),%o0
 153         ba      4f
 154         nop
 155 1:
 156         srl     %o0,20,%o0
 157         sub     %o0,0x435,%o0
 158         ba      4f
 159         nop
 160 2:
 161         subcc   %o1,%o0,%g0
 162         bne,pt  %icc,3f
 163         nop
 164         sethi   %hi(0x7fffffff),%o0
 165         or      %o0,%lo(0x7fffffff),%o0
 166         ba      4f
 167         nop
 168 3:
 169         srl     %o0,20,%o0
 170         sub     %o0,0x3ff,%o0
 171 4:
 172         .end
 173 
 174         .inline __rint,1
 175         std     %f0,[%sp+0x87f]
 176         ldx     [%sp+0x87f],%o0
 177         sethi   %hi(0x80000000),%o2
 178         sllx    %o2,32,%o2
 179         andn    %o0,%o2,%o2
 180         sethi   %hi(0x43300000),%o3
 181         sllx    %o3,32,%o3
 182         stx     %g0,[%sp+0x887]
 183         subcc   %o2,%o3,%g0
 184         bl,pt   %xcc,1f
 185         nop
 186         sethi   %hi(0x3ff00000),%o2
 187         sllx    %o2,32,%o2
 188         stx     %o2,[%sp+0x887]
 189         ldd     [%sp+0x887],%f2
 190         fmuld   %f0,%f2,%f0
 191         ba      3f
 192         nop
 193 1:
 194         orcc    %o0,0,%g0
 195         stx     %o3,[%sp+0x87f]
 196         ldd     [%sp+0x87f],%f2
 197         bge,pt  %xcc,2f
 198         nop
 199         fnegd   %f2,%f2
 200 2:
 201         faddd   %f0,%f2,%f0
 202         fcmpd   %f0,%f2
 203         fbne,pt %fcc0,0f
 204         nop
 205         ldd     [%sp+0x887],%f0
 206         bge,pt  %xcc,3f
 207         nop
 208         fnegd   %f0,%f0
 209         ba      3f
 210         nop
 211 0:
 212         fsubd   %f0,%f2,%f0
 213 3:
 214         .end
 215 
 216         .inline __rintf,1
 217         st      %f1,[%sp+0x87f]
 218         ld      [%sp+0x87f],%o0
 219         sethi   %hi(0x80000000),%o2
 220         andn    %o0,%o2,%o2
 221         sethi   %hi(0x4b000000),%o3
 222         st      %g0,[%sp+0x887]
 223         subcc   %o2,%o3,%g0
 224         bl      1f
 225         nop
 226         sethi   %hi(0x3f800000),%o2
 227         st      %o2,[%sp+0x887]
 228         ld      [%sp+0x887],%f2
 229         fmuls   %f1,%f2,%f0
 230         ba      3f
 231         nop
 232 1:
 233         tst     %o0
 234         st      %o3,[%sp+0x87f]
 235         ld      [%sp+0x87f],%f2
 236         bge     2f
 237         nop
 238         fnegs   %f2,%f2
 239 2:
 240         fadds   %f1,%f2,%f0
 241         fcmps   %f0,%f2
 242         fbne    0f
 243         nop
 244         ld      [%sp+0x887],%f0
 245         bge     3f
 246         nop
 247         fnegs   %f0,%f0
 248         ba      3f
 249         nop
 250 0:
 251         fsubs   %f0,%f2,%f0
 252 3:
 253         .end
 254 
 255         .inline __min_subnormal,1
 256         or      %g0,1,%o0
 257         stx     %o0,[%sp+0x87f]
 258         ldd     [%sp+0x87f],%f0
 259         .end
 260 
 261         .inline __min_subnormalf,1
 262         or      %g0,1,%o0
 263         st      %o0,[%sp+0x87f]
 264         ld      [%sp+0x87f],%f0
 265         .end
 266 
 267         .inline __max_subnormal,1
 268         xnor    %g0,%g0,%o0
 269         srlx    %o0,12,%o0
 270         stx     %o0,[%sp+0x87f]
 271         ldd     [%sp+0x87f],%f0
 272         .end
 273 
 274         .inline __max_subnormalf,1
 275         xnor    %g0,%g0,%o0
 276         srl     %o0,9,%o0
 277         st      %o0,[%sp+0x87f]
 278         ld      [%sp+0x87f],%f0
 279         .end
 280 
 281         .inline __min_normal,1
 282         sethi   %hi(0x00100000),%o0
 283         sllx    %o0,32,%o0
 284         stx     %o0,[%sp+0x87f]
 285         ldd     [%sp+0x87f],%f0
 286         .end
 287 
 288         .inline __min_normalf,1
 289         sethi   %hi(0x00800000),%o0
 290         st      %o0,[%sp+0x87f]
 291         ld      [%sp+0x87f],%f0
 292         .end
 293 
 294         .inline __max_normal,1
 295         sethi   %hi(0x80100000),%o1
 296         sllx    %o1,32,%o1
 297         xnor    %g0,%g0,%o0
 298         andn    %o0,%o1,%o0
 299         stx     %o0,[%sp+0x87f]
 300         ldd     [%sp+0x87f],%f0
 301         .end
 302 
 303         .inline __max_normalf,1
 304         sethi   %hi(0x7f7ffc00),%o0
 305         or      %o0,0x3ff,%o0
 306         st      %o0,[%sp+0x87f]
 307         ld      [%sp+0x87f],%f0
 308         .end
 309 
 310         .inline __infinity,1
 311         sethi   %hi(0x7ff00000),%o0
 312         sllx    %o0,32,%o0
 313         stx     %o0,[%sp+0x87f]
 314         ldd     [%sp+0x87f],%f0
 315         .end
 316 
 317         .inline __infinity,1
 318         sethi   %hi(0x7ff00000),%o0
 319         sllx    %o0,32,%o0
 320         stx     %o0,[%sp+0x87f]
 321         ldd     [%sp+0x87f],%f0
 322         .end
 323 
 324         .inline __infinityf,1
 325         sethi   %hi(0x7f800000),%o0
 326         st      %o0,[%sp+0x87f]
 327         ld      [%sp+0x87f],%f0
 328         .end
 329 
 330         .inline __signaling_nan,1
 331         sethi   %hi(0x7ff00000),%o0
 332         sllx    %o0,32,%o0
 333         or      %o0,0x1,%o0
 334         stx     %o0,[%sp+0x87f]
 335         ldd     [%sp+0x87f],%f0
 336         .end
 337 
 338         .inline __signaling_nanf,1
 339         sethi   %hi(0x7f800000),%o0
 340         or      %o0,1,%o0
 341         st      %o0,[%sp+0x87f]
 342         ld      [%sp+0x87f],%f0
 343         .end
 344 
 345         .inline __quiet_nan,1
 346         xnor    %g0,%g0,%o0
 347         srlx    %o0,1,%o0
 348         stx     %o0,[%sp+0x87f]
 349         ldd     [%sp+0x87f],%f0
 350         .end
 351 
 352         .inline __quiet_nanf,1
 353         xnor    %g0,%g0,%o0
 354         srl     %o0,1,%o0
 355         st      %o0,[%sp+0x87f]
 356         ld      [%sp+0x87f],%f0
 357         .end
 358 
 359         .inline __swapEX,1
 360         and     %o0,0x1f,%o1
 361         sll     %o1,5,%o1
 362         .volatile
 363         st      %fsr,[%sp+0x87f]
 364         ld      [%sp+0x87f],%o0
 365         andn    %o0,0x3e0,%o2
 366         or      %o1,%o2,%o1
 367         st      %o1,[%sp+0x87f]
 368         ld      [%sp+0x87f],%fsr
 369         srl     %o0,5,%o0
 370         and     %o0,0x1f,%o0
 371         .nonvolatile
 372         .end
 373 
 374         .inline _QgetRD,0
 375         st      %fsr,[%sp+0x87f]
 376         ld      [%sp+0x87f],%o0
 377         srl     %o0,30,%o0
 378         .end
 379 
 380         .inline _QgetRP,0
 381         or      %g0,%g0,%o0
 382         .end
 383 
 384         .inline __swapRD,1
 385         and     %o0,0x3,%o0
 386         sll     %o0,30,%o1
 387         .volatile
 388         st      %fsr,[%sp+0x87f]
 389         ld      [%sp+0x87f],%o0
 390         sethi   %hi(0xc0000000),%o4
 391         andn    %o0,%o4,%o2
 392         or      %o1,%o2,%o1
 393         st      %o1,[%sp+0x87f]
 394         ld      [%sp+0x87f],%fsr
 395         srl     %o0,30,%o0
 396         and     %o0,0x3,%o0
 397         .nonvolatile
 398         .end
 399 !
 400 ! On the SPARC, __swapRP is a no-op; always return 0 for backward compatibility
 401 !
 402 
 403         .inline __swapRP,1
 404         or      %g0,%g0,%o0
 405         .end
 406 
 407         .inline __swapTE,1
 408         and     %o0,0x1f,%o0
 409         sll     %o0,23,%o1
 410         .volatile
 411         st      %fsr,[%sp+0x87f]
 412         ld      [%sp+0x87f],%o0
 413         sethi   %hi(0x0f800000),%o4
 414         andn    %o0,%o4,%o2
 415         or      %o1,%o2,%o1
 416         st      %o1,[%sp+0x87f]
 417         ld      [%sp+0x87f],%fsr
 418         srl     %o0,23,%o0
 419         and     %o0,0x1f,%o0
 420         .nonvolatile
 421         .end
 422 
 423         .inline __fp_class,1
 424         fabsd   %f0,%f0
 425         std     %f0,[%sp+0x87f]
 426         ldx     [%sp+0x87f],%o0
 427         orcc    %g0,%o0,%g0
 428         be,pn   %xcc,2f
 429         nop
 430         sethi   %hi(0x7ff00000),%o1
 431         sllx    %o1,32,%o1
 432         andcc   %o0,%o1,%g0
 433         bne,pt  %xcc,1f
 434         nop
 435         or      %g0,1,%o0
 436         ba      2f
 437         nop
 438 1:
 439         subcc   %o0,%o1,%g0
 440         bge,pn  %xcc,1f
 441         nop
 442         or      %g0,2,%o0
 443         ba      2f
 444         nop
 445 1:
 446         andncc  %o0,%o1,%o0
 447         bne,pn  %xcc,1f
 448         nop
 449         or      %g0,3,%o0
 450         ba      2f
 451         nop
 452 1:
 453         sethi   %hi(0x00080000),%o1
 454         sllx    %o1,32,%o1
 455         andcc   %o0,%o1,%g0
 456         or      %g0,4,%o0
 457         bne,pt  %xcc,2f
 458         nop
 459         or      %g0,5,%o0
 460 2:
 461         .end
 462 
 463         .inline __fp_classf,1
 464         fabss   %f1,%f1
 465         st      %f1,[%sp+0x87f]
 466         ld      [%sp+0x87f],%o0
 467         orcc    %g0,%o0,%g0
 468         be,pn   %icc,2f
 469         nop
 470 1:
 471         sethi   %hi(0x7f800000),%o1
 472         andcc   %o0,%o1,%g0
 473         bne,pt  %icc,1f
 474         nop
 475         or      %g0,1,%o0
 476         ba      2f
 477         nop
 478 1:
 479         subcc   %o0,%o1,%g0
 480         bge,pn  %icc,1f
 481         nop
 482         or      %g0,2,%o0
 483         ba      2f
 484         nop
 485 1:
 486         bg,pn   %icc,1f
 487         nop
 488         or      %g0,3,%o0
 489         ba      2f
 490         nop
 491 1:
 492         sethi   %hi(0x00400000),%o1
 493         andcc   %o0,%o1,%g0
 494         or      %g0,4,%o0
 495         bne,pt  %icc,2f
 496         nop
 497         or      %g0,5,%o0
 498 2:
 499         .end
 500 
 501         .inline __copysign,2
 502         fabsd   %f0,%f0
 503         st      %f0,[%sp+0x87f]
 504         ld      [%sp+0x87f],%o0
 505         st      %f2,[%sp+0x887]
 506         ld      [%sp+0x887],%o1
 507         srl     %o1,31,%o1
 508         sll     %o1,31,%o1
 509         or      %o0,%o1,%o0
 510         st      %o0,[%sp+0x87f]
 511         ld      [%sp+0x87f],%f0
 512         .end
 513 
 514         .inline __copysignf,2
 515         fabss   %f1,%f1
 516         st      %f1,[%sp+0x87f]
 517         ld      [%sp+0x87f],%o0
 518         st      %f3,[%sp+0x887]
 519         ld      [%sp+0x887],%o1
 520         srl     %o1,31,%o1
 521         sll     %o1,31,%o1
 522         or      %o0,%o1,%o0
 523         st      %o0,[%sp+0x87f]
 524         ld      [%sp+0x87f],%f0
 525         .end
 526 
 527         .inline _finite,1
 528         fabsd   %f0,%f0
 529         st      %f0,[%sp+0x87f]
 530         ld      [%sp+0x87f],%o0
 531         sethi   %hi(0x7ff00000),%o1
 532         sub     %o0,%o1,%o0
 533         srl     %o0,31,%o0
 534         .end
 535 
 536         .inline __finitef,1
 537         fabss   %f1,%f1
 538         st      %f1,[%sp+0x87f]
 539         ld      [%sp+0x87f],%o0
 540         sethi   %hi(0x7f800000),%o1
 541         sub     %o0,%o1,%o0
 542         srl     %o0,31,%o0
 543         .end
 544 
 545         .inline __signbit,1
 546         st      %f0,[%sp+0x87f]
 547         ld      [%sp+0x87f],%o0
 548         srl     %o0,31,%o0
 549         .end
 550 
 551         .inline __signbitf,1
 552         st      %f1,[%sp+0x87f]
 553         ld      [%sp+0x87f],%o0
 554         srl     %o0,31,%o0
 555         .end
 556 
 557         .inline __isinf,1
 558         fabsd   %f0,%f0
 559         std     %f0,[%sp+0x87f]
 560         ldx     [%sp+0x87f],%o0
 561         sethi   %hi(0x7ff00000),%o1
 562         sllx    %o1,32,%o1
 563         sub     %o0,%o1,%o0
 564         sub     %g0,%o0,%o1
 565         or      %o0,%o1,%o0
 566         xnor    %o0,%g0,%o0
 567         srlx    %o0,63,%o0
 568         .end
 569 
 570         .inline __isinff,1
 571         fabss   %f1,%f1
 572         st      %f1,[%sp+0x87f]
 573         ld      [%sp+0x87f],%o0
 574         sethi   %hi(0x7f800000),%o1
 575         sub     %o0,%o1,%o0
 576         sub     %g0,%o0,%o1
 577         or      %o0,%o1,%o0
 578         xnor    %o0,%g0,%o0
 579         srl     %o0,31,%o0
 580         .end
 581 
 582         .inline __isnan,1
 583         std     %f0,[%sp+0x87f]
 584         ldx     [%sp+0x87f],%o0
 585         sllx    %o0,1,%o0
 586         srlx    %o0,1,%o0
 587         sethi   %hi(0x7ff00000),%o1
 588         sllx    %o1,32,%o1
 589         sub     %o1,%o0,%o0
 590         srlx    %o0,63,%o0
 591         .end
 592 
 593         .inline __isnanf,1
 594         st      %f1,[%sp+0x87f]
 595         ld      [%sp+0x87f],%o0
 596         sethi   %hi(0x80000000),%o2
 597         andn    %o0,%o2,%o0
 598         sethi   %hi(0x7f800000),%o1
 599         sub     %o1,%o0,%o0
 600         srl     %o0,31,%o0
 601         .end
 602 
 603         .inline __isnormal,1
 604         fabsd   %f0,%f0
 605         st      %f0,[%sp+0x87f]
 606         ld      [%sp+0x87f],%o0
 607         sethi   %hi(0x7ff00000),%o1
 608         sub     %o0,%o1,%o2
 609         sethi   %hi(0x00100000),%o1
 610         sub     %o0,%o1,%o1
 611         andn    %o2,%o1,%o0
 612         srl     %o0,31,%o0
 613         .end
 614 
 615         .inline __isnormalf,1
 616         fabss   %f1,%f1
 617         st      %f1,[%sp+0x87f]
 618         ld      [%sp+0x87f],%o0
 619         sethi   %hi(0x7f800000),%o1
 620         sub     %o0,%o1,%o2
 621         sethi   %hi(0x00800000),%o1
 622         sub     %o0,%o1,%o1
 623         andn    %o2,%o1,%o0
 624         srl     %o0,31,%o0
 625         .end
 626 
 627         .inline __issubnormal,1
 628         fabsd   %f0,%f0
 629         std     %f0,[%sp+0x87f]
 630         ldx     [%sp+0x87f],%o0
 631         sethi   %hi(0x00100000),%o1
 632         sllx    %o1,32,%o1
 633         sub     %o0,%o1,%o1
 634         sub     %g0,%o0,%o2
 635         or      %o0,%o2,%o0
 636         and     %o0,%o1,%o0
 637         srlx    %o0,63,%o0
 638         .end
 639 
 640         .inline __issubnormalf,1
 641         fabss   %f1,%f1
 642         st      %f1,[%sp+0x87f]
 643         ld      [%sp+0x87f],%o0
 644         sethi   %hi(0x00800000),%o1
 645         sub     %o0,%o1,%o1
 646         sub     %g0,%o0,%o2
 647         or      %o0,%o2,%o0
 648         and     %o0,%o1,%o0
 649         srl     %o0,31,%o0
 650         .end
 651 
 652         .inline __iszero,1
 653         fabsd   %f0,%f0
 654         std     %f0,[%sp+0x87f]
 655         ldx     [%sp+0x87f],%o0
 656         sub     %g0,%o0,%o1
 657         or      %o0,%o1,%o0
 658         xnor    %o0,%g0,%o0
 659         srlx    %o0,63,%o0
 660         .end
 661 
 662         .inline __iszerof,1
 663         fabss   %f1,%f1
 664         st      %f1,[%sp+0x87f]
 665         ld      [%sp+0x87f],%o0
 666         sub     %g0,%o0,%o1
 667         or      %o0,%o1,%o0
 668         xnor    %o0,%g0,%o0
 669         srl     %o0,31,%o0
 670         .end
 671 
 672         .inline abs,1
 673         sra     %o0,31,%o1
 674         xor     %o0,%o1,%o0
 675         sub     %o0,%o1,%o0
 676         sra     %o0,0,%o0
 677         .end
 678 
 679         .inline __fabs,1
 680         fabsd   %f0,%f0
 681         .end
 682 
 683         .inline __fabsf,1
 684         fabss   %f1,%f0
 685         .end
 686 !
 687 !       __nintf - f77 NINT(REAL*4)
 688 !
 689 
 690         .inline __nintf,1
 691         st      %f1,[%sp+0x87f]
 692         ld      [%sp+0x87f],%o0
 693         srl     %o0,30-7,%g1
 694         sethi   %hi(0x7fffff),%o2
 695         and     %g1,0xff,%g1
 696         or      %o2,%lo(0x7fffff),%o2
 697         sethi   %hi(1<<22),%o4
 698         subcc   %g1,127+31,%g0
 699         and     %o0,%o2,%o3
 700         bl      1f
 701         nop
 702         sethi   %hi(0xcf000000),%o2
 703         sethi   %hi(0x80000000),%g1
 704         subcc   %o0,%o2,%g0
 705         or      %g1,%g0,%o0
 706         be      0f
 707         nop
 708         fstoi   %f1,%f0
 709         st      %f0,[%sp+0x87f]
 710         ld      [%sp+0x87f],%o0
 711 0:
 712         sra     %o0,0,%o0
 713         ba      9f
 714         nop
 715 1:
 716         add     %o4,%o4,%o5
 717         or      %o3,%o5,%o3
 718         sra     %o0,31-0,%o2
 719         subcc   %g1,127,%g1
 720         srl     %o4,%g1,%o4
 721         bge     1f
 722         nop
 723         subcc   %g1,-1,%g0
 724         or      %g0,0,%o0
 725         bne     2f
 726         nop
 727         or      %g0,1,%o0
 728         ba      2f
 729         nop
 730 1:
 731         add     %o3,%o4,%o3
 732         or      %g0,23,%o0
 733         subcc   %o0,%g1,%o0
 734         bl      1f
 735         nop
 736         srl     %o3,%o0,%o0
 737         ba      2f
 738         nop
 739 1:
 740         sub     %g0,%o0,%o0
 741         sll     %o3,%o0,%o0
 742 2:
 743         xor     %o0,%o2,%o0
 744         sra     %o0,0,%o0
 745         and     %o2,1,%o2
 746         add     %o0,%o2,%o0
 747 9:
 748         .end
 749 
 750         .inline __il_nint,1
 751         ld      [%o0],%o0
 752         sra     %o0,0,%o0
 753         srlx    %o0,31-8,%g1
 754         or      %g0,1,%o2
 755         sllx    %o2,23-1,%o4
 756         and     %g1,0xff,%g1
 757         sllx    %o2,63-0,%o2
 758         subcc   %g1,127+63,%g0
 759         bl      0f
 760         nop
 761         st      %o0,[%sp+0x87f]
 762         ld      [%sp+0x87f],%f0
 763         fstox   %f0,%f0
 764         std     %f0,[%sp+0x87f]
 765         ldx     [%sp+0x87f],%o0
 766         ba      9f
 767         nop
 768 0:
 769         add     %o4,%o4,%o5
 770         srax    %o2,63-23,%o2
 771         sub     %g1,127+23,%o1
 772         xnor    %o2,%g0,%o2
 773         and     %o0,%o2,%o3
 774         or      %o3,%o5,%o3
 775         srax    %o0,63-0,%o2
 776         subcc   %g1,127,%g1
 777         bge     1f
 778         nop
 779         subcc   %g1,-1,%g0
 780         or      %g0,0,%o0
 781         bne     2f
 782         nop
 783         or      %g0,1,%o0
 784         ba      2f
 785         nop
 786 1:
 787         brlz,pt %o1,3f
 788         nop
 789         sub     %g1,23,%o0
 790         sllx    %o3,%o0,%o0
 791         ba      2f
 792         nop
 793 3:
 794         srlx    %o4,%g1,%o4
 795         add     %o3,%o4,%o3
 796         or      %g0,23,%o0
 797         sub     %o0,%g1,%o0
 798         srlx    %o3,%o0,%o0
 799 2:
 800         xor     %o0,%o2,%o0
 801         sub     %o0,%o2,%o0
 802 9:
 803         .end
 804 !
 805 !       __i_dnnt - f77 NINT(REAL*8)
 806 !
 807 
 808         .inline __i_dnnt,1
 809         ldx     [%o0],%o0
 810         srlx    %o0,63-11,%g1
 811         or      %g0,1,%o2
 812         stx     %o0,[%sp+0x87f]
 813         sllx    %o2,52-1,%o4
 814         and     %g1,0x7ff,%g1
 815         sllx    %o2,63-0,%o2
 816         subcc   %g1,1023+32,%g0
 817         bl      0f
 818         nop
 819         ldd     [%sp+0x87f],%f0
 820         ba      8f
 821         nop
 822 0:
 823         add     %o4,%o4,%o5
 824         srax    %o2,63-52,%o2
 825         sub     %g1,1023+30,%o1
 826         xnor    %o2,%g0,%o2
 827         and     %o0,%o2,%o3
 828         or      %o3,%o5,%o3
 829         srax    %o0,63-0,%o2
 830         subcc   %g1,1023,%g1
 831         bge     1f
 832         nop
 833         subcc   %g1,-1,%g0
 834         or      %g0,0,%o0
 835         bne     2f
 836         nop
 837         or      %g0,1,%o0
 838         ba      2f
 839         nop
 840 1:
 841         srlx    %o4,%g1,%o4
 842         add     %o3,%o4,%o3
 843         or      %g0,52,%o0
 844         sub     %o0,%g1,%o0
 845         srlx    %o3,%o0,%o0
 846 2:
 847         xor     %o0,%o2,%o0
 848         sub     %o0,%o2,%o0
 849         brlz,pt %o1,9f
 850         nop
 851         stx     %o0,[%sp+0x87f]
 852         ldd     [%sp+0x87f],%f0
 853         fxtod   %f0,%f0
 854 8:
 855         fdtoi   %f0,%f0
 856         st      %f0,[%sp+0x87f]
 857         ld      [%sp+0x87f],%o0
 858         sra     %o0,0,%o0
 859 9:
 860         .end
 861 
 862         .inline __il_dnnt,1
 863         ldx     [%o0],%o0
 864         srlx    %o0,63-11,%g1
 865         or      %g0,1,%o2
 866         sllx    %o2,52-1,%o4
 867         and     %g1,0x7ff,%g1
 868         sllx    %o2,63-0,%o2
 869         subcc   %g1,1023+63,%g0
 870         bl      0f
 871         nop
 872         stx     %o0,[%sp+0x87f]
 873         ldd     [%sp+0x87f],%f0
 874         fdtox   %f0,%f0
 875         std     %f0,[%sp+0x87f]
 876         ldx     [%sp+0x87f],%o0
 877         ba      9f
 878         nop
 879 0:
 880         add     %o4,%o4,%o5
 881         srax    %o2,63-52,%o2
 882         sub     %g1,1023+52,%o1
 883         xnor    %o2,%g0,%o2
 884         and     %o0,%o2,%o3
 885         or      %o3,%o5,%o3
 886         srax    %o0,63-0,%o2
 887         subcc   %g1,1023,%g1
 888         bge     1f
 889         nop
 890         subcc   %g1,-1,%g0
 891         or      %g0,0,%o0
 892         bne     2f
 893         nop
 894         or      %g0,1,%o0
 895         ba      2f
 896         nop
 897 1:
 898         brlz,pt %o1,3f
 899         nop
 900         sub     %g1,52,%o0
 901         sllx    %o3,%o0,%o0
 902         ba      2f
 903         nop
 904 3:
 905         srlx    %o4,%g1,%o4
 906         add     %o3,%o4,%o3
 907         or      %g0,52,%o0
 908         sub     %o0,%g1,%o0
 909         srlx    %o3,%o0,%o0
 910 2:
 911         xor     %o0,%o2,%o0
 912         sub     %o0,%o2,%o0
 913 9:
 914         .end
 915 
 916         .inline __anintf,1
 917         st      %f1,[%sp+0x87f]
 918         ld      [%sp+0x87f],%o0
 919         or      %g0,1,%o1
 920         srl     %o0,23,%g1
 921         and     %g1,0xff,%g1
 922         sub     %g0,%g1,%g1
 923         add     %g1,0x95,%g1
 924         subcc   %g1,23,%g0
 925         sll     %o1,%g1,%o1
 926         sub     %o1,1,%o2
 927         bcs     1f
 928         nop
 929         be      2f
 930         nop
 931         bl      3f
 932         nop
 933         sethi   %hi(0x80000000),%o1
 934         and     %o0,%o1,%o0
 935         ba      3f
 936         nop
 937 1:
 938         and     %o0,%o1,%o1
 939 2:
 940         add     %o0,%o1,%o0
 941         andn    %o0,%o2,%o0
 942 3:
 943         st      %o0,[%sp+0x87f]
 944         ld      [%sp+0x87f],%f0
 945         .end
 946 
 947         .inline __anint,1
 948         std     %f0,[%sp+0x87f]
 949         ldx     [%sp+0x87f],%o0
 950         or      %g0,1,%o1
 951         srlx    %o0,52,%g1
 952         and     %g1,0x7ff,%g1
 953         sub     %g0,%g1,%g1
 954         add     %g1,0x432,%g1
 955         subcc   %g1,52,%g0
 956         sllx    %o1,%g1,%o1
 957         sub     %o1,1,%o2
 958         bcs,pt  %icc,1f
 959         nop
 960         be,pt   %icc,2f
 961         nop
 962         bl,pt   %icc,3f
 963         nop
 964         srlx    %o0,63,%o0
 965         sllx    %o0,63,%o0
 966         ba      3f
 967         nop
 968 1:
 969         and     %o0,%o1,%o1
 970 2:
 971         add     %o0,%o1,%o0
 972         andn    %o0,%o2,%o0
 973 3:
 974         stx     %o0,[%sp+0x87f]
 975         ldd     [%sp+0x87f],%f0
 976         .end
 977 
 978         .inline __r_dim,2
 979         st      %g0,[%sp+0x87f]
 980         ld      [%sp+0x87f],%f4
 981         ld      [%o0],%f0
 982         ld      [%o1],%f2
 983         fcmps   %fcc0,%f0,%f2
 984         fmovsule %fcc0,%f4,%f2
 985         fsubs   %f0,%f2,%f0
 986         fmovsule %fcc0,%f4,%f0
 987         .end
 988 
 989         .inline __d_dim,2
 990         stx     %g0,[%sp+0x87f]
 991         ldd     [%sp+0x87f],%f4
 992         ld      [%o0],%f0
 993         ld      [%o0+4],%f1
 994         ld      [%o1],%f2
 995         ld      [%o1+4],%f3
 996         fcmpd   %fcc0,%f0,%f2
 997         fmovdule %fcc0,%f4,%f2
 998         fsubd   %f0,%f2,%f0
 999         fmovdule %fcc0,%f4,%f0
1000         .end
1001 
1002         .inline __f95_signf,2
1003         ld      [%o0],%f0
1004         ld      [%o1],%o1
1005         fabss   %f0,%f0
1006         fnegs   %f0,%f1
1007         sra     %o1,0,%o1
1008         fmovrslz %o1,%f1,%f0
1009         .end
1010 
1011         .inline __f95_sign,2
1012         ld      [%o0],%f0
1013         ld      [%o0+4],%f1
1014         ld      [%o1],%o1
1015         fabsd   %f0,%f0
1016         fnegd   %f0,%f2
1017         sra     %o1,0,%o1
1018         fmovrdlz %o1,%f2,%f0
1019         .end
1020 
1021         .inline __r_sign,2
1022         ld      [%o0],%f0
1023         ld      [%o1],%o1
1024         fabss   %f0,%f0
1025         fnegs   %f0,%f1
1026         sub     %o1,1,%o0
1027         and     %o1,%o0,%o1
1028         sra     %o1,0,%o1
1029         fmovrslz %o1,%f1,%f0
1030         .end
1031 
1032         .inline __d_sign,2
1033         ldd     [%o0],%f0
1034         ldx     [%o1],%o1
1035         fabsd   %f0,%f0
1036         fnegd   %f0,%f2
1037         sub     %o1,1,%o0
1038         and     %o1,%o0,%o1
1039         fmovrdlz %o1,%f2,%f0
1040         .end
1041 !
1042 ! complex __Fc_div_f(complex a, complex b);
1043 !
1044 
1045         .inline __Fc_div_f,0
1046         st      %g0,[%sp+0x87f]
1047         ld      [%sp+0x87f],%f4
1048         fcmps   %fcc0,%f3,%f4
1049         fbne,pn %fcc0,1f
1050         nop
1051         fdivs   %f0,%f2,%f0
1052         fdivs   %f1,%f2,%f1
1053         ba      2f
1054         nop
1055 1:
1056         sethi   %hi(0x3ff00000),%o0
1057         sllx    %o0,32,%o0
1058         stx     %o0,[%sp+0x87f]
1059         ldd     [%sp+0x87f],%f16
1060         fsmuld  %f2,%f2,%f4
1061         fsmuld  %f3,%f3,%f6
1062         fsmuld  %f1,%f3,%f8
1063         fsmuld  %f0,%f2,%f10
1064         faddd   %f6,%f4,%f6
1065         fdivd   %f16,%f6,%f6
1066         faddd   %f10,%f8,%f10
1067         fsmuld  %f1,%f2,%f12
1068         fmuld   %f10,%f6,%f10
1069         fsmuld  %f0,%f3,%f14
1070         fsubd   %f12,%f14,%f14
1071         fmuld   %f14,%f6,%f6
1072         fdtos   %f10,%f0
1073         fdtos   %f6,%f1
1074 2:
1075         .end