4 // Copyright (c) 2000 - 2003, Intel Corporation
5 // All rights reserved.
7 // Contributed 2000 by the Intel Numerics Group, Intel Corporation
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
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
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.
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
53 //==============================================================
55 // integer registers used
59 // floating point registers used
96 atanf_sgnx_piby2 = f62
134 atanf_z21_poly_r = f93
138 // predicate registers used
139 //atanf_pred_LE1 = p6
140 //atanf_pred_GT1 = p7
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)
184 GLOBAL_LIBM_ENTRY(atanf)
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
192 addl EXP_Addr1 = @ltoff(atanf_coeff_1_table),gp
193 fma.s1 atanf_t = f8,f8,f0
200 fmerge.s atanf_sgn_x = f8,f1
205 ld8 EXP_Addr1 = [EXP_Addr1]
206 fmerge.s atanf_abs_x = f1,f8
210 ld8 EXP_Addr2 = [EXP_Addr2]
218 fclass.m p8,p0 = f8,0x7 // @zero
224 fcmp.eq.unc.s0 p9,p10 = f8,f1
229 ldfpd atanf_coeff_R4,atanf_coeff_R5 = [EXP_Addr1],16
230 fnma.s1 atanf_b = f8,atanf_z,f1
234 ldfpd atanf_coeff_R1,atanf_coeff_R2 = [EXP_Addr2],16
235 fma.s1 atanf_zsq = atanf_z,atanf_z,f0
241 ldfpd atanf_coeff_R3,atanf_coeff_P1 = [EXP_Addr1],16
242 fma.s1 atanf_xcub = f8,atanf_t,f0
246 ldfpd atanf_coeff_Q6,atanf_coeff_Q7 = [EXP_Addr2],16
247 fma.s1 atanf_tsq = atanf_t,atanf_t,f0
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
259 ldfpd atanf_coeff_Q4,atanf_coeff_Q5 = [EXP_Addr2],16
266 ldfpd atanf_coeff_Q2,atanf_coeff_Q3 = [EXP_Addr1],16
267 fclass.m p8,p0 = f8,0xe7 // @inf|@qnan|@snan|@zero
271 ldfpd atanf_coeff_P5,atanf_coeff_P6 = [EXP_Addr2],16
278 ldfpd atanf_coeff_Q0,atanf_coeff_Q1 = [EXP_Addr1],16
283 ldfpd atanf_coeff_P7,atanf_coeff_P8 = [EXP_Addr2],16
290 ldfpd atanf_coeff_P3,atanf_coeff_P4 = [EXP_Addr1],16
291 fma.s1 atanf_bsq = atanf_b,atanf_b,f0
295 ldfpd atanf_coeff_P9,atanf_coeff_P10 = [EXP_Addr2]
296 fma.s1 atanf_z4 = atanf_zsq,atanf_zsq,f0
302 ldfpd atanf_coeff_P2,atanf_piby2 = [EXP_Addr1]
303 fma.s1 atanf_x6 = atanf_t,atanf_tsq,f0
308 fma.s1 atanf_t4 = atanf_tsq,atanf_tsq,f0
315 fma.s1 atanf_x5 = atanf_t,atanf_xcub,f0
316 (p8) br.cond.spnt ATANF_X_INF_NAN_ZERO
322 fma.s1 atanf_poly_r1 = atanf_b,atanf_coeff_R1,f1
327 fma.s1 atanf_poly_r3 = atanf_b,atanf_coeff_R5,atanf_coeff_R4
334 fma.s1 atanf_poly_r2 = atanf_b,atanf_coeff_R3,atanf_coeff_R2
339 fma.s1 atanf_z8 = atanf_z4,atanf_z4,f0
346 fma.s1 atanf_poly_q2 = atanf_t,atanf_coeff_Q5,atanf_coeff_Q4
351 fma.s1 atanf_poly_q3 = atanf_t,atanf_coeff_Q7,atanf_coeff_Q6
358 fma.s1 atanf_z5 = atanf_z,atanf_z4,f0
363 fma.s1 atanf_poly_q1 = atanf_t,atanf_coeff_Q9,atanf_coeff_Q8
370 fma.s1 atanf_poly_q4 = atanf_t,atanf_coeff_Q1,atanf_coeff_Q0
375 fma.s1 atanf_poly_q5 = atanf_t,atanf_coeff_Q3,atanf_coeff_Q2
382 fma.s1 atanf_poly_p4 = f8,atanf_coeff_P1,f0
387 fma.s1 atanf_poly_p5 = atanf_t,atanf_coeff_P4,atanf_coeff_P3
394 fma.s1 atanf_poly_r1 = atanf_z8,atanf_poly_r1,f0
399 fma.s1 atanf_z8_bsq = atanf_z8,atanf_bsq,f0
406 fma.s1 atanf_poly_q2 = atanf_tsq,atanf_poly_q3,atanf_poly_q2
411 fma.s1 atanf_poly_r2 = atanf_bsq,atanf_poly_r3,atanf_poly_r2
418 fma.s1 atanf_poly_p2 = atanf_t,atanf_coeff_P8,atanf_coeff_P7
423 fma.s1 atanf_poly_q1 = atanf_poly_q1,f1,atanf_tsq
430 fma.s1 atanf_z13 = atanf_z5,atanf_z8,f0
435 fma.s1 atanf_poly_p1 = atanf_t,atanf_coeff_P10,atanf_coeff_P9
442 fma.s1 atanf_poly_p4 = atanf_t,atanf_poly_p4,f8
447 fma.s1 atanf_poly_q4 = atanf_tsq,atanf_poly_q5,atanf_poly_q4
454 fma.s1 atanf_poly_p3 = atanf_t,atanf_coeff_P6,atanf_coeff_P5
459 fma.s1 atanf_poly_p5 = atanf_t,atanf_poly_p5,atanf_coeff_P2
466 fma.s1 atanf_x11 = atanf_x5,atanf_x6,f0
471 fma.s1 atanf_poly_r = atanf_z8_bsq,atanf_poly_r2,atanf_poly_r1
478 fma.s0 atanf_sgnx_piby2 = atanf_sgn_x,atanf_piby2,f0
483 fma.s1 atanf_poly_q2 = atanf_t4,atanf_poly_q1,atanf_poly_q2
490 fma.s1 atanf_poly_p1 = atanf_tsq,atanf_poly_p1,atanf_poly_p2
496 fma.s1 atanf_poly_p4 = atanf_x5,atanf_poly_p5,atanf_poly_p4
502 fma.s1 atanf_z21_poly_r = atanf_z13,atanf_poly_r,f0
508 fma.s1 atanf_poly_q = atanf_t4,atanf_poly_q2,atanf_poly_q4
514 fma.s1 atanf_poly_p1 = atanf_tsq,atanf_poly_p1,atanf_poly_p3
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
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
534 ATANF_X_INF_NAN_ZERO:
538 fclass.m p8,p9 = f8,0x23 // @inf
544 (p8) fmerge.s f8 = f8, atanf_piby2
555 GLOBAL_LIBM_END(atanf)