1.file "coshf.s"
2
3
4// Copyright (c) 2000 - 2005, 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// 02/16/00 The error tag for coshf overflow changed to 65 (from 64).
43// 04/04/00 Unwind support added
44// 08/15/00 Bundle added after call to __libm_error_support to properly
45//          set [the previously overwritten] GR_Parameter_RESULT.
46// 05/07/01 Reworked to improve speed of all paths
47// 05/20/02 Cleaned up namespace and sf0 syntax
48// 11/15/02 Improved algorithm based on expf
49// 03/31/05 Reformatted delimiters between data tables
50//
51// API
52//*********************************************************************
53// float coshf(float)
54//
55// Overview of operation
56//*********************************************************************
57// Case 1:  0 < |x| < 0.25
58//  Evaluate cosh(x) by a 8th order polynomial
59//  Care is take for the order of multiplication; and A2 is not exactly 1/4!,
60//  A3 is not exactly 1/6!, etc.
61//  cosh(x) = 1 + (A1*x^2 + A2*x^4 + A3*x^6 + A4*x^8)
62//
63// Case 2:  0.25 < |x| < 89.41598
64//  Algorithm is based on the identity cosh(x) = ( exp(x) + exp(-x) ) / 2.
65//  The algorithm for exp is described as below.  There are a number of
66//  economies from evaluating both exp(x) and exp(-x).  Although we
67//  are evaluating both quantities, only where the quantities diverge do we
68//  duplicate the computations.  The basic algorithm for exp(x) is described
69//  below.
70//
71// Take the input x. w is "how many log2/128 in x?"
72//  w = x * 64/log2
73//  NJ = int(w)
74//  x = NJ*log2/64 + R
75
76//  NJ = 64*n + j
77//  x = n*log2 + (log2/64)*j + R
78//
79//  So, exp(x) = 2^n * 2^(j/64)* exp(R)
80//
81//  T =  2^n * 2^(j/64)
82//       Construct 2^n
83//       Get 2^(j/64) table
84//           actually all the entries of 2^(j/64) table are stored in DP and
85//           with exponent bits set to 0 -> multiplication on 2^n can be
86//           performed by doing logical "or" operation with bits presenting 2^n
87
88//  exp(R) = 1 + (exp(R) - 1)
89//  P = exp(R) - 1 approximated by Taylor series of 3rd degree
90//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2
91//
92
93//  The final result is reconstructed as follows
94//  exp(x) = T + T*P
95
96// Special values
97//*********************************************************************
98// coshf(+0)    = 1.0
99// coshf(-0)    = 1.0
100
101// coshf(+qnan) = +qnan
102// coshf(-qnan) = -qnan
103// coshf(+snan) = +qnan
104// coshf(-snan) = -qnan
105
106// coshf(-inf)  = +inf
107// coshf(+inf)  = +inf
108
109// Overflow and Underflow
110//*********************************************************************
111// coshf(x) = largest single normal when
112//     x = 89.41598 = 0x42b2d4fc
113//
114// There is no underflow.
115
116// Registers used
117//*********************************************************************
118// Floating Point registers used:
119// f8 input, output
120// f6,f7, f9 -> f15,  f32 -> f45
121
122// General registers used:
123// r2, r3, r16 -> r38
124
125// Predicate registers used:
126// p6 -> p15
127
128// Assembly macros
129//*********************************************************************
130// integer registers used
131// scratch
132rNJ                   = r2
133rNJ_neg               = r3
134
135rJ_neg                = r16
136rN_neg                = r17
137rSignexp_x            = r18
138rExp_x                = r18
139rExp_mask             = r19
140rExp_bias             = r20
141rAd1                  = r21
142rAd2                  = r22
143rJ                    = r23
144rN                    = r24
145rTblAddr              = r25
146rA3                   = r26
147rExpHalf              = r27
148rLn2Div64             = r28
149rGt_ln                = r29
150r17ones_m1            = r29
151rRightShifter         = r30
152rJ_mask               = r30
153r64DivLn2             = r31
154rN_mask               = r31
155// stacked
156GR_SAVE_PFS           = r32
157GR_SAVE_B0            = r33
158GR_SAVE_GP            = r34
159GR_Parameter_X        = r35
160GR_Parameter_Y        = r36
161GR_Parameter_RESULT   = r37
162GR_Parameter_TAG      = r38
163
164// floating point registers used
165FR_X                  = f10
166FR_Y                  = f1
167FR_RESULT             = f8
168// scratch
169fRightShifter         = f6
170f64DivLn2             = f7
171fNormX                = f9
172fNint                 = f10
173fN                    = f11
174fR                    = f12
175fLn2Div64             = f13
176fA2                   = f14
177fA3                   = f15
178// stacked
179fP                    = f32
180fT                    = f33
181fMIN_SGL_OFLOW_ARG    = f34
182fMAX_SGL_NORM_ARG     = f35
183fRSqr                 = f36
184fA1                   = f37
185fA21                  = f37
186fA4                   = f38
187fA43                  = f38
188fA4321                = f38
189fX4                   = f39
190fTmp                  = f39
191fGt_pln               = f39
192fWre_urm_f8           = f40
193fXsq                  = f40
194fP_neg                = f41
195fT_neg                = f42
196fExp                  = f43
197fExp_neg              = f44
198fAbsX                 = f45
199
200
201RODATA
202.align 16
203
204LOCAL_OBJECT_START(_coshf_table)
205data4 0x42b2d4fd         // Smallest single arg to overflow single result
206data4 0x42b2d4fc         // Largest single arg to give normal single result
207data4 0x00000000         // pad
208data4 0x00000000         // pad
209//
210// 2^(j/64) table, j goes from 0 to 63
211data8 0x0000000000000000 // 2^(0/64)
212data8 0x00002C9A3E778061 // 2^(1/64)
213data8 0x000059B0D3158574 // 2^(2/64)
214data8 0x0000874518759BC8 // 2^(3/64)
215data8 0x0000B5586CF9890F // 2^(4/64)
216data8 0x0000E3EC32D3D1A2 // 2^(5/64)
217data8 0x00011301D0125B51 // 2^(6/64)
218data8 0x0001429AAEA92DE0 // 2^(7/64)
219data8 0x000172B83C7D517B // 2^(8/64)
220data8 0x0001A35BEB6FCB75 // 2^(9/64)
221data8 0x0001D4873168B9AA // 2^(10/64)
222data8 0x0002063B88628CD6 // 2^(11/64)
223data8 0x0002387A6E756238 // 2^(12/64)
224data8 0x00026B4565E27CDD // 2^(13/64)
225data8 0x00029E9DF51FDEE1 // 2^(14/64)
226data8 0x0002D285A6E4030B // 2^(15/64)
227data8 0x000306FE0A31B715 // 2^(16/64)
228data8 0x00033C08B26416FF // 2^(17/64)
229data8 0x000371A7373AA9CB // 2^(18/64)
230data8 0x0003A7DB34E59FF7 // 2^(19/64)
231data8 0x0003DEA64C123422 // 2^(20/64)
232data8 0x0004160A21F72E2A // 2^(21/64)
233data8 0x00044E086061892D // 2^(22/64)
234data8 0x000486A2B5C13CD0 // 2^(23/64)
235data8 0x0004BFDAD5362A27 // 2^(24/64)
236data8 0x0004F9B2769D2CA7 // 2^(25/64)
237data8 0x0005342B569D4F82 // 2^(26/64)
238data8 0x00056F4736B527DA // 2^(27/64)
239data8 0x0005AB07DD485429 // 2^(28/64)
240data8 0x0005E76F15AD2148 // 2^(29/64)
241data8 0x0006247EB03A5585 // 2^(30/64)
242data8 0x0006623882552225 // 2^(31/64)
243data8 0x0006A09E667F3BCD // 2^(32/64)
244data8 0x0006DFB23C651A2F // 2^(33/64)
245data8 0x00071F75E8EC5F74 // 2^(34/64)
246data8 0x00075FEB564267C9 // 2^(35/64)
247data8 0x0007A11473EB0187 // 2^(36/64)
248data8 0x0007E2F336CF4E62 // 2^(37/64)
249data8 0x00082589994CCE13 // 2^(38/64)
250data8 0x000868D99B4492ED // 2^(39/64)
251data8 0x0008ACE5422AA0DB // 2^(40/64)
252data8 0x0008F1AE99157736 // 2^(41/64)
253data8 0x00093737B0CDC5E5 // 2^(42/64)
254data8 0x00097D829FDE4E50 // 2^(43/64)
255data8 0x0009C49182A3F090 // 2^(44/64)
256data8 0x000A0C667B5DE565 // 2^(45/64)
257data8 0x000A5503B23E255D // 2^(46/64)
258data8 0x000A9E6B5579FDBF // 2^(47/64)
259data8 0x000AE89F995AD3AD // 2^(48/64)
260data8 0x000B33A2B84F15FB // 2^(49/64)
261data8 0x000B7F76F2FB5E47 // 2^(50/64)
262data8 0x000BCC1E904BC1D2 // 2^(51/64)
263data8 0x000C199BDD85529C // 2^(52/64)
264data8 0x000C67F12E57D14B // 2^(53/64)
265data8 0x000CB720DCEF9069 // 2^(54/64)
266data8 0x000D072D4A07897C // 2^(55/64)
267data8 0x000D5818DCFBA487 // 2^(56/64)
268data8 0x000DA9E603DB3285 // 2^(57/64)
269data8 0x000DFC97337B9B5F // 2^(58/64)
270data8 0x000E502EE78B3FF6 // 2^(59/64)
271data8 0x000EA4AFA2A490DA // 2^(60/64)
272data8 0x000EFA1BEE615A27 // 2^(61/64)
273data8 0x000F50765B6E4540 // 2^(62/64)
274data8 0x000FA7C1819E90D8 // 2^(63/64)
275LOCAL_OBJECT_END(_coshf_table)
276
277LOCAL_OBJECT_START(cosh_p_table)
278data8 0x3efa3001dcf5905b // A4
279data8 0x3f56c1437543543e // A3
280data8 0x3fa5555572601504 // A2
281data8 0x3fdfffffffe2f097 // A1
282LOCAL_OBJECT_END(cosh_p_table)
283
284
285.section .text
286GLOBAL_IEEE754_ENTRY(coshf)
287
288{ .mlx
289      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
290      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)
291}
292{ .mlx
293      addl            rTblAddr = @ltoff(_coshf_table),gp
294      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter
295}
296;;
297
298{ .mfi
299      // point to the beginning of the table
300      ld8             rTblAddr = [rTblAddr]
301      fclass.m        p6, p0 = f8, 0x0b   // Test for x=unorm
302      addl            rA3 = 0x3E2AA, r0   // high bits of 1.0/6.0 rounded to SP
303}
304{ .mfi
305      nop.m           0
306      fnorm.s1        fNormX = f8 // normalized x
307      addl            rExpHalf = 0xFFFE, r0 // exponent of 1/2
308}
309;;
310
311{ .mfi
312      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg
313      fclass.m        p15, p0 = f8, 0x1e3   // test for NaT,NaN,Inf
314      nop.i           0
315}
316{ .mlx
317      // load Right Shifter to FP reg
318      setf.d          fRightShifter = rRightShifter
319      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR
320}
321;;
322
323{ .mfi
324      mov             rExp_mask = 0x1ffff
325      fcmp.eq.s1      p13, p0 = f0, f8 // test for x = 0.0
326      shl             rA3 = rA3, 12    // 0x3E2AA000, approx to 1.0/6.0 in SP
327}
328{ .mfb
329      nop.m           0
330      nop.f           0
331(p6)  br.cond.spnt    COSH_UNORM            // Branch if x=unorm
332}
333;;
334
335COSH_COMMON:
336{ .mfi
337      setf.exp        fA2 = rExpHalf        // load A2 to FP reg
338      nop.f           0
339      mov             rExp_bias = 0xffff
340}
341{ .mfb
342      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg
343(p15) fma.s.s0        f8 = f8, f8, f0       // result if x = NaT,NaN,Inf
344(p15) br.ret.spnt     b0                    // exit here if x = NaT,NaN,Inf
345}
346;;
347
348{ .mfi
349      // min overflow and max normal threshold
350      ldfps           fMIN_SGL_OFLOW_ARG, fMAX_SGL_NORM_ARG = [rTblAddr], 8
351      nop.f           0
352      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
353}
354{ .mfb
355      setf.s          fA3 = rA3                  // load A3 to FP reg
356(p13) fma.s.s0        f8 = f1, f1, f0            // result if x = 0.0
357(p13) br.ret.spnt     b0                         // exit here if x =0.0
358}
359;;
360
361{ .mfi
362      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
363      fmerge.s        fAbsX = f0, fNormX         // Form |x|
364      nop.i           0
365}
366;;
367
368{ .mfi
369      nop.m           0
370      // x*(64/ln(2)) + Right Shifter
371      fma.s1          fNint = fNormX, f64DivLn2, fRightShifter
372      add             rTblAddr = 8, rTblAddr
373}
374{ .mfb
375      cmp.gt          p7, p0 = -2, rExp_x        // Test |x| < 2^(-2)
376      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
377(p7)  br.cond.spnt    COSH_SMALL                 // Branch if 0 < |x| < 2^-2
378}
379;;
380
381{ .mfi
382      nop.m           0
383      // check for overflow
384      fcmp.ge.s1      p12, p13 = fAbsX, fMIN_SGL_OFLOW_ARG
385      mov             rJ_mask = 0x3f             // 6-bit mask for J
386}
387;;
388
389{ .mfb
390      nop.m           0
391      fms.s1          fN = fNint, f1, fRightShifter // n in FP register
392      // branch out if overflow
393(p12) br.cond.spnt    COSH_CERTAIN_OVERFLOW
394}
395;;
396
397{ .mfi
398      getf.sig        rNJ = fNint                   // bits of n, j
399      // check for possible overflow
400      fcmp.gt.s1      p13, p0 = fAbsX, fMAX_SGL_NORM_ARG
401      nop.i           0
402}
403;;
404
405{ .mfi
406      addl            rN = 0xFFBF - 63, rNJ      // biased and shifted n-1,j
407      fnma.s1         fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64
408      and             rJ = rJ_mask, rNJ          // bits of j
409}
410{ .mfi
411      sub             rNJ_neg = r0, rNJ          // bits of n, j for -x
412      nop.f           0
413      andcm           rN_mask = -1, rJ_mask      // 0xff...fc0 to mask N
414}
415;;
416
417{ .mfi
418      shladd          rJ = rJ, 3, rTblAddr // address in the 2^(j/64) table
419      nop.f           0
420      and             rN = rN_mask, rN     // biased, shifted n-1
421}
422{ .mfi
423      addl            rN_neg = 0xFFBF - 63, rNJ_neg // -x biased, shifted n-1,j
424      nop.f           0
425      and             rJ_neg = rJ_mask, rNJ_neg     // bits of j for -x
426}
427;;
428
429{ .mfi
430      ld8             rJ = [rJ]                    // Table value
431      nop.f           0
432      shl             rN = rN, 46 // 2^(n-1) bits in DP format
433}
434{ .mfi
435      shladd          rJ_neg = rJ_neg, 3, rTblAddr // addr in 2^(j/64) table -x
436      nop.f           0
437      and             rN_neg = rN_mask, rN_neg     // biased, shifted n-1 for -x
438}
439;;
440
441{ .mfi
442      ld8             rJ_neg = [rJ_neg]            // Table value for -x
443      nop.f           0
444      shl             rN_neg = rN_neg, 46 // 2^(n-1) bits in DP format for -x
445}
446;;
447
448{ .mfi
449      or              rN = rN, rJ // bits of 2^n * 2^(j/64) in DP format
450      nop.f           0
451      nop.i           0
452}
453;;
454
455{ .mmf
456      setf.d          fT = rN            // 2^(n-1) * 2^(j/64)
457      or              rN_neg = rN_neg, rJ_neg // -x bits of 2^n * 2^(j/64) in DP
458      fma.s1          fRSqr = fR, fR, f0 // R^2
459}
460;;
461
462{ .mfi
463      setf.d          fT_neg = rN_neg    // 2^(n-1) * 2^(j/64) for -x
464      fma.s1          fP = fA3, fR, fA2  // A3*R + A2
465      nop.i           0
466}
467{ .mfi
468      nop.m           0
469      fnma.s1         fP_neg = fA3, fR, fA2  // A3*R + A2 for -x
470      nop.i           0
471}
472;;
473
474{ .mfi
475      nop.m           0
476      fma.s1          fP = fP, fRSqr, fR // P = (A3*R + A2)*R^2 + R
477      nop.i           0
478}
479{ .mfi
480      nop.m           0
481      fms.s1          fP_neg = fP_neg, fRSqr, fR // P = (A3*R + A2)*R^2 + R, -x
482      nop.i           0
483}
484;;
485
486{ .mfi
487      nop.m           0
488      fmpy.s0         fTmp = fLn2Div64, fLn2Div64       // Force inexact
489      nop.i           0
490}
491;;
492
493{ .mfi
494      nop.m           0
495      fma.s1          fExp = fP, fT, fT                 // exp(x)/2
496      nop.i           0
497}
498{ .mfb
499      nop.m           0
500      fma.s1          fExp_neg = fP_neg, fT_neg, fT_neg // exp(-x)/2
501      // branch out if possible overflow result
502(p13) br.cond.spnt    COSH_POSSIBLE_OVERFLOW
503}
504;;
505
506{ .mfb
507      nop.m           0
508      // final result in the absence of overflow
509      fma.s.s0        f8 = fExp, f1, fExp_neg  // result = (exp(x)+exp(-x))/2
510      // exit here in the absence of overflow
511      br.ret.sptk     b0              // Exit main path, 0.25 <= |x| < 89.41598
512}
513;;
514
515// Here if 0 < |x| < 0.25.  Evaluate 8th order polynomial.
516COSH_SMALL:
517{ .mmi
518      add             rAd1 = 0x200, rTblAddr
519      add             rAd2 = 0x210, rTblAddr
520      nop.i           0
521}
522;;
523
524{ .mmi
525      ldfpd           fA4, fA3 = [rAd1]
526      ldfpd           fA2, fA1 = [rAd2]
527      nop.i           0
528}
529;;
530
531{ .mfi
532      nop.m           0
533      fma.s1          fX4 = fXsq, fXsq, f0
534      nop.i           0
535}
536;;
537
538{ .mfi
539      nop.m           0
540      fma.s1          fA43 = fXsq, fA4, fA3
541      nop.i           0
542}
543{ .mfi
544      nop.m           0
545      fma.s1          fA21 = fXsq, fA2, fA1
546      nop.i           0
547}
548;;
549
550{ .mfi
551      nop.m           0
552      fma.s1          fA4321 = fX4, fA43, fA21
553      nop.i           0
554}
555;;
556
557// Dummy multiply to generate inexact
558{ .mfi
559      nop.m           0
560      fmpy.s0         fTmp = fA4, fA4
561      nop.i           0
562}
563{ .mfb
564      nop.m           0
565      fma.s.s0        f8 = fA4321, fXsq, f1
566      br.ret.sptk     b0                // Exit if 0 < |x| < 0.25
567}
568;;
569
570COSH_POSSIBLE_OVERFLOW:
571
572// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG
573// This cannot happen if input is a single, only if input higher precision.
574// Overflow is a possibility, not a certainty.
575
576// Recompute result using status field 2 with user's rounding mode,
577// and wre set.  If result is larger than largest single, then we have
578// overflow
579
580{ .mfi
581      mov             rGt_ln  = 0x1007f // Exponent for largest single + 1 ulp
582      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
583      nop.i           0
584}
585;;
586
587{ .mfi
588      setf.exp        fGt_pln = rGt_ln  // Create largest single + 1 ulp
589      fma.s.s2        fWre_urm_f8 = fP, fT, fT    // Result with wre set
590      nop.i           0
591}
592;;
593
594{ .mfi
595      nop.m           0
596      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
597      nop.i           0
598}
599;;
600
601{ .mfi
602      nop.m           0
603      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
604      nop.i           0
605}
606;;
607
608{ .mfb
609      nop.m           0
610      nop.f           0
611(p6)  br.cond.spnt    COSH_CERTAIN_OVERFLOW // Branch if overflow
612}
613;;
614
615{ .mfb
616      nop.m           0
617      fma.s.s0        f8 = fP, fT, fT
618      br.ret.sptk     b0                     // Exit if really no overflow
619}
620;;
621
622// here if overflow
623COSH_CERTAIN_OVERFLOW:
624{ .mmi
625      addl            r17ones_m1 = 0x1FFFE, r0
626;;
627      setf.exp        fTmp = r17ones_m1
628      nop.i           0
629}
630;;
631
632{ .mfi
633      alloc           r32 = ar.pfs, 0, 3, 4, 0 // get some registers
634      fmerge.s        FR_X = f8,f8
635      nop.i           0
636}
637{ .mfb
638      mov             GR_Parameter_TAG = 65
639      fma.s.s0        FR_RESULT = fTmp, fTmp, f0 // Set I,O and +INF result
640      br.cond.sptk    __libm_error_region
641}
642;;
643
644// Here if x unorm
645COSH_UNORM:
646{ .mfb
647      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
648      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
649      br.cond.sptk    COSH_COMMON            // Return to main path
650}
651;;
652
653GLOBAL_IEEE754_END(coshf)
654libm_alias_float_other (__cosh, cosh)
655
656
657LOCAL_LIBM_ENTRY(__libm_error_region)
658.prologue
659{ .mfi
660      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
661      nop.f 0
662.save   ar.pfs,GR_SAVE_PFS
663      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
664}
665{ .mfi
666.fframe 64
667      add sp=-64,sp                           // Create new stack
668      nop.f 0
669      mov GR_SAVE_GP=gp                       // Save gp
670};;
671{ .mmi
672      stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
673      add GR_Parameter_X = 16,sp              // Parameter 1 address
674.save   b0, GR_SAVE_B0
675      mov GR_SAVE_B0=b0                       // Save b0
676};;
677.body
678{ .mfi
679      stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
680      nop.f 0
681      add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
682}
683{ .mib
684      stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
685      add   GR_Parameter_Y = -16,GR_Parameter_Y
686      br.call.sptk b0=__libm_error_support#   // Call error handling function
687};;
688
689{ .mmi
690      add   GR_Parameter_RESULT = 48,sp
691      nop.m 0
692      nop.i 0
693};;
694
695{ .mmi
696      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
697.restore sp
698      add   sp = 64,sp                       // Restore stack pointer
699      mov   b0 = GR_SAVE_B0                  // Restore return address
700};;
701{ .mib
702      mov   gp = GR_SAVE_GP                  // Restore gp
703      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
704      br.ret.sptk     b0                     // Return
705};;
706
707LOCAL_LIBM_END(__libm_error_region)
708
709
710.type   __libm_error_support#,@function
711.global __libm_error_support#
712