about summary refs log tree commit diff
path: root/sysdeps/ia64/fpu/s_atanf.S
blob: 74d7340b17d7809c4e9232568124862f233e5c56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
.file "atanf.s"


// Copyright (c) 2000 - 2003, Intel Corporation
// All rights reserved.
//
// Contributed 2000 by the Intel Numerics Group, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote
// products derived from this software without specific prior written
// permission.

// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Intel Corporation is the author of this code, and requests that all
// problem reports or change requests be submitted to it directly at
// http://www.intel.com/software/products/opensource/libraries/num.htm.


// History
//==============================================================
// 02/20/00 Initial version
// 08/17/00 Changed predicate register macro-usage to direct predicate
//          names due to an assembler bug.
// 02/06/02 Corrected .section statement
// 05/20/02 Cleaned up namespace and sf0 syntax
// 02/06/03 Reordered header: .section, .global, .proc, .align;
//          added missing bundling

//
// Assembly macros
//==============================================================

// integer registers used
EXP_Addr1          = r33
EXP_Addr2          = r34

// floating point registers used
atanf_coeff_R4     = f32
atanf_coeff_R5     = f33
atanf_coeff_R1     = f34
atanf_coeff_R2     = f35

atanf_coeff_R3     = f36
atanf_coeff_P1     = f37
atanf_coeff_Q6     = f38
atanf_coeff_Q7     = f39
atanf_coeff_Q8     = f40

atanf_coeff_Q9     = f41
atanf_coeff_Q4     = f42
atanf_coeff_Q5     = f43
atanf_coeff_Q2     = f44
atanf_coeff_Q3     = f45

atanf_coeff_P5     = f46
atanf_coeff_P6     = f47
atanf_coeff_Q0     = f48
atanf_coeff_Q1     = f49
atanf_coeff_P7     = f50

atanf_coeff_P8     = f51
atanf_coeff_P3     = f52
atanf_coeff_P4     = f53
atanf_coeff_P9     = f54
atanf_coeff_P10    = f55

atanf_coeff_P2     = f56
atanf_piby2        = f57
atanf_z            = f58
atanf_b            = f59
atanf_zsq          = f60

atanf_sgn_x        = f61
atanf_sgnx_piby2   = f62
atanf_abs_x        = f63
atanf_t            = f64
atanf_xcub         = f65

atanf_tsq          = f66
atanf_t4           = f67
atanf_x5           = f68
atanf_x6           = f69
atanf_x11          = f70

atanf_poly_p1      = f71
atanf_poly_p2      = f72
atanf_poly_p3      = f73
atanf_poly_p4      = f74
atanf_poly_p5      = f75

atanf_poly_q1      = f76
atanf_poly_q2      = f77
atanf_poly_q3      = f78
atanf_poly_q4      = f79
atanf_poly_q5      = f80

atanf_poly_q       = f81
atanf_poly_r1      = f81
atanf_poly_r2      = f82
atanf_poly_r3      = f83
atanf_bsq          = f84
atanf_z4           = f85

atanf_z5           = f86
atanf_z8           = f87
atanf_z13          = f88
atanf_poly_r2      = f89
atanf_poly_r1      = f90

atanf_z8_bsq       = f91
atanf_poly_r       = f92
atanf_z21_poly_r   = f93
atanf_answer       = f8


// predicate registers used
//atanf_pred_LE1     = p6
//atanf_pred_GT1     = p7


RODATA

.align 16

LOCAL_OBJECT_START(atanf_coeff_1_table)
data8 0x40c4c241be751ff2  // r4
data8 0x40e9f300c2f3070b  // r5
data8 0x409babffef772075  // r3
data8 0xbfd5555512191621  // p1
data8 0x3fc9997e7afbff4e  // p2  = q8
data8 0xbfd5555512191621  // p1  = q9
data8 0x3f97105b4160f86b  // p8  = q2
data8 0xbfa6e10ba401393f  // p7  = q3
data8 0x3f522e5d33bc9baa  // p10 = q0
data8 0xbf7deaadaa336451  // p9  = q1
data8 0xbfc2473c5145ee38  // p3
data8 0x3fbc4f512b1865f5  // p4
data8 0x3fc9997e7afbff4e  // p2
data8 0x3ff921fb54442d18  // pi/2
LOCAL_OBJECT_END(atanf_coeff_1_table)



