svn commit: r240566 - head/lib/msun/i387
Tijl Coosemans
tijl at FreeBSD.org
Sun Sep 16 16:58:50 UTC 2012
Author: tijl
Date: Sun Sep 16 16:58:49 2012
New Revision: 240566
URL: http://svn.freebsd.org/changeset/base/240566
Log:
Optimise i387 trigonometric functions. Replace "andw 0x400,%ax \ jnz" with
"sahf \ jp", "fprem1" with "fprem" and "fstsw %ax" with "fnstsw %ax".
Modified:
head/lib/msun/i387/s_cos.S
head/lib/msun/i387/s_sin.S
head/lib/msun/i387/s_tan.S
Modified: head/lib/msun/i387/s_cos.S
==============================================================================
--- head/lib/msun/i387/s_cos.S Sun Sep 16 16:08:20 2012 (r240565)
+++ head/lib/msun/i387/s_cos.S Sun Sep 16 16:58:49 2012 (r240566)
@@ -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
Modified: head/lib/msun/i387/s_sin.S
==============================================================================
--- head/lib/msun/i387/s_sin.S Sun Sep 16 16:08:20 2012 (r240565)
+++ head/lib/msun/i387/s_sin.S Sun Sep 16 16:58:49 2012 (r240566)
@@ -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
Modified: head/lib/msun/i387/s_tan.S
==============================================================================
--- head/lib/msun/i387/s_tan.S Sun Sep 16 16:08:20 2012 (r240565)
+++ head/lib/msun/i387/s_tan.S Sun Sep 16 16:58:49 2012 (r240566)
@@ -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)
More information about the svn-src-all
mailing list