Optimise i387 trigonometric functions. Replace "andw 0x400,%ax \ jnz" with

"sahf \ jp", "fprem1" with "fprem" and "fstsw %ax" with "fnstsw %ax".
This commit is contained in:
Tijl Coosemans 2012-09-16 16:58:49 +00:00
parent 65e415b16e
commit 71dad5d6ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240566
3 changed files with 16 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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)