LOCAL_OBJECT_START(atanf_coeff_2_table)
data8 0x4035000000004284  // r1
data8 0x406cdffff336a59b  // r2
data8 0x3fbc4f512b1865f5  // p4 = q6
data8 0xbfc2473c5145ee38  // p3 = q7
data8 0x3fb142a73d7c54e3  // p6 = q4
data8 0xbfb68eed6a8cfa32  // p5 = q5
data8 0xbfb68eed6a8cfa32  // p5
data8 0x3fb142a73d7c54e3  // p6
data8 0xbfa6e10ba401393f  // p7
data8 0x3f97105b4160f86b  // p8
data8 0xbf7deaadaa336451  // p9
data8 0x3f522e5d33bc9baa  // p10
LOCAL_OBJECT_END(atanf_coeff_2_table)



.section .text
GLOBAL_LIBM_ENTRY(atanf)

{     .mfi
     alloc      r32                  = ar.pfs,1,2,0,0
     frcpa.s1  atanf_z,p0   =    f1,f8
     addl      EXP_Addr2           =    @ltoff(atanf_coeff_2_table),gp
}
{     .mfi
     addl      EXP_Addr1 =    @ltoff(atanf_coeff_1_table),gp
     fma.s1    atanf_t   =    f8,f8,f0
     nop.i                 999;;
}


{     .mfi
     nop.m                      999
     fmerge.s  atanf_sgn_x    =    f8,f1
     nop.i                      999;;
}

{     .mfi
     ld8       EXP_Addr1      =    [EXP_Addr1]
     fmerge.s  atanf_abs_x    =    f1,f8
     nop.i                      999
}
{     .mfi
     ld8       EXP_Addr2 =    [EXP_Addr2]
     nop.f                 999
     nop.i                 999;;
}


{     .mfi
     nop.m                      999
     fclass.m  p8,p0   =    f8,0x7	// @zero
     nop.i                      999;;
}

{     .mfi
     nop.m                      999
     fcmp.eq.unc.s0 p9,p10    =    f8,f1
     nop.i                      999;;
}

{     .mfi
     ldfpd     atanf_coeff_R4,atanf_coeff_R5 =    [EXP_Addr1],16
     fnma.s1   atanf_b                       =    f8,atanf_z,f1
     nop.i                                     999
}
{     .mfi
     ldfpd     atanf_coeff_R1,atanf_coeff_R2 =    [EXP_Addr2],16
     fma.s1    atanf_zsq                     =    atanf_z,atanf_z,f0
     nop.i                                     999;;
}


{     .mfi
     ldfpd     atanf_coeff_R3,atanf_coeff_P1 =    [EXP_Addr1],16
     fma.s1    atanf_xcub                    =    f8,atanf_t,f0
     nop.i                                     999
}
{     .mfi
     ldfpd     atanf_coeff_Q6,atanf_coeff_Q7 =    [EXP_Addr2],16
     fma.s1    atanf_tsq                     =    atanf_t,atanf_t,f0
     nop.i                                     999;;
}


{     .mfi
     ldfpd          atanf_coeff_Q8,atanf_coeff_Q9 =    [EXP_Addr1],16
//     fcmp.le.s1     atanf_pred_LE1,atanf_pred_GT1 =    atanf_abs_x,f1
     fcmp.le.s1     p6,p7 =    atanf_abs_x,f1
     nop.i                                          999
}
{     .mfi
     ldfpd     atanf_coeff_Q4,atanf_coeff_Q5 =    [EXP_Addr2],16
     nop.f                                     999
     nop.i                                     999;;
}


{     .mfi
     ldfpd     atanf_coeff_Q2,atanf_coeff_Q3 =    [EXP_Addr1],16
     fclass.m  p8,p0                  =    f8,0xe7	// @inf|@qnan|@snan|@zero
     nop.i                                     999
}
{     .mfi
     ldfpd     atanf_coeff_P5,atanf_coeff_P6 =    [EXP_Addr2],16
     nop.f                                     999
     nop.i                                     999;;
}


{     .mfi
     ldfpd     atanf_coeff_Q0,atanf_coeff_Q1 =    [EXP_Addr1],16
     nop.f                                     999
     nop.i                                     999
}
{     .mfi
     ldfpd     atanf_coeff_P7,atanf_coeff_P8 =    [EXP_Addr2],16
     nop.f                                     999
     nop.i                                     999;;
}


{     .mfi
     ldfpd     atanf_coeff_P3,atanf_coeff_P4 =    [EXP_Addr1],16
     fma.s1    atanf_bsq                     =    atanf_b,atanf_b,f0
     nop.i                                     999
}
{     .mfi
     ldfpd     atanf_coeff_P9,atanf_coeff_P10     =    [EXP_Addr2]
     fma.s1    atanf_z4                           =    atanf_zsq,atanf_zsq,f0
     nop.i                                          999;;
}


