Fix asin missing underflows (bug 16351).
[glibc.git] / sysdeps / i386 / fpu / e_asinf.S
blobf7bda77fa60a1d51644caa67a7c6ef6bba275264
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Public domain.
4  * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>.
5  */
7 #include <machine/asm.h>
9 RCSID("$NetBSD: $")
11         .section .rodata.cst4,"aM",@progbits,4
13         .p2align 2
14         .type flt_min,@object
15 flt_min:        .byte 0, 0, 0x80, 0
16         ASM_SIZE_DIRECTIVE(flt_min)
18 #ifdef PIC
19 # define MO(op) op##@GOTOFF(%ecx)
20 #else
21 # define MO(op) op
22 #endif
24         .text
26 /* asin = atan (x / sqrt(1 - x^2)) */
27 ENTRY(__ieee754_asinf)
28 #ifdef  PIC
29         LOAD_PIC_REG (cx)
30 #endif
31         flds    4(%esp)                 /* x */
32         fld     %st
33         fmul    %st(0)                  /* x^2 */
34         fld1
35         fsubp                           /* 1 - x^2 */
36         fsqrt                           /* sqrt (1 - x^2) */
37         fpatan
38         flds    MO(flt_min)
39         fld     %st(1)
40         fabs
41         fucompp
42         fnstsw
43         sahf
44         jnc     1f
45         subl    $4, %esp
46         cfi_adjust_cfa_offset (4)
47         fld     %st(0)
48         fmul    %st(0)
49         fstps   (%esp)
50         addl    $4, %esp
51         cfi_adjust_cfa_offset (-4)
52 1:      ret
53 END (__ieee754_asinf)
54 strong_alias (__ieee754_asinf, __asinf_finite)