2.9
[glibc/nacl-glibc.git] / sysdeps / ia64 / fpu / e_exp.S
blobfcc247fb1a940bd5a00bf12052a773b53e041863
1 .file "exp.s"
4 // Copyright (c) 2000 - 2005, Intel Corporation
5 // All rights reserved.
6 //
7 // Contributed 2000 by the Intel Numerics Group, Intel Corporation
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
11 // met:
13 // * Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
16 // * Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
20 // * The name of Intel Corporation may not be used to endorse or promote
21 // products derived from this software without specific prior written
22 // permission.
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
28 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
32 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
33 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 // Intel Corporation is the author of this code, and requests that all
37 // problem reports or change requests be submitted to it directly at
38 // http://www.intel.com/software/products/opensource/libraries/num.htm.
40 // History
41 //==============================================================
42 // 2/02/00  Initial version
43 // 3/07/00  exp(inf)  = inf but now does NOT call error support
44 //          exp(-inf) = 0   but now does NOT call error support
45 // 4/04/00  Unwind support added
46 // 8/15/00  Bundle added after call to __libm_error_support to properly
47 //          set [the previously overwritten] GR_Parameter_RESULT.
48 // 11/30/00 Reworked to shorten main path, widen main path to include all
49 //          args in normal range, and add quick exit for 0, nan, inf.
50 // 12/05/00 Loaded constants earlier with setf to save 2 cycles.
51 // 02/05/02 Corrected uninitialize predicate in POSSIBLE_UNDERFLOW path
52 // 05/20/02 Cleaned up namespace and sf0 syntax
53 // 09/07/02 Force inexact flag
54 // 11/15/02 Split underflow path into zero/nonzero; eliminated fma in main path
55 // 05/30/03 Set inexact flag on unmasked overflow/underflow
56 // 03/31/05 Reformatted delimiters between data tables
58 // API
59 //==============================================================
60 // double exp(double)
62 // Overview of operation
63 //==============================================================
64 // Take the input x. w is "how many log2/128 in x?"
65 //  w = x * 128/log2
66 //  n = int(w)
67 //  x = n log2/128 + r + delta
69 //  n = 128M + index_1 + 2^4 index_2
70 //  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
72 //  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
73 //       Construct 2^M
74 //       Get 2^(index_1/128) from table_1;
75 //       Get 2^(index_2/8)   from table_2;
76 //       Calculate exp(r) by 5th order polynomial
77 //          r = x - n (log2/128)_high
78 //          delta = - n (log2/128)_low
79 //       Calculate exp(delta) as 1 + delta
82 // Special values
83 //==============================================================
84 // exp(+0)    = 1.0
85 // exp(-0)    = 1.0
87 // exp(+qnan) = +qnan
88 // exp(-qnan) = -qnan
89 // exp(+snan) = +qnan
90 // exp(-snan) = -qnan
92 // exp(-inf)  = +0
93 // exp(+inf)  = +inf
95 // Overflow and Underflow
96 //=======================
97 // exp(x) = largest double normal when
98 //     x = 709.7827 = 0x40862e42fefa39ef
100 // exp(x) = smallest double normal when
101 //     x = -708.396 = 0xc086232bdd7abcd2
103 // exp(x) = largest round-to-nearest single zero when
104 //     x = -745.1332 = 0xc0874910d52d3052
107 // Registers used
108 //==============================================================
109 // Floating Point registers used:
110 // f8, input, output
111 // f6 -> f15,  f32 -> f49
113 // General registers used:
114 // r14 -> r40
116 // Predicate registers used:
117 // p6 -> p15
119 // Assembly macros
120 //==============================================================
122 rRshf                 = r14
123 rAD_TB1               = r15
124 rAD_T1                = r15
125 rAD_TB2               = r16
126 rAD_T2                = r16
127 rAD_P                 = r17
128 rN                    = r18
129 rIndex_1              = r19
130 rIndex_2_16           = r20
131 rM                    = r21
132 rBiased_M             = r21
133 rIndex_1_16           = r21
134 rSig_inv_ln2          = r22
135 rExp_bias             = r23
136 rExp_mask             = r24
137 rTmp                  = r25
138 rRshf_2to56           = r26
139 rGt_ln                = r27
140 rExp_2tom56           = r28
143 GR_SAVE_B0            = r33
144 GR_SAVE_PFS           = r34
145 GR_SAVE_GP            = r35
146 GR_SAVE_SP            = r36
148 GR_Parameter_X        = r37
149 GR_Parameter_Y        = r38
150 GR_Parameter_RESULT   = r39
151 GR_Parameter_TAG      = r40
154 FR_X                  = f10
155 FR_Y                  = f1
156 FR_RESULT             = f8
158 fRSHF_2TO56           = f6
159 fINV_LN2_2TO63        = f7
160 fW_2TO56_RSH          = f9
161 f2TOM56               = f11
162 fP5                   = f12
163 fP54                  = f12
164 fP5432                = f12
165 fP4                   = f13
166 fP3                   = f14
167 fP32                  = f14
168 fP2                   = f15
169 fP                    = f15
171 fLn2_by_128_hi        = f33
172 fLn2_by_128_lo        = f34
174 fRSHF                 = f35
175 fNfloat               = f36
176 fNormX                = f37
177 fR                    = f38
178 fF                    = f39
180 fRsq                  = f40
181 f2M                   = f41
182 fS1                   = f42
183 fT1                   = f42
184 fS2                   = f43
185 fT2                   = f43
186 fS                    = f43
187 fWre_urm_f8           = f44
188 fFtz_urm_f8           = f44
190 fMIN_DBL_OFLOW_ARG    = f45
191 fMAX_DBL_ZERO_ARG     = f46
192 fMAX_DBL_NORM_ARG     = f47
193 fMIN_DBL_NORM_ARG     = f48
194 fGt_pln               = f49
195 fTmp                  = f49
198 // Data tables
199 //==============================================================
201 RODATA
202 .align 16
204 // ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
206 // double-extended 1/ln(2)
207 // 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
208 // 3fff b8aa 3b29 5c17 f0bc
209 // For speed the significand will be loaded directly with a movl and setf.sig
210 //   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
211 //   computations need to scale appropriately.
212 // The constant 128/ln(2) is needed for the computation of w.  This is also
213 //   obtained by scaling the computations.
215 // Two shifting constants are loaded directly with movl and setf.d.
216 //   1. fRSHF_2TO56 = 1.1000..00 * 2^(63-7)
217 //        This constant is added to x*1/ln2 to shift the integer part of
218 //        x*128/ln2 into the rightmost bits of the significand.
219 //        The result of this fma is fW_2TO56_RSH.
220 //   2. fRSHF       = 1.1000..00 * 2^(63)
221 //        This constant is subtracted from fW_2TO56_RSH * 2^(-56) to give
222 //        the integer part of w, n, as a floating-point number.
223 //        The result of this fms is fNfloat.
226 LOCAL_OBJECT_START(exp_table_1)
227 data8 0x40862e42fefa39f0 // smallest dbl overflow arg, +709.7827
228 data8 0xc0874910d52d3052 // largest arg for rnd-to-nearest 0 result, -745.133
229 data8 0x40862e42fefa39ef // largest dbl arg to give normal dbl result, +709.7827
230 data8 0xc086232bdd7abcd2 // smallest dbl arg to give normal dbl result, -708.396
231 data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
232 data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
234 // Table 1 is 2^(index_1/128) where
235 // index_1 goes from 0 to 15
237 data8 0x8000000000000000 , 0x00003FFF
238 data8 0x80B1ED4FD999AB6C , 0x00003FFF
239 data8 0x8164D1F3BC030773 , 0x00003FFF
240 data8 0x8218AF4373FC25EC , 0x00003FFF
241 data8 0x82CD8698AC2BA1D7 , 0x00003FFF
242 data8 0x8383594EEFB6EE37 , 0x00003FFF
243 data8 0x843A28C3ACDE4046 , 0x00003FFF
244 data8 0x84F1F656379C1A29 , 0x00003FFF
245 data8 0x85AAC367CC487B15 , 0x00003FFF
246 data8 0x8664915B923FBA04 , 0x00003FFF
247 data8 0x871F61969E8D1010 , 0x00003FFF
248 data8 0x87DB357FF698D792 , 0x00003FFF
249 data8 0x88980E8092DA8527 , 0x00003FFF
250 data8 0x8955EE03618E5FDD , 0x00003FFF
251 data8 0x8A14D575496EFD9A , 0x00003FFF
252 data8 0x8AD4C6452C728924 , 0x00003FFF
253 LOCAL_OBJECT_END(exp_table_1)
255 // Table 2 is 2^(index_1/8) where
256 // index_2 goes from 0 to 7
257 LOCAL_OBJECT_START(exp_table_2)
258 data8 0x8000000000000000 , 0x00003FFF
259 data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
260 data8 0x9837F0518DB8A96F , 0x00003FFF
261 data8 0xA5FED6A9B15138EA , 0x00003FFF
262 data8 0xB504F333F9DE6484 , 0x00003FFF
263 data8 0xC5672A115506DADD , 0x00003FFF
264 data8 0xD744FCCAD69D6AF4 , 0x00003FFF
265 data8 0xEAC0C6E7DD24392F , 0x00003FFF
266 LOCAL_OBJECT_END(exp_table_2)
269 LOCAL_OBJECT_START(exp_p_table)
270 data8 0x3f8111116da21757 //P5
271 data8 0x3fa55555d787761c //P4
272 data8 0x3fc5555555555414 //P3
273 data8 0x3fdffffffffffd6a //P2
274 LOCAL_OBJECT_END(exp_p_table)
277 .section .text
278 GLOBAL_IEEE754_ENTRY(exp)
280 { .mlx
281       nop.m           0
282       movl            rSig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
284 { .mlx
285       addl            rAD_TB1    = @ltoff(exp_table_1), gp
286       movl            rRshf_2to56 = 0x4768000000000000   // 1.10000 2^(63+56)
290 { .mfi
291       ld8             rAD_TB1    = [rAD_TB1]
292       fclass.m        p8,p0 = f8,0x07  // Test for x=0
293       mov             rExp_mask = 0x1ffff
295 { .mfi
296       mov             rExp_bias = 0xffff
297       fnorm.s1        fNormX   = f8
298       mov             rExp_2tom56 = 0xffff-56
302 // Form two constants we need
303 //  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
304 //  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
306 { .mfi
307       setf.sig        fINV_LN2_2TO63 = rSig_inv_ln2 // form 1/ln2 * 2^63
308       fclass.m        p9,p0 = f8,0x22  // Test for x=-inf
309       nop.i           0
311 { .mlx
312       setf.d          fRSHF_2TO56 = rRshf_2to56 // Form const 1.100 * 2^(63+56)
313       movl            rRshf = 0x43e8000000000000 // 1.10000 2^63 for right shift
317 { .mfi
318       ldfpd           fMIN_DBL_OFLOW_ARG, fMAX_DBL_ZERO_ARG = [rAD_TB1],16
319       fclass.m        p10,p0 = f8,0x1e1  // Test for x=+inf, nan, NaT
320       nop.i           0
322 { .mfb
323       setf.exp        f2TOM56 = rExp_2tom56 // form 2^-56 for scaling Nfloat
324 (p9)  fma.d.s0        f8 = f0,f0,f0           // quick exit for x=-inf
325 (p9)  br.ret.spnt     b0
329 { .mfi
330       ldfpd           fMAX_DBL_NORM_ARG, fMIN_DBL_NORM_ARG = [rAD_TB1],16
331       nop.f           0
332       nop.i           0
334 { .mfb
335       setf.d          fRSHF = rRshf // Form right shift const 1.100 * 2^63
336 (p8)  fma.d.s0        f8 = f1,f1,f0           // quick exit for x=0
337 (p8)  br.ret.spnt     b0
341 { .mfb
342       ldfe            fLn2_by_128_hi  = [rAD_TB1],16
343 (p10) fma.d.s0        f8 = f8,f8,f0  // Result if x=+inf, nan, NaT
344 (p10) br.ret.spnt     b0               // quick exit for x=+inf, nan, NaT
348 { .mfi
349       ldfe            fLn2_by_128_lo  = [rAD_TB1],16
350       fcmp.eq.s0      p6,p0 = f8, f0       // Dummy to set D
351       nop.i           0
355 // After that last load, rAD_TB1 points to the beginning of table 1
357 // W = X * Inv_log2_by_128
358 // By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
359 // We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
361 { .mfi
362       nop.m           0
363       fma.s1          fW_2TO56_RSH  = fNormX, fINV_LN2_2TO63, fRSHF_2TO56
364       nop.i           0
368 // Divide arguments into the following categories:
369 //  Certain Underflow       p11 - -inf < x <= MAX_DBL_ZERO_ARG
370 //  Possible Underflow      p13 - MAX_DBL_ZERO_ARG < x < MIN_DBL_NORM_ARG
371 //  Certain Safe                - MIN_DBL_NORM_ARG <= x <= MAX_DBL_NORM_ARG
372 //  Possible Overflow       p14 - MAX_DBL_NORM_ARG < x < MIN_DBL_OFLOW_ARG
373 //  Certain Overflow        p15 - MIN_DBL_OFLOW_ARG <= x < +inf
375 // If the input is really a double arg, then there will never be
376 // "Possible Overflow" arguments.
379 { .mfi
380       add             rAD_TB2 = 0x100, rAD_TB1
381       fcmp.ge.s1      p15,p0 = fNormX,fMIN_DBL_OFLOW_ARG
382       nop.i           0
386 { .mfi
387       add             rAD_P = 0x80, rAD_TB2
388       fcmp.le.s1      p11,p0 = fNormX,fMAX_DBL_ZERO_ARG
389       nop.i           0
393 { .mfb
394       ldfpd           fP5, fP4  = [rAD_P] ,16
395       fcmp.gt.s1      p14,p0 = fNormX,fMAX_DBL_NORM_ARG
396 (p15) br.cond.spnt    EXP_CERTAIN_OVERFLOW
400 // Nfloat = round_int(W)
401 // The signficand of fW_2TO56_RSH contains the rounded integer part of W,
402 // as a twos complement number in the lower bits (that is, it may be negative).
403 // That twos complement number (called N) is put into rN.
405 // Since fW_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
406 // before the shift constant 1.10000 * 2^63 is subtracted to yield fNfloat.
407 // Thus, fNfloat contains the floating point version of N
409 { .mfb
410       ldfpd           fP3, fP2  = [rAD_P]
411       fms.s1          fNfloat = fW_2TO56_RSH, f2TOM56, fRSHF
412 (p11) br.cond.spnt    EXP_CERTAIN_UNDERFLOW
416 { .mfi
417       getf.sig        rN        = fW_2TO56_RSH
418       nop.f           0
419       nop.i           0
423 // rIndex_1 has index_1
424 // rIndex_2_16 has index_2 * 16
425 // rBiased_M has M
426 // rIndex_1_16 has index_1 * 16
428 // rM has true M
429 // r = x - Nfloat * ln2_by_128_hi
430 // f = 1 - Nfloat * ln2_by_128_lo
431 { .mfi
432       and             rIndex_1 = 0x0f, rN
433       fnma.s1         fR   = fNfloat, fLn2_by_128_hi, fNormX
434       shr             rM = rN,  0x7
436 { .mfi
437       and             rIndex_2_16 = 0x70, rN
438       fnma.s1         fF   = fNfloat, fLn2_by_128_lo, f1
439       nop.i           0
443 // rAD_T1 has address of T1
444 // rAD_T2 has address if T2
446 { .mmi
447       add             rBiased_M = rExp_bias, rM
448       add             rAD_T2 = rAD_TB2, rIndex_2_16
449       shladd          rAD_T1 = rIndex_1, 4, rAD_TB1
453 // Create Scale = 2^M
454 { .mmi
455       setf.exp        f2M = rBiased_M
456       ldfe            fT2  = [rAD_T2]
457       nop.i           0
461 // Load T1 and T2
462 { .mfi
463       ldfe            fT1  = [rAD_T1]
464       fmpy.s0         fTmp = fLn2_by_128_lo, fLn2_by_128_lo // Force inexact
465       nop.i           0
469 { .mfi
470       nop.m           0
471       fma.s1          fRsq = fR, fR, f0
472       nop.i           0
474 { .mfi
475       nop.m           0
476       fma.s1          fP54 = fR, fP5, fP4
477       nop.i           0
481 { .mfi
482       nop.m           0
483       fcmp.lt.s1      p13,p0 = fNormX,fMIN_DBL_NORM_ARG
484       nop.i           0
486 { .mfi
487       nop.m           0
488       fma.s1          fP32 = fR, fP3, fP2
489       nop.i           0
493 { .mfi
494       nop.m           0
495       fma.s1          fP5432  = fRsq, fP54, fP32
496       nop.i           0
500 { .mfi
501       nop.m           0
502       fma.s1          fS1  = f2M,fT1,f0
503       nop.i           0
505 { .mfi
506       nop.m           0
507       fma.s1          fS2  = fF,fT2,f0
508       nop.i           0
512 { .mfi
513       nop.m           0
514       fma.s1          fP     = fRsq, fP5432, fR
515       nop.i           0
517 { .mfi
518       nop.m           0
519       fma.s1          fS   = fS1,fS2,f0
520       nop.i           0
524 { .mbb
525       nop.m           0
526 (p13) br.cond.spnt    EXP_POSSIBLE_UNDERFLOW
527 (p14) br.cond.spnt    EXP_POSSIBLE_OVERFLOW
531 { .mfb
532       nop.m           0
533       fma.d.s0        f8 = fS, fP, fS
534       br.ret.sptk     b0                  // Normal path exit
539 EXP_POSSIBLE_OVERFLOW:
541 // Here if fMAX_DBL_NORM_ARG < x < fMIN_DBL_OFLOW_ARG
542 // This cannot happen if input is a double, only if input higher precision.
543 // Overflow is a possibility, not a certainty.
545 // Recompute result using status field 2 with user's rounding mode,
546 // and wre set.  If result is larger than largest double, then we have
547 // overflow
549 { .mfi
550       mov             rGt_ln  = 0x103ff // Exponent for largest dbl + 1 ulp
551       fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
552       nop.i           0
556 { .mfi
557       setf.exp        fGt_pln = rGt_ln  // Create largest double + 1 ulp
558       fma.d.s2        fWre_urm_f8 = fS, fP, fS    // Result with wre set
559       nop.i           0
563 { .mfi
564       nop.m           0
565       fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
566       nop.i           0
570 { .mfi
571       nop.m           0
572       fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
573       nop.i           0
577 { .mfb
578       nop.m           0
579       nop.f           0
580 (p6)  br.cond.spnt    EXP_CERTAIN_OVERFLOW // Branch if overflow
584 { .mfb
585       nop.m           0
586       fma.d.s0        f8 = fS, fP, fS
587       br.ret.sptk     b0                     // Exit if really no overflow
591 EXP_CERTAIN_OVERFLOW:
592 { .mmi
593       sub             rTmp = rExp_mask, r0, 1
595       setf.exp        fTmp = rTmp
596       nop.i           0
600 { .mfi
601       alloc           r32=ar.pfs,1,4,4,0
602       fmerge.s        FR_X = f8,f8
603       nop.i           0
605 { .mfb
606       mov             GR_Parameter_TAG = 14
607       fma.d.s0        FR_RESULT = fTmp, fTmp, fTmp    // Set I,O and +INF result
608       br.cond.sptk    __libm_error_region
612 EXP_POSSIBLE_UNDERFLOW:
614 // Here if fMAX_DBL_ZERO_ARG < x < fMIN_DBL_NORM_ARG
615 // Underflow is a possibility, not a certainty
617 // We define an underflow when the answer with
618 //    ftz set
619 // is zero (tiny numbers become zero)
621 // Notice (from below) that if we have an unlimited exponent range,
622 // then there is an extra machine number E between the largest denormal and
623 // the smallest normal.
625 // So if with unbounded exponent we round to E or below, then we are
626 // tiny and underflow has occurred.
628 // But notice that you can be in a situation where we are tiny, namely
629 // rounded to E, but when the exponent is bounded we round to smallest
630 // normal. So the answer can be the smallest normal with underflow.
632 //                           E
633 // -----+--------------------+--------------------+-----
634 //      |                    |                    |
635 //   1.1...10 2^-3fff    1.1...11 2^-3fff    1.0...00 2^-3ffe
636 //   0.1...11 2^-3ffe                                   (biased, 1)
637 //    largest dn                               smallest normal
639 { .mfi
640       nop.m           0
641       fsetc.s2        0x7F,0x41                // Get user's round mode, set ftz
642       nop.i           0
646 { .mfi
647       nop.m           0
648       fma.d.s2        fFtz_urm_f8 = fS, fP, fS // Result with ftz set
649       nop.i           0
653 { .mfi
654       nop.m           0
655       fsetc.s2        0x7F,0x40                // Turn off ftz in sf2
656       nop.i           0
660 { .mfi
661       nop.m           0
662       fcmp.eq.s1      p6, p7 = fFtz_urm_f8, f0 // Test for underflow
663       nop.i           0
665 { .mfi
666       nop.m           0
667       fma.d.s0        f8 = fS, fP, fS          // Compute result, set I, maybe U
668       nop.i           0
672 { .mbb
673       nop.m           0
674 (p6)  br.cond.spnt    EXP_UNDERFLOW_COMMON     // Branch if really underflow
675 (p7)  br.ret.sptk     b0                       // Exit if really no underflow
679 EXP_CERTAIN_UNDERFLOW:
680 // Here if  x < fMAX_DBL_ZERO_ARG
681 // Result will be zero (or smallest denorm if round to +inf) with I, U set
682 { .mmi
683       mov             rTmp = 1
685       setf.exp        fTmp = rTmp               // Form small normal
686       nop.i           0
690 { .mfi
691       nop.m           0
692       fmerge.se       fTmp = fTmp, fLn2_by_128_lo // Small with signif lsb 1
693       nop.i           0
696       
697 { .mfb
698       nop.m           0
699       fma.d.s0        f8 = fTmp, fTmp, f0 // Set I,U, tiny (+0.0) result
700       br.cond.sptk    EXP_UNDERFLOW_COMMON
704 EXP_UNDERFLOW_COMMON:
705 // Determine if underflow result is zero or nonzero
706 { .mfi
707       alloc           r32=ar.pfs,1,4,4,0
708       fcmp.eq.s1      p6, p0 =  f8, f0
709       nop.i           0
713 { .mfb
714       nop.m           0
715       fmerge.s        FR_X = fNormX,fNormX
716 (p6)  br.cond.spnt    EXP_UNDERFLOW_ZERO
720 EXP_UNDERFLOW_NONZERO:
721 // Here if  x < fMIN_DBL_NORM_ARG and result nonzero;
722 // I, U are set
723 { .mfb
724       mov             GR_Parameter_TAG = 15
725       nop.f           0                         // FR_RESULT already set
726       br.cond.sptk    __libm_error_region
730 EXP_UNDERFLOW_ZERO:
731 // Here if x < fMIN_DBL_NORM_ARG and result zero;
732 // I, U are set
733 { .mfb
734       mov             GR_Parameter_TAG = 15
735       nop.f           0                         // FR_RESULT already set
736       br.cond.sptk    __libm_error_region
740 GLOBAL_IEEE754_END(exp)
743 LOCAL_LIBM_ENTRY(__libm_error_region)
744 .prologue
745 { .mfi
746         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
747         nop.f 0
748 .save   ar.pfs,GR_SAVE_PFS
749         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
751 { .mfi
752 .fframe 64
753         add sp=-64,sp                           // Create new stack
754         nop.f 0
755         mov GR_SAVE_GP=gp                       // Save gp
757 { .mmi
758         stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
759         add GR_Parameter_X = 16,sp              // Parameter 1 address
760 .save   b0, GR_SAVE_B0
761         mov GR_SAVE_B0=b0                       // Save b0
763 .body
764 { .mib
765         stfd [GR_Parameter_X] = FR_X            // STORE Parameter 1 on stack
766         add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
767         nop.b 0
769 { .mib
770         stfd [GR_Parameter_Y] = FR_RESULT       // STORE Parameter 3 on stack
771         add   GR_Parameter_Y = -16,GR_Parameter_Y
772         br.call.sptk b0=__libm_error_support#   // Call error handling function
774 { .mmi
775         add   GR_Parameter_RESULT = 48,sp
776         nop.m 0
777         nop.i 0
779 { .mmi
780         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
781 .restore sp
782         add   sp = 64,sp                       // Restore stack pointer
783         mov   b0 = GR_SAVE_B0                  // Restore return address
785 { .mib
786         mov   gp = GR_SAVE_GP                  // Restore gp
787         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
788         br.ret.sptk     b0                     // Return
791 LOCAL_LIBM_END(__libm_error_region)
792 .type   __libm_error_support#,@function
793 .global __libm_error_support#