Blame sysdeps/x86_64/fpu/e_ilogbl.S
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
Packit |
6c4009 |
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
|
|
Packit |
6c4009 |
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
|
Packit |
6c4009 |
* Public domain.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <machine/asm.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ENTRY(__ieee754_ilogbl)
|
|
Packit |
6c4009 |
fldt 8(%rsp)
|
|
Packit |
6c4009 |
/* I added the following ugly construct because ilogb(+-Inf) is
|
|
Packit |
6c4009 |
required to return INT_MAX in ISO C99.
|
|
Packit |
6c4009 |
-- jakub@redhat.com. */
|
|
Packit |
6c4009 |
fxam /* Is NaN or +-Inf? */
|
|
Packit |
6c4009 |
fstsw %ax
|
|
Packit |
6c4009 |
movb $0x45, %dh
|
|
Packit |
6c4009 |
andb %ah, %dh
|
|
Packit |
6c4009 |
cmpb $0x05, %dh
|
|
Packit |
6c4009 |
je 1f /* Is +-Inf, jump. */
|
|
Packit |
6c4009 |
cmpb $0x40, %dh
|
|
Packit |
6c4009 |
je 2f /* Is +-Inf, jump. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
fxtract
|
|
Packit |
6c4009 |
fstp %st
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
fistpl -4(%rsp)
|
|
Packit |
6c4009 |
fwait
|
|
Packit |
6c4009 |
movl -4(%rsp),%eax
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
1: fstp %st
|
|
Packit |
6c4009 |
movl $0x7fffffff, %eax
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
2: fstp %st
|
|
Packit |
6c4009 |
movl $0x80000000, %eax /* FP_ILOGB0 */
|
|
Packit |
6c4009 |
ret
|
|
Packit |
6c4009 |
END (__ieee754_ilogbl)
|