(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / ia64 / fpu / s_atanf.S
blobb0a68737aacd309485132d7c9cabc0a328507af0
1 .file "atanf.s"
3 // THIS IS NOT OPTIMIZED AND NOT OFFICIAL
5 // Copyright (C) 2000, 2001, Intel Corporation
6 // All rights reserved.
7 //
8 // Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
9 // and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
15 // * Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
18 // * Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
22 // * The name of Intel Corporation may not be used to endorse or promote
23 // products derived from this software without specific prior written
24 // permission.
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
34 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 // Intel Corporation is the author of this code, and requests that all
39 // problem reports or change requests be submitted to it directly at
40 // http://developer.intel.com/opensource.
43 // History
44 //==============================================================
45 // ?/??/00  Initial revision 
46 // 8/17/00  Changed predicate register macro-usage to direct predicate
47 //          names due to an assembler bug.
49 #include "libm_support.h"
52 // Assembly macros
53 //==============================================================
55 // integer registers used
56 EXP_Addr1          = r33
57 EXP_Addr2          = r34
59 // floating point registers used
60 atanf_coeff_R4     = f32
61 atanf_coeff_R5     = f33
62 atanf_coeff_R1     = f34
63 atanf_coeff_R2     = f35
65 atanf_coeff_R3     = f36
66 atanf_coeff_P1     = f37
67 atanf_coeff_Q6     = f38
68 atanf_coeff_Q7     = f39
69 atanf_coeff_Q8     = f40
71 atanf_coeff_Q9     = f41
72 atanf_coeff_Q4     = f42
73 atanf_coeff_Q5     = f43
74 atanf_coeff_Q2     = f44
75 atanf_coeff_Q3     = f45
77 atanf_coeff_P5     = f46
78 atanf_coeff_P6     = f47
79 atanf_coeff_Q0     = f48
80 atanf_coeff_Q1     = f49
81 atanf_coeff_P7     = f50
83 atanf_coeff_P8     = f51
84 atanf_coeff_P3     = f52
85 atanf_coeff_P4     = f53
86 atanf_coeff_P9     = f54
87 atanf_coeff_P10    = f55
89 atanf_coeff_P2     = f56
90 atanf_piby2        = f57
91 atanf_z            = f58
92 atanf_b            = f59
93 atanf_zsq          = f60
95 atanf_sgn_x        = f61
96 atanf_sgnx_piby2   = f62
97 atanf_abs_x        = f63
98 atanf_t            = f64
99 atanf_xcub         = f65
101 atanf_tsq          = f66
102 atanf_t4           = f67
103 atanf_x5           = f68
104 atanf_x6           = f69
105 atanf_x11          = f70
107 atanf_poly_p1      = f71
108 atanf_poly_p2      = f72
109 atanf_poly_p3      = f73
110 atanf_poly_p4      = f74
111 atanf_poly_p5      = f75
113 atanf_poly_q1      = f76
114 atanf_poly_q2      = f77
115 atanf_poly_q3      = f78
116 atanf_poly_q4      = f79
117 atanf_poly_q5      = f80
119 atanf_poly_q       = f81
120 atanf_poly_r1      = f81
121 atanf_poly_r2      = f82
122 atanf_poly_r3      = f83
123 atanf_bsq          = f84
124 atanf_z4           = f85
126 atanf_z5           = f86
127 atanf_z8           = f87
128 atanf_z13          = f88
129 atanf_poly_r2      = f89
130 atanf_poly_r1      = f90
132 atanf_z8_bsq       = f91
133 atanf_poly_r       = f92
134 atanf_z21_poly_r   = f93
135 atanf_answer       = f8
138 // predicate registers used
139 //atanf_pred_LE1     = p6
140 //atanf_pred_GT1     = p7
143 #ifdef _LIBC
144 .rodata
145 #else
146 .data
147 #endif
149 .align 16
151 atanf_coeff_1_table:
152 ASM_TYPE_DIRECTIVE(atanf_coeff_1_table,@object)
153 data8 0x40c4c241be751ff2  // r4
154 data8 0x40e9f300c2f3070b  // r5
155 data8 0x409babffef772075  // r3
156 data8 0xbfd5555512191621  // p1
157 data8 0x3fc9997e7afbff4e  // p2  = q8
158 data8 0xbfd5555512191621  // p1  = q9
159 data8 0x3f97105b4160f86b  // p8  = q2
160 data8 0xbfa6e10ba401393f  // p7  = q3
161 data8 0x3f522e5d33bc9baa  // p10 = q0
162 data8 0xbf7deaadaa336451  // p9  = q1
163 data8 0xbfc2473c5145ee38  // p3
164 data8 0x3fbc4f512b1865f5  // p4
165 data8 0x3fc9997e7afbff4e  // p2
166 data8 0x3ff921fb54442d18  // pi/2
167 ASM_SIZE_DIRECTIVE(atanf_coeff_1_table)
171 atanf_coeff_2_table:
172 ASM_TYPE_DIRECTIVE(atanf_coeff_2_table,@object)
173 data8 0x4035000000004284  // r1
174 data8 0x406cdffff336a59b  // r2
175 data8 0x3fbc4f512b1865f5  // p4 = q6
176 data8 0xbfc2473c5145ee38  // p3 = q7
177 data8 0x3fb142a73d7c54e3  // p6 = q4
178 data8 0xbfb68eed6a8cfa32  // p5 = q5
179 data8 0xbfb68eed6a8cfa32  // p5
180 data8 0x3fb142a73d7c54e3  // p6
181 data8 0xbfa6e10ba401393f  // p7
182 data8 0x3f97105b4160f86b  // p8
183 data8 0xbf7deaadaa336451  // p9
184 data8 0x3f522e5d33bc9baa  // p10
185 ASM_SIZE_DIRECTIVE(atanf_coeff_2_table)
189 .global atanf 
191 .text
192 .proc  atanf
194 .align 32
195 atanf:
198 {     .mfi 
199      alloc      r32                  = ar.pfs,1,2,0,0
200      frcpa.s1  atanf_z,p0   =    f1,f8
201      addl      EXP_Addr2           =    @ltoff(atanf_coeff_2_table),gp
203 {     .mfi 
204      addl      EXP_Addr1 =    @ltoff(atanf_coeff_1_table),gp
205      fma.s1    atanf_t   =    f8,f8,f0
206      nop.i                 999;;
210 {     .mfi 
211      nop.m                      999
212      fmerge.s  atanf_sgn_x    =    f8,f1
213      nop.i                      999;;
216 {     .mfi 
217      ld8       EXP_Addr1      =    [EXP_Addr1]
218      fmerge.s  atanf_abs_x    =    f1,f8
219      nop.i                      999
221 {     .mfi 
222      ld8       EXP_Addr2 =    [EXP_Addr2]
223      nop.f                 999
224      nop.i                 999;;
228 {     .mfi 
229      nop.m                      999
230      fclass.m  p8,p0   =    f8,0x7      // @zero
231      nop.i                      999;;
234 {     .mfi 
235      nop.m                      999
236      fcmp.eq.unc.s0 p9,p10    =    f8,f1
237      nop.i                      999;;
240 {     .mfi 
241      ldfpd     atanf_coeff_R4,atanf_coeff_R5 =    [EXP_Addr1],16
242      fnma.s1   atanf_b                       =    f8,atanf_z,f1
243      nop.i                                     999
245 {     .mfi 
246      ldfpd     atanf_coeff_R1,atanf_coeff_R2 =    [EXP_Addr2],16
247      fma.s1    atanf_zsq                     =    atanf_z,atanf_z,f0
248      nop.i                                     999;;
252 {     .mfi 
253      ldfpd     atanf_coeff_R3,atanf_coeff_P1 =    [EXP_Addr1],16
254      fma.s1    atanf_xcub                    =    f8,atanf_t,f0
255      nop.i                                     999
257 {     .mfi 
258      ldfpd     atanf_coeff_Q6,atanf_coeff_Q7 =    [EXP_Addr2],16
259      fma.s1    atanf_tsq                     =    atanf_t,atanf_t,f0
260      nop.i                                     999;;
264 {     .mfi 
265      ldfpd          atanf_coeff_Q8,atanf_coeff_Q9 =    [EXP_Addr1],16
266 //     fcmp.le.s1     atanf_pred_LE1,atanf_pred_GT1 =    atanf_abs_x,f1
267      fcmp.le.s1     p6,p7 =    atanf_abs_x,f1
268      nop.i                                          999
270 {     .mfi 
271      ldfpd     atanf_coeff_Q4,atanf_coeff_Q5 =    [EXP_Addr2],16
272      nop.f                                     999
273      nop.i                                     999;;
277 {     .mfi 
278      ldfpd     atanf_coeff_Q2,atanf_coeff_Q3 =    [EXP_Addr1],16
279      fclass.m  p8,p0                  =    f8,0xe7      // @inf|@qnan|@snan|@zero
280      nop.i                                     999
282 {     .mfi 
283      ldfpd     atanf_coeff_P5,atanf_coeff_P6 =    [EXP_Addr2],16
284      nop.f                                     999
285      nop.i                                     999;;
289 {     .mfi 
290      ldfpd     atanf_coeff_Q0,atanf_coeff_Q1 =    [EXP_Addr1],16
291      nop.f                                     999
292      nop.i                                     999
294 {     .mfi 
295      ldfpd     atanf_coeff_P7,atanf_coeff_P8 =    [EXP_Addr2],16
296      nop.f                                     999
297      nop.i                                     999;;
301 {     .mfi 
302      ldfpd     atanf_coeff_P3,atanf_coeff_P4 =    [EXP_Addr1],16
303      fma.s1    atanf_bsq                     =    atanf_b,atanf_b,f0
304      nop.i                                     999
306 {     .mfi 
307      ldfpd     atanf_coeff_P9,atanf_coeff_P10     =    [EXP_Addr2]
308      fma.s1    atanf_z4                           =    atanf_zsq,atanf_zsq,f0
309      nop.i                                          999;;
313 {     .mfi 
314      ldfpd     atanf_coeff_P2,atanf_piby2    =    [EXP_Addr1]
315      fma.s1    atanf_x6                      =    atanf_t,atanf_tsq,f0
316      nop.i                                     999
318 {     .mfi 
319      nop.m                 999
320      fma.s1    atanf_t4  =    atanf_tsq,atanf_tsq,f0
321      nop.i                 999;;
325 {     .mfb 
326      nop.m                 999
327      fma.s1    atanf_x5  =    atanf_t,atanf_xcub,f0
328 (p8)  br.cond.spnt   L(ATANF_X_INF_NAN_ZERO)
332 {     .mfi 
333      nop.m                      999
334      fma.s1    atanf_poly_r1  =    atanf_b,atanf_coeff_R1,f1
335      nop.i                      999
337 {     .mfi 
338      nop.m                      999
339      fma.s1    atanf_poly_r3  =    atanf_b,atanf_coeff_R5,atanf_coeff_R4
340      nop.i                      999;;
344 {     .mfi 
345      nop.m                      999
346      fma.s1    atanf_poly_r2  =    atanf_b,atanf_coeff_R3,atanf_coeff_R2
347      nop.i                      999
349 {     .mfi 
350      nop.m                 999
351      fma.s1    atanf_z8  =    atanf_z4,atanf_z4,f0
352      nop.i                 999;;
356 {     .mfi 
357      nop.m                      999
358      fma.s1    atanf_poly_q2  =    atanf_t,atanf_coeff_Q5,atanf_coeff_Q4
359      nop.i                      999
361 {     .mfi 
362      nop.m                      999
363      fma.s1    atanf_poly_q3  =    atanf_t,atanf_coeff_Q7,atanf_coeff_Q6
364      nop.i                      999;;
368 {     .mfi 
369      nop.m                 999
370      fma.s1    atanf_z5  =    atanf_z,atanf_z4,f0
371      nop.i                 999
373 {     .mfi 
374      nop.m                      999
375      fma.s1    atanf_poly_q1  =    atanf_t,atanf_coeff_Q9,atanf_coeff_Q8
376      nop.i                      999;;
380 {     .mfi 
381      nop.m                      999
382      fma.s1    atanf_poly_q4  =    atanf_t,atanf_coeff_Q1,atanf_coeff_Q0
383      nop.i                      999
385 {     .mfi 
386      nop.m                      999
387      fma.s1    atanf_poly_q5  =    atanf_t,atanf_coeff_Q3,atanf_coeff_Q2
388      nop.i                      999;;
392 {     .mfi 
393      nop.m                      999
394      fma.s1    atanf_poly_p4  =    f8,atanf_coeff_P1,f0
395      nop.i                      999
397 {     .mfi 
398      nop.m                      999
399      fma.s1    atanf_poly_p5  =    atanf_t,atanf_coeff_P4,atanf_coeff_P3
400      nop.i                      999;;
404 {     .mfi 
405      nop.m                      999
406      fma.s1    atanf_poly_r1  =    atanf_z8,atanf_poly_r1,f0
407      nop.i                      999
409 {     .mfi 
410      nop.m                      999
411      fma.s1    atanf_z8_bsq   =    atanf_z8,atanf_bsq,f0
412      nop.i                      999;;
416 {     .mfi 
417      nop.m                      999
418      fma.s1    atanf_poly_q2  =    atanf_tsq,atanf_poly_q3,atanf_poly_q2
419      nop.i                      999
421 {     .mfi 
422      nop.m                      999
423      fma.s1    atanf_poly_r2  =    atanf_bsq,atanf_poly_r3,atanf_poly_r2
424      nop.i                      999;;
428 {     .mfi 
429      nop.m                      999
430      fma.s1    atanf_poly_p2  =    atanf_t,atanf_coeff_P8,atanf_coeff_P7
431      nop.i                      999
433 {     .mfi 
434      nop.m                      999
435      fma.s1    atanf_poly_q1  =    atanf_poly_q1,f1,atanf_tsq
436      nop.i                      999;;
440 {     .mfi 
441      nop.m                 999
442      fma.s1    atanf_z13 =    atanf_z5,atanf_z8,f0
443      nop.i                 999
445 {     .mfi 
446      nop.m                      999
447      fma.s1    atanf_poly_p1  =    atanf_t,atanf_coeff_P10,atanf_coeff_P9
448      nop.i                      999;;
452 {     .mfi 
453      nop.m                      999
454      fma.s1    atanf_poly_p4  =    atanf_t,atanf_poly_p4,f8
455      nop.i                      999
457 {     .mfi 
458      nop.m                      999
459      fma.s1    atanf_poly_q4  =    atanf_tsq,atanf_poly_q5,atanf_poly_q4
460      nop.i                      999;;
464 {     .mfi 
465      nop.m                      999
466      fma.s1    atanf_poly_p3  =    atanf_t,atanf_coeff_P6,atanf_coeff_P5
467      nop.i                      999
469 {     .mfi 
470      nop.m                      999
471      fma.s1    atanf_poly_p5  =    atanf_t,atanf_poly_p5,atanf_coeff_P2
472      nop.i                      999;;
476 {     .mfi 
477      nop.m                 999
478      fma.s1    atanf_x11 =    atanf_x5,atanf_x6,f0
479      nop.i                 999
481 {     .mfi 
482      nop.m                      999
483      fma.s1    atanf_poly_r   =    atanf_z8_bsq,atanf_poly_r2,atanf_poly_r1
484      nop.i                      999;;
488 {     .mfi 
489      nop.m                           999
490      fma       atanf_sgnx_piby2    =    atanf_sgn_x,atanf_piby2,f0
491      nop.i                           999
493 {     .mfi 
494      nop.m                      999
495      fma.s1    atanf_poly_q2  =    atanf_t4,atanf_poly_q1,atanf_poly_q2
496      nop.i                      999;;
500 {     .mfi 
501      nop.m                      999
502      fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p2
503      nop.i                      999;;
506 {     .mfi 
507      nop.m                      999
508      fma.s1    atanf_poly_p4  =    atanf_x5,atanf_poly_p5,atanf_poly_p4
509      nop.i                      999;;
512 {     .mfi 
513      nop.m                           999
514      fma.s1    atanf_z21_poly_r    =    atanf_z13,atanf_poly_r,f0
515      nop.i                           999;;
518 {     .mfi 
519      nop.m                      999
520      fma.s1    atanf_poly_q   =    atanf_t4,atanf_poly_q2,atanf_poly_q4
521      nop.i                      999;;
524 {     .mfi 
525      nop.m                      999
526      fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p3
527      nop.i                      999;;
530 {     .mfi 
531                     nop.m                      999
532 //(atanf_pred_GT1)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
533 (p7)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
534                     nop.i                      999;;
537 {     .mfb 
538                     nop.m                      999
539 //(atanf_pred_LE1)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
540 (p6)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
541                     br.ret.sptk b0
546 L(ATANF_X_INF_NAN_ZERO):
548       fclass.m p8,p9 = f8,0x23  // @inf
550 (p8)  fmerge.s f8 = f8, atanf_piby2
552       fnorm.s f8 = f8
553       br.ret.sptk b0
555 .endp atanf
556 ASM_SIZE_DIRECTIVE(atanf)