mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Return the same result as the MI version for 0.0, INFINITY and NaN.
Reviewed by: standards@
This commit is contained in:
parent
83bc89312c
commit
b6161bb16a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130714
@ -33,10 +33,15 @@
|
||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||
*/
|
||||
|
||||
#include <machine/_limits.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$FreeBSD$")
|
||||
|
||||
#define FP_ILOGB0 (-__INT_MAX)
|
||||
#define FP_ILOGBNAN __INT_MAX
|
||||
#define FP_ILOGBINF __INT_MAX
|
||||
|
||||
ENTRY(ilogb)
|
||||
pushl %ebp
|
||||
movl %esp,%ebp
|
||||
@ -44,10 +49,35 @@ ENTRY(ilogb)
|
||||
|
||||
fldl 8(%ebp)
|
||||
fxtract
|
||||
fstp %st
|
||||
fstp %st(0)
|
||||
|
||||
fistpl -4(%ebp)
|
||||
movl -4(%ebp),%eax
|
||||
|
||||
/* fistpl yields __INT_MIN for NaN, Inf and 0. */
|
||||
cmpl $__INT_MIN,%eax
|
||||
je .L2
|
||||
|
||||
.L1:
|
||||
leave
|
||||
ret
|
||||
|
||||
.L2:
|
||||
fldl 8(%ebp)
|
||||
fldz
|
||||
fucompp
|
||||
fnstsw %ax
|
||||
sahf
|
||||
jp .L3
|
||||
jz .L4
|
||||
|
||||
movl $FP_ILOGBINF,%eax
|
||||
jmp .L1
|
||||
|
||||
.L3:
|
||||
movl $FP_ILOGBNAN,%eax
|
||||
jmp .L1
|
||||
|
||||
.L4:
|
||||
movl $FP_ILOGB0,%eax
|
||||
jmp .L1
|
||||
|
Loading…
Reference in New Issue
Block a user