Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / i386 / fpu / e_ilogbl.S
blob60761dfa38b22c6e8103867f47441de65cb97a16
1 /*
2  * Written by J.T. Conklin <jtc@netbsd.org>.
3  * Changes for long double by Ulrich Drepper <drepper@cygnus.com>
4  * Public domain.
5  */
7 #include <machine/asm.h>
9 RCSID("$NetBSD: $")
11 ENTRY(__ieee754_ilogbl)
12         fldt    4(%esp)
13 /* I added the following ugly construct because ilogb(+-Inf) is
14    required to return INT_MAX in ISO C99.
15    -- jakub@redhat.com.  */
16         fxam                    /* Is NaN or +-Inf?  */
17         fstsw   %ax
18         movb    $0x45, %dh
19         andb    %ah, %dh
20         cmpb    $0x05, %dh
21         je      1f              /* Is +-Inf, jump.  */
22         cmpb    $0x40, %dh
23         je      2f              /* Is +-0, jump.  */
25         fxtract
26         pushl   %eax
27         cfi_adjust_cfa_offset (4)
28         fstp    %st
30         fistpl  (%esp)
31         fwait
32         popl    %eax
33         cfi_adjust_cfa_offset (-4)
35         ret
37 1:      fstp    %st
38         movl    $0x7fffffff, %eax
39         ret
40 2:      fstp    %st
41         movl    $0x80000000, %eax       /* FP_ILOGB0  */
42         ret
43 END (__ieee754_ilogbl)