aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0006-math-use-fnstsw-consistently-instead-of-fstsw-in-x87.patch
blob: 2bd9dcd55625e8e17980df195e8db56fda134d77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
From ec4318943a26d4bd4050481d11709853184f2794 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 5 Nov 2014 22:13:58 +0100
Subject: [PATCH] math: use fnstsw consistently instead of fstsw in x87 asm

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         | 2 +-
 src/math/i386/fmodf.s        | 2 +-
 src/math/i386/fmodl.s        | 2 +-
 src/math/i386/remainder.s    | 2 +-
 src/math/i386/remainderf.s   | 2 +-
 src/math/i386/remainderl.s   | 2 +-
 src/math/i386/sqrt.s         | 2 +-
 src/math/x32/fmodl.s         | 2 +-
 src/math/x32/remainderl.s    | 2 +-
 src/math/x86_64/fmodl.s      | 2 +-
 src/math/x86_64/remainderl.s | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/math/i386/fmod.s b/src/math/i386/fmod.s
index 069fbfe..2113b3c 100644
--- a/src/math/i386/fmod.s
+++ b/src/math/i386/fmod.s
@@ -4,7 +4,7 @@ fmod:
 	fldl 12(%esp)
 	fldl 4(%esp)
 1:	fprem
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/fmodf.s b/src/math/i386/fmodf.s
index d99c80f..e04e2a5 100644
--- a/src/math/i386/fmodf.s
+++ b/src/math/i386/fmodf.s
@@ -4,7 +4,7 @@ fmodf:
 	flds 8(%esp)
 	flds 4(%esp)
 1:	fprem
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/fmodl.s b/src/math/i386/fmodl.s
index 7e07e7b..0cb3fe9 100644
--- a/src/math/i386/fmodl.s
+++ b/src/math/i386/fmodl.s
@@ -4,7 +4,7 @@ fmodl:
 	fldt 16(%esp)
 	fldt 4(%esp)
 1:	fprem
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/remainder.s b/src/math/i386/remainder.s
index 7f4be05..ab1da95 100644
--- a/src/math/i386/remainder.s
+++ b/src/math/i386/remainder.s
@@ -7,7 +7,7 @@ drem:
 	fldl 12(%esp)
 	fldl 4(%esp)
 1:	fprem1
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/remainderf.s b/src/math/i386/remainderf.s
index ac6e367..6a7378a 100644
--- a/src/math/i386/remainderf.s
+++ b/src/math/i386/remainderf.s
@@ -7,7 +7,7 @@ dremf:
 	flds 8(%esp)
 	flds 4(%esp)
 1:	fprem1
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/remainderl.s b/src/math/i386/remainderl.s
index 0097872..b41518e 100644
--- a/src/math/i386/remainderl.s
+++ b/src/math/i386/remainderl.s
@@ -4,7 +4,7 @@ remainderl:
 	fldt 16(%esp)
 	fldt 4(%esp)
 1:	fprem1
-	fstsw %ax
+	fnstsw %ax
 	sahf
 	jp 1b
 	fstp %st(1)
diff --git a/src/math/i386/sqrt.s b/src/math/i386/sqrt.s
index 8289d09..57837e2 100644
--- a/src/math/i386/sqrt.s
+++ b/src/math/i386/sqrt.s
@@ -2,7 +2,7 @@
 .type sqrt,@function
 sqrt:	fldl 4(%esp)
 	fsqrt
-	fstsw %ax
+	fnstsw %ax
 	sub $12,%esp
 	fld %st(0)
 	fstpt (%esp)
diff --git a/src/math/x32/fmodl.s b/src/math/x32/fmodl.s
index b951320..c3f790c 100644
--- a/src/math/x32/fmodl.s
+++ b/src/math/x32/fmodl.s
@@ -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)
diff --git a/src/math/x32/remainderl.s b/src/math/x32/remainderl.s
index 79bf4fe..376ba0e 100644
--- a/src/math/x32/remainderl.s
+++ b/src/math/x32/remainderl.s
@@ -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)
diff --git a/src/math/x86_64/fmodl.s b/src/math/x86_64/fmodl.s
index cd8d2b7..ea07b40 100644
--- a/src/math/x86_64/fmodl.s
+++ b/src/math/x86_64/fmodl.s
@@ -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)
diff --git a/src/math/x86_64/remainderl.s b/src/math/x86_64/remainderl.s
index 2c337cf..cb3857b 100644
--- a/src/math/x86_64/remainderl.s
+++ b/src/math/x86_64/remainderl.s
@@ -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)
-- 
2.2.0