From 8c245bf2725f3171ee8f58dab7169e5d682de026 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 5 Nov 2014 21:40:29 +0100 Subject: math: fix x86_64 and x32 asm not to use sahf instruction Some early x86_64 cpus (released before 2006) did not support sahf/lahf instructions so they should be avoided (intel manual says they are only supported if CPUID.80000001H:ECX.LAHF-SAHF[bit 0] = 1). The workaround simplifies exp2l and expm1l because fucomip can be used instead of the fucomp;fnstsw;sahf sequence copied from i386. In fmodl and remainderl sahf is replaced by a simple bit test. (cherry picked from commit a732e80d33b4fd6f510f7cec4f5573ef5d89bc4e) --- src/math/x32/fmodl.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/math/x32/fmodl.s') diff --git a/src/math/x32/fmodl.s b/src/math/x32/fmodl.s index 9e4378ab..b9513204 100644 --- a/src/math/x32/fmodl.s +++ b/src/math/x32/fmodl.s @@ -5,7 +5,7 @@ fmodl: fldt 8(%esp) 1: fprem fstsw %ax - sahf - jp 1b + testb $4,%ah + jnz 1b fstp %st(1) ret -- cgit v1.2.1