build-many-glibcs.py: Add openrisc hard float glibc variant
[glibc.git] / sysdeps / x86_64 / fpu / e_ilogbl.S
blob174647344dd4a87bd4e544d2f89d2e6187955481
1 /*
2  * Public domain.
3  */
5 #include <machine/asm.h>
7 ENTRY(__ieee754_ilogbl)
8         fldt    8(%rsp)
9 /* I added the following ugly construct because ilogb(+-Inf) is
10    required to return INT_MAX in ISO C99.
11    -- jakub@redhat.com.  */
12         fxam                    /* Is NaN or +-Inf?  */
13         fstsw   %ax
14         movb    $0x45, %dh
15         andb    %ah, %dh
16         cmpb    $0x05, %dh
17         je      1f              /* Is +-Inf, jump.  */
18         cmpb    $0x40, %dh
19         je      2f              /* Is +-Inf, jump.  */
21         fxtract
22         fstp    %st
24         fistpl  -4(%rsp)
25         fwait
26         movl    -4(%rsp),%eax
28         ret
30 1:      fstp    %st
31         movl    $0x7fffffff, %eax
32         ret
33 2:      fstp    %st
34         movl    $0x80000000, %eax       /* FP_ILOGB0  */
35         ret
36 END (__ieee754_ilogbl)