math: use fnstsw consistently instead of fstsw in x87 asm
authorSzabolcs Nagy <nsz@port70.net>
Wed, 5 Nov 2014 21:13:58 +0000 (22:13 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Wed, 5 Nov 2014 21:13:58 +0000 (22:13 +0100)
fnstsw does not wait for pending unmasked x87 floating-point exceptions
and it is the same as fstsw when all exceptions are masked which is the
only environment libc supports.

src/math/i386/fmod.s
src/math/i386/fmodf.s
src/math/i386/fmodl.s
src/math/i386/remainder.s
src/math/i386/remainderf.s
src/math/i386/remainderl.s
src/math/i386/sqrt.s
src/math/x32/fmodl.s
src/math/x32/remainderl.s
src/math/x86_64/fmodl.s
src/math/x86_64/remainderl.s

index 069fbfe..2113b3c 100644 (file)
@@ -4,7 +4,7 @@ fmod:
        fldl 12(%esp)
        fldl 4(%esp)
 1:     fprem
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index d99c80f..e04e2a5 100644 (file)
@@ -4,7 +4,7 @@ fmodf:
        flds 8(%esp)
        flds 4(%esp)
 1:     fprem
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index 7e07e7b..0cb3fe9 100644 (file)
@@ -4,7 +4,7 @@ fmodl:
        fldt 16(%esp)
        fldt 4(%esp)
 1:     fprem
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index 7f4be05..ab1da95 100644 (file)
@@ -7,7 +7,7 @@ drem:
        fldl 12(%esp)
        fldl 4(%esp)
 1:     fprem1
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index ac6e367..6a7378a 100644 (file)
@@ -7,7 +7,7 @@ dremf:
        flds 8(%esp)
        flds 4(%esp)
 1:     fprem1
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index 0097872..b41518e 100644 (file)
@@ -4,7 +4,7 @@ remainderl:
        fldt 16(%esp)
        fldt 4(%esp)
 1:     fprem1
-       fstsw %ax
+       fnstsw %ax
        sahf
        jp 1b
        fstp %st(1)
index 8289d09..57837e2 100644 (file)
@@ -2,7 +2,7 @@
 .type sqrt,@function
 sqrt:  fldl 4(%esp)
        fsqrt
-       fstsw %ax
+       fnstsw %ax
        sub $12,%esp
        fld %st(0)
        fstpt (%esp)
index b951320..c3f790c 100644 (file)
@@ -4,7 +4,7 @@ fmodl:
        fldt 24(%esp)
        fldt 8(%esp)
 1:     fprem
-       fstsw %ax
+       fnstsw %ax
        testb $4,%ah
        jnz 1b
        fstp %st(1)
index 79bf4fe..376ba0e 100644 (file)
@@ -4,7 +4,7 @@ remainderl:
        fldt 24(%esp)
        fldt 8(%esp)
 1:     fprem1
-       fstsw %ax
+       fnstsw %ax
        testb $4,%ah
        jnz 1b
        fstp %st(1)
index cd8d2b7..ea07b40 100644 (file)
@@ -4,7 +4,7 @@ fmodl:
        fldt 24(%rsp)
        fldt 8(%rsp)
 1:     fprem
-       fstsw %ax
+       fnstsw %ax
        testb $4,%ah
        jnz 1b
        fstp %st(1)
index 2c337cf..cb3857b 100644 (file)
@@ -4,7 +4,7 @@ remainderl:
        fldt 24(%rsp)
        fldt 8(%rsp)
 1:     fprem1
-       fstsw %ax
+       fnstsw %ax
        testb $4,%ah
        jnz 1b
        fstp %st(1)