summaryrefslogtreecommitdiff
path: root/fpu
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-01-14 20:39:18 +0100
committerAurelien Jarno <aurelien@aurel32.net>2011-01-14 20:39:18 +0100
commita16784a5bdda4b63087bc4a54136f9a7c20c4204 (patch)
tree722a152d19451b6280bdd05cb3309284ababf6f8 /fpu
parente89d01fe3bba6eb34a53971bddbc7bde9ff790e0 (diff)
downloadqemu-a16784a5bdda4b63087bc4a54136f9a7c20c4204.tar.gz
qemu-a16784a5bdda4b63087bc4a54136f9a7c20c4204.tar.bz2
qemu-a16784a5bdda4b63087bc4a54136f9a7c20c4204.zip
softfloat: Add float32_is_zero_or_denormal() function
Add a utility function to softfloat to test whether a float32 is zero or denormal. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'fpu')
-rw-r--r--fpu/softfloat.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index a6d0f16b42..4a5345ceca 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -336,6 +336,11 @@ INLINE int float32_is_any_nan(float32 a)
return ((float32_val(a) & ~(1 << 31)) > 0x7f800000UL);
}
+INLINE int float32_is_zero_or_denormal(float32 a)
+{
+ return (float32_val(a) & 0x7f800000) == 0;
+}
+
#define float32_zero make_float32(0)
#define float32_one make_float32(0x3f800000)
#define float32_ln2 make_float32(0x3f317218)