3 // THIS IS NOT OPTIMIZED AND NOT OFFICIAL
5 // Copyright (C) 2000, 2001, Intel Corporation
6 // All rights reserved.
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
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
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.
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"
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
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)
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)
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
204 addl EXP_Addr1 = @ltoff(atanf_coeff_1_table),gp
205 fma.s1 atanf_t = f8,f8,f0
212 fmerge.s atanf_sgn_x = f8,f1
217 ld8 EXP_Addr1 = [EXP_Addr1]
218 fmerge.s atanf_abs_x = f1,f8
222 ld8 EXP_Addr2 = [EXP_Addr2]
230 fclass.m p8,p0 = f8,0x7 // @zero
236 fcmp.eq.unc.s0 p9,p10 = f8,f1
241 ldfpd atanf_coeff_R4,atanf_coeff_R5 = [EXP_Addr1],16
242 fnma.s1 atanf_b = f8,atanf_z,f1
246 ldfpd atanf_coeff_R1,atanf_coeff_R2 = [EXP_Addr2],16
247 fma.s1 atanf_zsq = atanf_z,atanf_z,f0
253 ldfpd atanf_coeff_R3,atanf_coeff_P1 = [EXP_Addr1],16
254 fma.s1 atanf_xcub = f8,atanf_t,f0
258 ldfpd atanf_coeff_Q6,atanf_coeff_Q7 = [EXP_Addr2],16
259 fma.s1 atanf_tsq = atanf_t,atanf_t,f0
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
271 ldfpd atanf_coeff_Q4,atanf_coeff_Q5 = [EXP_Addr2],16
278 ldfpd atanf_coeff_Q2,atanf_coeff_Q3 = [EXP_Addr1],16
279 fclass.m p8,p0 = f8,0xe7 // @inf|@qnan|@snan|@zero
283 ldfpd atanf_coeff_P5,atanf_coeff_P6 = [EXP_Addr2],16
290 ldfpd atanf_coeff_Q0,atanf_coeff_Q1 = [EXP_Addr1],16
295 ldfpd atanf_coeff_P7,atanf_coeff_P8 = [EXP_Addr2],16
302 ldfpd atanf_coeff_P3,atanf_coeff_P4 = [EXP_Addr1],16
303 fma.s1 atanf_bsq = atanf_b,atanf_b,f0
307 ldfpd atanf_coeff_P9,atanf_coeff_P10 = [EXP_Addr2]
308 fma.s1 atanf_z4 = atanf_zsq,atanf_zsq,f0
314 ldfpd atanf_coeff_P2,atanf_piby2 = [EXP_Addr1]
315 fma.s1 atanf_x6 = atanf_t,atanf_tsq,f0
320 fma.s1 atanf_t4 = atanf_tsq,atanf_tsq,f0
327 fma.s1 atanf_x5 = atanf_t,atanf_xcub,f0
328 (p8) br.cond.spnt L(ATANF_X_INF_NAN_ZERO)
334 fma.s1 atanf_poly_r1 = atanf_b,atanf_coeff_R1,f1
339 fma.s1 atanf_poly_r3 = atanf_b,atanf_coeff_R5,atanf_coeff_R4
346 fma.s1 atanf_poly_r2 = atanf_b,atanf_coeff_R3,atanf_coeff_R2
351 fma.s1 atanf_z8 = atanf_z4,atanf_z4,f0
358 fma.s1 atanf_poly_q2 = atanf_t,atanf_coeff_Q5,atanf_coeff_Q4
363 fma.s1 atanf_poly_q3 = atanf_t,atanf_coeff_Q7,atanf_coeff_Q6
370 fma.s1 atanf_z5 = atanf_z,atanf_z4,f0
375 fma.s1 atanf_poly_q1 = atanf_t,atanf_coeff_Q9,atanf_coeff_Q8
382 fma.s1 atanf_poly_q4 = atanf_t,atanf_coeff_Q1,atanf_coeff_Q0
387 fma.s1 atanf_poly_q5 = atanf_t,atanf_coeff_Q3,atanf_coeff_Q2
394 fma.s1 atanf_poly_p4 = f8,atanf_coeff_P1,f0
399 fma.s1 atanf_poly_p5 = atanf_t,atanf_coeff_P4,atanf_coeff_P3
406 fma.s1 atanf_poly_r1 = atanf_z8,atanf_poly_r1,f0
411 fma.s1 atanf_z8_bsq = atanf_z8,atanf_bsq,f0
418 fma.s1 atanf_poly_q2 = atanf_tsq,atanf_poly_q3,atanf_poly_q2
423 fma.s1 atanf_poly_r2 = atanf_bsq,atanf_poly_r3,atanf_poly_r2
430 fma.s1 atanf_poly_p2 = atanf_t,atanf_coeff_P8,atanf_coeff_P7
435 fma.s1 atanf_poly_q1 = atanf_poly_q1,f1,atanf_tsq
442 fma.s1 atanf_z13 = atanf_z5,atanf_z8,f0
447 fma.s1 atanf_poly_p1 = atanf_t,atanf_coeff_P10,atanf_coeff_P9
454 fma.s1 atanf_poly_p4 = atanf_t,atanf_poly_p4,f8
459 fma.s1 atanf_poly_q4 = atanf_tsq,atanf_poly_q5,atanf_poly_q4
466 fma.s1 atanf_poly_p3 = atanf_t,atanf_coeff_P6,atanf_coeff_P5
471 fma.s1 atanf_poly_p5 = atanf_t,atanf_poly_p5,atanf_coeff_P2
478 fma.s1 atanf_x11 = atanf_x5,atanf_x6,f0
483 fma.s1 atanf_poly_r = atanf_z8_bsq,atanf_poly_r2,atanf_poly_r1
490 fma atanf_sgnx_piby2 = atanf_sgn_x,atanf_piby2,f0
495 fma.s1 atanf_poly_q2 = atanf_t4,atanf_poly_q1,atanf_poly_q2
502 fma.s1 atanf_poly_p1 = atanf_tsq,atanf_poly_p1,atanf_poly_p2
508 fma.s1 atanf_poly_p4 = atanf_x5,atanf_poly_p5,atanf_poly_p4
514 fma.s1 atanf_z21_poly_r = atanf_z13,atanf_poly_r,f0
520 fma.s1 atanf_poly_q = atanf_t4,atanf_poly_q2,atanf_poly_q4
526 fma.s1 atanf_poly_p1 = atanf_tsq,atanf_poly_p1,atanf_poly_p3
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
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
546 L(ATANF_X_INF_NAN_ZERO):
548 fclass.m p8,p9 = f8,0x23 // @inf
550 (p8) fmerge.s f8 = f8, atanf_piby2
556 ASM_SIZE_DIRECTIVE(atanf)