riscv: align .preinit_array (bug 32228)
[glibc.git] / sysdeps / i386 / fpu / e_ilogbl.S
blobd9f030d31ece110023877763bfb95439cd9cdc75
1 /*
2  * Public domain.
3  */
5 #include <machine/asm.h>
7 RCSID("$NetBSD: $")
9 ENTRY(__ieee754_ilogbl)
10         fldt    4(%esp)
11 /* I added the following ugly construct because ilogb(+-Inf) is
12    required to return INT_MAX in ISO C99.
13    -- jakub@redhat.com.  */
14         fxam                    /* Is NaN or +-Inf?  */
15         fstsw   %ax
16         movb    $0x45, %dh
17         andb    %ah, %dh
18         cmpb    $0x05, %dh
19         je      1f              /* Is +-Inf, jump.  */
20         cmpb    $0x40, %dh
21         je      2f              /* Is +-0, jump.  */
23         fxtract
24         pushl   %eax
25         cfi_adjust_cfa_offset (4)
26         fstp    %st
28         fistpl  (%esp)
29         fwait
30         popl    %eax
31         cfi_adjust_cfa_offset (-4)
33         ret
35 1:      fstp    %st
36         movl    $0x7fffffff, %eax
37         ret
38 2:      fstp    %st
39         movl    $0x80000000, %eax       /* FP_ILOGB0  */
40         ret
41 END (__ieee754_ilogbl)