diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/fpu/s_ceil.S | 12 | ||||
-rw-r--r-- | sysdeps/i386/fpu/s_ceilf.S | 12 | ||||
-rw-r--r-- | sysdeps/i386/fpu/s_ceill.S | 17 | ||||
-rw-r--r-- | sysdeps/x86_64/fpu/s_ceill.S | 15 |
4 files changed, 33 insertions, 23 deletions
diff --git a/sysdeps/i386/fpu/s_ceil.S b/sysdeps/i386/fpu/s_ceil.S index f32fa26d34..1226bb2f87 100644 --- a/sysdeps/i386/fpu/s_ceil.S +++ b/sysdeps/i386/fpu/s_ceil.S @@ -9,10 +9,10 @@ RCSID("$NetBSD: s_ceil.S,v 1.4 1995/05/08 23:52:13 jtc Exp $") ENTRY(__ceil) fldl 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 @@ -25,10 +25,10 @@ ENTRY(__ceil) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__ceil) weak_alias (__ceil, ceil) diff --git a/sysdeps/i386/fpu/s_ceilf.S b/sysdeps/i386/fpu/s_ceilf.S index 4fe703b179..d345c0973b 100644 --- a/sysdeps/i386/fpu/s_ceilf.S +++ b/sysdeps/i386/fpu/s_ceilf.S @@ -9,10 +9,10 @@ RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") ENTRY(__ceilf) flds 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 @@ -25,10 +25,10 @@ ENTRY(__ceilf) frndint /* round */ - fldcw 4(%esp) /* restore original control word */ + fldenv 4(%esp) /* restore original environment */ - addl $8,%esp - cfi_adjust_cfa_offset (-8) + addl $32,%esp + cfi_adjust_cfa_offset (-32) ret END (__ceilf) weak_alias (__ceilf, ceilf) diff --git a/sysdeps/i386/fpu/s_ceill.S b/sysdeps/i386/fpu/s_ceill.S index 4b272c522a..7c08f43b24 100644 --- a/sysdeps/i386/fpu/s_ceill.S +++ b/sysdeps/i386/fpu/s_ceill.S @@ -10,10 +10,10 @@ 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 +26,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) diff --git a/sysdeps/x86_64/fpu/s_ceill.S b/sysdeps/x86_64/fpu/s_ceill.S index 910c371d58..9d8b79dbee 100644 --- a/sysdeps/x86_64/fpu/s_ceill.S +++ b/sysdeps/x86_64/fpu/s_ceill.S @@ -11,20 +11,25 @@ ENTRY(__ceill) fldt 8(%rsp) - fstcw -4(%rsp) /* store fpu control word */ + fnstenv -28(%rsp) /* 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 than the 16 bit operations. */ movl $0x0800,%edx /* round towards +oo */ - orl -4(%rsp),%edx + orl -28(%rsp),%edx andl $0xfbff,%edx - movl %edx,-8(%rsp) - fldcw -8(%rsp) /* load modified control word */ + movl %edx,-32(%rsp) + fldcw -32(%rsp) /* load modified control word */ frndint /* round */ - fldcw -4(%rsp) /* restore original control word */ + /* Preserve "invalid" exceptions from sNaN input. */ + fnstsw + andl $0x1, %eax + orl %eax, -24(%rsp) + + fldenv -28(%rsp) /* restore original environment */ ret END (__ceill) |