From 19adcfe7704745bb790acd5875fa7d90522d4c7b Mon Sep 17 00:00:00 2001 From: tijl Date: Sun, 16 Sep 2012 16:58:49 +0000 Subject: [PATCH] Optimise i387 trigonometric functions. Replace "andw 0x400,%ax \ jnz" with "sahf \ jp", "fprem1" with "fprem" and "fstsw %ax" with "fnstsw %ax". --- lib/msun/i387/s_cos.S | 10 +++++----- lib/msun/i387/s_sin.S | 10 +++++----- lib/msun/i387/s_tan.S | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/msun/i387/s_cos.S b/lib/msun/i387/s_cos.S index 9c3f2caac73b..9951ab0674aa 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 11c4d63bbb75..eb047540d736 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 e31ebdff00a3..182b9f76459e 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)