{     .mfi
     ldfpd     atanf_coeff_P2,atanf_piby2    =    [EXP_Addr1]
     fma.s1    atanf_x6                      =    atanf_t,atanf_tsq,f0
     nop.i                                     999
}
{     .mfi
     nop.m                 999
     fma.s1    atanf_t4  =    atanf_tsq,atanf_tsq,f0
     nop.i                 999;;
}


{     .mfb
     nop.m                 999
     fma.s1    atanf_x5  =    atanf_t,atanf_xcub,f0
(p8)  br.cond.spnt   ATANF_X_INF_NAN_ZERO
}
;;

{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r1  =    atanf_b,atanf_coeff_R1,f1
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r3  =    atanf_b,atanf_coeff_R5,atanf_coeff_R4
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r2  =    atanf_b,atanf_coeff_R3,atanf_coeff_R2
     nop.i                      999
}
{     .mfi
     nop.m                 999
     fma.s1    atanf_z8  =    atanf_z4,atanf_z4,f0
     nop.i                 999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q2  =    atanf_t,atanf_coeff_Q5,atanf_coeff_Q4
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q3  =    atanf_t,atanf_coeff_Q7,atanf_coeff_Q6
     nop.i                      999;;
}


{     .mfi
     nop.m                 999
     fma.s1    atanf_z5  =    atanf_z,atanf_z4,f0
     nop.i                 999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q1  =    atanf_t,atanf_coeff_Q9,atanf_coeff_Q8
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q4  =    atanf_t,atanf_coeff_Q1,atanf_coeff_Q0
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q5  =    atanf_t,atanf_coeff_Q3,atanf_coeff_Q2
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p4  =    f8,atanf_coeff_P1,f0
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p5  =    atanf_t,atanf_coeff_P4,atanf_coeff_P3
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r1  =    atanf_z8,atanf_poly_r1,f0
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_z8_bsq   =    atanf_z8,atanf_bsq,f0
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q2  =    atanf_tsq,atanf_poly_q3,atanf_poly_q2
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r2  =    atanf_bsq,atanf_poly_r3,atanf_poly_r2
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p2  =    atanf_t,atanf_coeff_P8,atanf_coeff_P7
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q1  =    atanf_poly_q1,f1,atanf_tsq
     nop.i                      999;;
}


{     .mfi
     nop.m                 999
     fma.s1    atanf_z13 =    atanf_z5,atanf_z8,f0
     nop.i                 999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p1  =    atanf_t,atanf_coeff_P10,atanf_coeff_P9
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p4  =    atanf_t,atanf_poly_p4,f8
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q4  =    atanf_tsq,atanf_poly_q5,atanf_poly_q4
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p3  =    atanf_t,atanf_coeff_P6,atanf_coeff_P5
     nop.i                      999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p5  =    atanf_t,atanf_poly_p5,atanf_coeff_P2
     nop.i                      999;;
}


{     .mfi
     nop.m                 999
     fma.s1    atanf_x11 =    atanf_x5,atanf_x6,f0
     nop.i                 999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_r   =    atanf_z8_bsq,atanf_poly_r2,atanf_poly_r1
     nop.i                      999;;
}


{     .mfi
     nop.m                           999
     fma.s0       atanf_sgnx_piby2    =    atanf_sgn_x,atanf_piby2,f0
     nop.i                           999
}
{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q2  =    atanf_t4,atanf_poly_q1,atanf_poly_q2
     nop.i                      999;;
}


{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p2
     nop.i                      999;;
}

{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p4  =    atanf_x5,atanf_poly_p5,atanf_poly_p4
     nop.i                      999;;
}

{     .mfi
     nop.m                           999
     fma.s1    atanf_z21_poly_r    =    atanf_z13,atanf_poly_r,f0
     nop.i                           999;;
}

{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_q   =    atanf_t4,atanf_poly_q2,atanf_poly_q4
     nop.i                      999;;
}

{     .mfi
     nop.m                      999
     fma.s1    atanf_poly_p1  =    atanf_tsq,atanf_poly_p1,atanf_poly_p3
     nop.i                      999;;
}

{     .mfi
                    nop.m                      999
//(atanf_pred_GT1)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
(p7)    fnma.s.s0    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
                    nop.i                      999;;
}

{     .mfb
                    nop.m                      999
//(atanf_pred_LE1)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
(p6)    fma.s.s0     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
                    br.ret.sptk b0
}



ATANF_X_INF_NAN_ZERO:

{ .mfi
      nop.m 0
      fclass.m p8,p9 = f8,0x23  // @inf
      nop.i 0
}
;;
{ .mfi
      nop.m 0
(p8)  fmerge.s f8 = f8, atanf_piby2
      nop.i 0
}
;;
{ .mfb
      nop.m 0
      fnorm.s.s0 f8 = f8
      br.ret.sptk b0
}
;;

GLOBAL_LIBM_END(atanf)