summaryrefslogtreecommitdiffstats
path: root/lib/msun
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2012-09-16 16:58:49 +0000
committertijl <tijl@FreeBSD.org>2012-09-16 16:58:49 +0000
commit19adcfe7704745bb790acd5875fa7d90522d4c7b (patch)
tree69cbb1f1594d19c75250a1ecc2a0559b8892a72b /lib/msun
parentfdc252682f645da4c9ac5c2f221a18bb7f124bda (diff)
downloadFreeBSD-src-19adcfe7704745bb790acd5875fa7d90522d4c7b.zip
FreeBSD-src-19adcfe7704745bb790acd5875fa7d90522d4c7b.tar.gz
Optimise i387 trigonometric functions. Replace "andw 0x400,%ax \ jnz" with
"sahf \ jp", "fprem1" with "fprem" and "fstsw %ax" with "fnstsw %ax".
Diffstat (limited to 'lib/msun')
-rw-r--r--lib/msun/i387/s_cos.S10
-rw-r--r--lib/msun/i387/s_sin.S10
-rw-r--r--lib/msun/i387/s_tan.S12
3 files changed, 16 insertions, 16 deletions
diff --git a/lib/msun/i387/s_cos.S b/lib/msun/i387/s_cos.S
index 9c3f2ca..9951ab0 100644
--- a/lib/msun/i387/s_cos.S
+++ b/lib/msun/i387/s_cos.S
@@ -40,16 +40,16 @@ ENTRY(cos)
fldl 4(%esp)
fcos
fnstsw %ax
- andw $0x400,%ax
- jnz 1f
+ sahf
+ jp 1f
ret
1: fldpi
fadd %st(0)
fxch %st(1)
-2: fprem1
+2: fprem
fnstsw %ax
- andw $0x400,%ax
- jnz 2b
+ sahf
+ jp 2b
fstp %st(1)
fcos
ret
diff --git a/lib/msun/i387/s_sin.S b/lib/msun/i387/s_sin.S
index 11c4d63..eb04754 100644
--- a/lib/msun/i387/s_sin.S
+++ b/lib/msun/i387/s_sin.S
@@ -40,16 +40,16 @@ ENTRY(sin)
fldl 4(%esp)
fsin
fnstsw %ax
- andw $0x400,%ax
- jnz 1f
+ sahf
+ jp 1f
ret
1: fldpi
fadd %st(0)
fxch %st(1)
-2: fprem1
+2: fprem
fnstsw %ax
- andw $0x400,%ax
- jnz 2b
+ sahf
+ jp 2b
fstp %st(1)
fsin
ret
diff --git a/lib/msun/i387/s_tan.S b/lib/msun/i387/s_tan.S
index e31ebdf..182b9f7 100644
--- a/lib/msun/i387/s_tan.S
+++ b/lib/msun/i387/s_tan.S
@@ -40,17 +40,17 @@ ENTRY(tan)
fldl 4(%esp)
fptan
fnstsw %ax
- andw $0x400,%ax
- jnz 1f
+ sahf
+ jp 1f
fstp %st(0)
ret
1: fldpi
fadd %st(0)
fxch %st(1)
-2: fprem1
- fstsw %ax
- andw $0x400,%ax
- jnz 2b
+2: fprem
+ fnstsw %ax
+ sahf
+ jp 2b
fstp %st(1)
fptan
fstp %st(0)
OpenPOWER on IntegriCloud