]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/x86_64/fpu/e_ilogbl.S
x86-64: Add vector log1p/log1pf implementation to libmvec
[thirdparty/glibc.git] / sysdeps / x86_64 / fpu / e_ilogbl.S
1 /*
2 * Public domain.
3 */
4
5 #include <machine/asm.h>
6
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. */
20
21 fxtract
22 fstp %st
23
24 fistpl -4(%rsp)
25 fwait
26 movl -4(%rsp),%eax
27
28 ret
29
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)