From 2642403d5b51f4c3738bf2c6190dec447e644674 Mon Sep 17 00:00:00 2001 From: sergei Date: Tue, 13 Dec 2011 20:21:22 +0000 Subject: [PATCH] * float_raise: Reduce amount of threadvar accesses, gains a bit more compact code. Functionality is not changed. git-svn-id: trunk@19846 - --- rtl/inc/genmath.inc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/rtl/inc/genmath.inc b/rtl/inc/genmath.inc index fd3d7c3dcf..f2491d4826 100644 --- a/rtl/inc/genmath.inc +++ b/rtl/inc/genmath.inc @@ -100,21 +100,27 @@ should be simply `softfloat_exception_flags |= flags;'. ------------------------------------------------------------------------------- *} procedure float_raise(i: shortint); +var + pflags: pbyte; + unmasked_flags: byte; Begin - softfloat_exception_flags := softfloat_exception_flags or i; - if ((softfloat_exception_flags and not(softfloat_exception_mask)) and float_flag_invalid) <> 0 then + { taking address of threadvar produces somewhat more compact code } + pflags := @softfloat_exception_flags; + pflags^ := pflags^ or i; + unmasked_flags := pflags^ and (not softfloat_exception_mask); + if (unmasked_flags and float_flag_invalid) <> 0 then HandleError(207) else - if ((softfloat_exception_flags and not(softfloat_exception_mask)) and float_flag_divbyzero) <> 0 then + if (unmasked_flags and float_flag_divbyzero) <> 0 then HandleError(200) else - if ((softfloat_exception_flags and not(softfloat_exception_mask)) and float_flag_overflow) <> 0 then + if (unmasked_flags and float_flag_overflow) <> 0 then HandleError(205) else - if ((softfloat_exception_flags and not(softfloat_exception_mask)) and float_flag_underflow) <> 0 then + if (unmasked_flags and float_flag_underflow) <> 0 then HandleError(206) else - if ((softfloat_exception_flags and not(softfloat_exception_mask)) and float_flag_inexact) <> 0 then + if (unmasked_flags and float_flag_inexact) <> 0 then HandleError(207); end;