summaryrefslogtreecommitdiff
path: root/sysdeps/i386/fpu/s_ceill.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/s_ceill.S')
-rw-r--r--sysdeps/i386/fpu/s_ceill.S20
1 files changed, 13 insertions, 7 deletions
diff --git a/sysdeps/i386/fpu/s_ceill.S b/sysdeps/i386/fpu/s_ceill.S
index 4b272c522a..70d5c6ce0c 100644
--- a/sysdeps/i386/fpu/s_ceill.S
+++ b/sysdeps/i386/fpu/s_ceill.S
@@ -4,16 +4,17 @@
* Public domain.
*/
+#include <libm-alias-ldouble.h>
#include <machine/asm.h>
RCSID("$NetBSD: $")
ENTRY(__ceill)
fldt 4(%esp)
- subl $8,%esp
- cfi_adjust_cfa_offset (8)
+ subl $32,%esp
+ cfi_adjust_cfa_offset (32)
- fstcw 4(%esp) /* store fpu control word */
+ fnstenv 4(%esp) /* store fpu environment */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
@@ -26,10 +27,15 @@ ENTRY(__ceill)
frndint /* round */
- fldcw 4(%esp) /* restore original control word */
+ /* Preserve "invalid" exceptions from sNaN input. */
+ fnstsw
+ andl $0x1, %eax
+ orl %eax, 8(%esp)
- addl $8,%esp
- cfi_adjust_cfa_offset (-8)
+ fldenv 4(%esp) /* restore original environment */
+
+ addl $32,%esp
+ cfi_adjust_cfa_offset (-32)
ret
END (__ceill)
-weak_alias (__ceill, ceill)
+libm_alias_ldouble (__ceil, ceil)