2.9
[glibc/nacl-glibc.git] / sysdeps / ia64 / fpu / s_atanf.S
blob4da68c7f0832b8e5c8e837daeba359d0784c4504
1 .file "atanf.s"
4 // Copyright (c) 2000 - 2003, 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.
41 // History
42 //==============================================================
43 // 02/20/00 Initial version
44 // 08/17/00 Changed predicate register macro-usage to direct predicate
45 //          names due to an assembler bug.
46 // 02/06/02 Corrected .section statement
47 // 05/20/02 Cleaned up namespace and sf0 syntax
48 // 02/06/03 Reordered header: .section, .global, .proc, .align;
49 //          added missing bundling
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 RODATA
145 .align 16
147 LOCAL_OBJECT_START(atanf_coeff_1_table)
148 data8 0x40c4c241be751ff2  // r4
149 data8 0x40e9f300c2f3070b  // r5
150 data8 0x409babffef772075  // r3
151 data8 0xbfd5555512191621  // p1
152 data8 0x3fc9997e7afbff4e  // p2  = q8
153 data8 0xbfd5555512191621  // p1  = q9
154 data8 0x3f97105b4160f86b  // p8  = q2
155 data8 0xbfa6e10ba401393f  // p7  = q3
156 data8 0x3f522e5d33bc9baa  // p10 = q0
157 data8 0xbf7deaadaa336451  // p9  = q1
158 data8 0xbfc2473c5145ee38  // p3
159 data8 0x3fbc4f512b1865f5  // p4
160 data8 0x3fc9997e7afbff4e  // p2
161 data8 0x3ff921fb54442d18  // pi/2
162 LOCAL_OBJECT_END(atanf_coeff_1_table)
166 LOCAL_OBJECT_START(atanf_coeff_2_table)
167 data8 0x4035000000004284  // r1
168 data8 0x406cdffff336a59b  // r2
169 data8 0x3fbc4f512b1865f5  // p4 = q6
170 data8 0xbfc2473c5145ee38  // p3 = q7
171 data8 0x3fb142a73d7c54e3  // p6 = q4
172 data8 0xbfb68eed6a8cfa32  // p5 = q5
173 data8 0xbfb68eed6a8cfa32  // p5
174 data8 0x3fb142a73d7c54e3  // p6
175 data8 0xbfa6e10ba401393f  // p7
176 data8 0x3f97105b4160f86b  // p8
177 data8 0xbf7deaadaa336451  // p9
178 data8 0x3f522e5d33bc9baa  // p10
179 LOCAL_OBJECT_END(atanf_coeff_2_table)
183 .section .text
184 GLOBAL_LIBM_ENTRY(atanf)
186 {     .mfi 
187      alloc      r32                  = ar.pfs,1,2,0,0
188      frcpa.s1  atanf_z,p0   =    f1,f8
189      addl      EXP_Addr2           =    @ltoff(atanf_coeff_2_table),gp
191 {     .mfi 
192      addl      EXP_Addr1 =    @ltoff(atanf_coeff_1_table),gp
193      fma.s1    atanf_t   =    f8,f8,f0
194      nop.i                 999;;
198 {     .mfi 
199      nop.m                      999
200      fmerge.s  atanf_sgn_x    =    f8,f1
201      nop.i                      999;;
204 {     .mfi 
205      ld8       EXP_Addr1      =    [EXP_Addr1]
206      fmerge.s  atanf_abs_x    =    f1,f8
207      nop.i                      999
209 {     .mfi 
210      ld8       EXP_Addr2 =    [EXP_Addr2]
211      nop.f                 999
212      nop.i                 999;;
216 {     .mfi 
217      nop.m                      999
218      fclass.m  p8,p0   =    f8,0x7      // @zero
219      nop.i                      999;;
222 {     .mfi 
223      nop.m                      999
224      fcmp.eq.unc.s0 p9,p10    =    f8,f1
225      nop.i                      999;;
228 {     .mfi 
229      ldfpd     atanf_coeff_R4,atanf_coeff_R5 =    [EXP_Addr1],16
230      fnma.s1   atanf_b                       =    f8,atanf_z,f1
231      nop.i                                     999
233 {     .mfi 
234      ldfpd     atanf_coeff_R1,atanf_coeff_R2 =    [EXP_Addr2],16
235      fma.s1    atanf_zsq                     =    atanf_z,atanf_z,f0
236      nop.i                                     999;;
240 {     .mfi 
241      ldfpd     atanf_coeff_R3,atanf_coeff_P1 =    [EXP_Addr1],16
242      fma.s1    atanf_xcub                    =    f8,atanf_t,f0
243      nop.i                                     999
245 {     .mfi 
246      ldfpd     atanf_coeff_Q6,atanf_coeff_Q7 =    [EXP_Addr2],16
247      fma.s1    atanf_tsq                     =    atanf_t,atanf_t,f0
248      nop.i                                     999;;
252 {     .mfi 
253      ldfpd          atanf_coeff_Q8,atanf_coeff_Q9 =    [EXP_Addr1],16
254 //     fcmp.le.s1     atanf_pred_LE1,atanf_pred_GT1 =    atanf_abs_x,f1
255      fcmp.le.s1     p6,p7 =    atanf_abs_x,f1
256      nop.i                                          999
258 {     .mfi 
259      ldfpd     atanf_coeff_Q4,atanf_coeff_Q5 =    [EXP_Addr2],16
260      nop.f                                     999
261      nop.i                                     999;;
265 {     .mfi 
266      ldfpd     atanf_coeff_Q2,atanf_coeff_Q3 =    [EXP_Addr1],16
267      fclass.m  p8,p0                  =    f8,0xe7      // @inf|@qnan|@snan|@zero
268      nop.i                                     999
270 {     .mfi 
271      ldfpd     atanf_coeff_P5,atanf_coeff_P6 =    [EXP_Addr2],16
272      nop.f                                     999
273      nop.i                                     999;;
277 {     .mfi 
278      ldfpd     atanf_coeff_Q0,atanf_coeff_Q1 =    [EXP_Addr1],16
279      nop.f                                     999
280      nop.i                                     999
282 {     .mfi 
283      ldfpd     atanf_coeff_P7,atanf_coeff_P8 =    [EXP_Addr2],16
284      nop.f                                     999
285      nop.i                                     999;;
289 {     .mfi 
290      ldfpd     atanf_coeff_P3,atanf_coeff_P4 =    [EXP_Addr1],16
291      fma.s1    atanf_bsq                     =    atanf_b,atanf_b,f0
292      nop.i                                     999
294 {     .mfi 
295      ldfpd     atanf_coeff_P9,atanf_coeff_P10     =    [EXP_Addr2]
296      fma.s1    atanf_z4                           =    atanf_zsq,atanf_zsq,f0
297      nop.i                                          999;;
301 {     .mfi 
302      ldfpd     atanf_coeff_P2,atanf_piby2    =    [EXP_Addr1]
303      fma.s1    atanf_x6                      =    atanf_t,atanf_tsq,f0
304      nop.i                                     999
306 {     .mfi 
307      nop.m                 999
308      fma.s1    atanf_t4  =    atanf_tsq,atanf_tsq,f0
309      nop.i                 999;;
313 {     .mfb 
314      nop.m                 999
315      fma.s1    atanf_x5  =    atanf_t,atanf_xcub,f0
316 (p8)  br.cond.spnt   ATANF_X_INF_NAN_ZERO
320 {     .mfi 
321      nop.m                      999
322      fma.s1    atanf_poly_r1  =    atanf_b,atanf_coeff_R1,f1
323      nop.i                      999
325 {     .mfi 
326      nop.m                      999
327      fma.s1    atanf_poly_r3  =    atanf_b,atanf_coeff_R5,atanf_coeff_R4
328      nop.i                      999;;
332 {     .mfi 
333      nop.m                      999
334      fma.s1    atanf_poly_r2  =    atanf_b,atanf_coeff_R3,atanf_coeff_R2
335      nop.i                      999
337 {     .mfi 
338      nop.m                 999
339      fma.s1    atanf_z8  =    atanf_z4,atanf_z4,f0
340      nop.i                 999;;
344 {     .mfi 
345      nop.m                      999
346      fma.s1    atanf_poly_q2  =    atanf_t,atanf_coeff_Q5,atanf_coeff_Q4
347      nop.i                      999
349 {     .mfi 
350      nop.m                      999
351      fma.s1    atanf_poly_q3  =    atanf_t,atanf_coeff_Q7,atanf_coeff_Q6
352      nop.i                      999;;
356 {     .mfi 
357      nop.m                 999
358      fma.s1    atanf_z5  =    atanf_z,atanf_z4,f0
359      nop.i                 999
361 {     .mfi 
362      nop.m                      999
363      fma.s1    atanf_poly_q1  =    atanf_t,atanf_coeff_Q9,atanf_coeff_Q8
364      nop.i                      999;;
368 {     .mfi 
369      nop.m                      999
370      fma.s1    atanf_poly_q4  =    atanf_t,atanf_coeff_Q1,atanf_coeff_Q0
371      nop.i                      999
373 {     .mfi 
374      nop.m                      999
375      fma.s1    atanf_poly_q5  =    atanf_t,atanf_coeff_Q3,atanf_coeff_Q2
376      nop.i                      999;;
380 {     .mfi 
381      nop.m                      999
382      fma.s1    atanf_poly_p4  =    f8,atanf_coeff_P1,f0
383      nop.i                      999
385 {     .mfi 
386      nop.m                      999
387      fma.s1    atanf_poly_p5  =    atanf_t,atanf_coeff_P4,atanf_coeff_P3
388      nop.i                      999;;
392 {     .mfi 
393      nop.m                      999
394      fma.s1    atanf_poly_r1  =    atanf_z8,atanf_poly_r1,f0
395      nop.i                      999
397 {     .mfi 
398      nop.m                      999
399      fma.s1    atanf_z8_bsq   =    atanf_z8,atanf_bsq,f0
400      nop.i                      999;;
404 {     .mfi 
405      nop.m                      999
406      fma.s1    atanf_poly_q2  =    atanf_tsq,atanf_poly_q3,atanf_poly_q2
407      nop.i                      999
409 {     .mfi 
410      nop.m                      999
411      fma.s1    atanf_poly_r2  =    atanf_bsq,atanf_poly_r3,atanf_poly_r2
412      nop.i                      999;;
416 {     .mfi 
417      nop.m                      999
418      fma.s1    atanf_poly_p2  =    atanf_t,atanf_coeff_P8,atanf_coeff_P7
419      nop.i                      999
421 {     .mfi 
422      nop.m                      999
423      fma.s1    atanf_poly_q1  =    atanf_poly_q1,f1,atanf_tsq
424      nop.i                      999;;
428 {     .mfi 
429      nop.m                 999
430      fma.s1    atanf_z13 =    atanf_z5,atanf_z8,f0
431      nop.i                 999
433 {     .mfi 
434      nop.m                      999
435      fma.s1    atanf_poly_p1  =    atanf_t,atanf_coeff_P10,atanf_coeff_P9
436      nop.i                      999;;
440 {     .mfi 
441      nop.m                      999
442      fma.s1    atanf_poly_p4  =    atanf_t,atanf_poly_p4,f8
443      nop.i                      999
445 {     .mfi 
446      nop.m                      999
447      fma.s1    atanf_poly_q4  =    atanf_tsq,atanf_poly_q5,atanf_poly_q4
448      nop.i                      999;;
452 {     .mfi 
453      nop.m                      999
454      fma.s1    atanf_poly_p3  =    atanf_t,atanf_coeff_P6,atanf_coeff_P5
455      nop.i                      999
457 {     .mfi 
458      nop.m                      999
459      fma.s1    atanf_poly_p5  =    atanf_t,atanf_poly_p5,atanf_coeff_P2
460      nop.i                      999;;
464 {     .mfi 
465      nop.m                 999
466      fma.s1    atanf_x11 =    atanf_x5,atanf_x6,f0
467      nop.i                 999
469 {     .mfi 
470      nop.m                      999
471      fma.s1    atanf_poly_r   =    atanf_z8_bsq,atanf_poly_r2,atanf_poly_r1
472      nop.i                      999;;
476 {     .mfi 
477      nop.m                           999
478      fma.s0       atanf_sgnx_piby2    =    atanf_sgn_x,atanf_piby2,f0
479      nop.i                           999
481 {     .mfi 
482      nop.m                      999
483      fma.s1    atanf_poly_q2  =    atanf_t4,atanf_poly_q1,atanf_poly_q2
484      nop.i                      999;;
488 {     .mfi 
489      nop.m                      999
490      fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p2
491      nop.i                      999;;
494 {     .mfi 
495      nop.m                      999
496      fma.s1    atanf_poly_p4  =    atanf_x5,atanf_poly_p5,atanf_poly_p4
497      nop.i                      999;;
500 {     .mfi 
501      nop.m                           999
502      fma.s1    atanf_z21_poly_r    =    atanf_z13,atanf_poly_r,f0
503      nop.i                           999;;
506 {     .mfi 
507      nop.m                      999
508      fma.s1    atanf_poly_q   =    atanf_t4,atanf_poly_q2,atanf_poly_q4
509      nop.i                      999;;
512 {     .mfi 
513      nop.m                      999
514      fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p3
515      nop.i                      999;;
518 {     .mfi 
519                     nop.m                      999
520 //(atanf_pred_GT1)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
521 (p7)    fnma.s.s0    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
522                     nop.i                      999;;
525 {     .mfb 
526                     nop.m                      999
527 //(atanf_pred_LE1)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
528 (p6)    fma.s.s0     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
529                     br.ret.sptk b0
534 ATANF_X_INF_NAN_ZERO:
536 { .mfi
537       nop.m 0
538       fclass.m p8,p9 = f8,0x23  // @inf
539       nop.i 0
542 { .mfi
543       nop.m 0
544 (p8)  fmerge.s f8 = f8, atanf_piby2
545       nop.i 0
548 { .mfb
549       nop.m 0
550       fnorm.s.s0 f8 = f8
551       br.ret.sptk b0
555 GLOBAL_LIBM_END(atanf)