From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, "Emilio G. Cota" <cota@braap.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [Qemu-devel] [PULL 04/15] softfloat: add float{32, 64}_is_{de, }normal
Date: Fri, 14 Dec 2018 13:54:41 +0000 [thread overview]
Message-ID: <20181214135452.25936-5-alex.bennee@linaro.org> (raw)
In-Reply-To: <20181214135452.25936-1-alex.bennee@linaro.org>
From: "Emilio G. Cota" <cota@braap.org>
This paves the way for upcoming work.
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 8fd9f9bbae..9eeccd88a5 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -464,6 +464,16 @@ static inline int float32_is_zero_or_denormal(float32 a)
return (float32_val(a) & 0x7f800000) == 0;
}
+static inline bool float32_is_normal(float32 a)
+{
+ return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000;
+}
+
+static inline bool float32_is_denormal(float32 a)
+{
+ return float32_is_zero_or_denormal(a) && !float32_is_zero(a);
+}
+
static inline float32 float32_set_sign(float32 a, int sign)
{
return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31));
@@ -605,6 +615,16 @@ static inline int float64_is_zero_or_denormal(float64 a)
return (float64_val(a) & 0x7ff0000000000000LL) == 0;
}
+static inline bool float64_is_normal(float64 a)
+{
+ return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53;
+}
+
+static inline bool float64_is_denormal(float64 a)
+{
+ return float64_is_zero_or_denormal(a) && !float64_is_zero(a);
+}
+
static inline float64 float64_set_sign(float64 a, int sign)
{
return make_float64((float64_val(a) & 0x7fffffffffffffffULL)
--
2.17.1
next prev parent reply other threads:[~2018-12-14 13:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 13:54 [Qemu-devel] [PULL 00/15] Hardfloat + softfloat maintainers update and gitdm Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 01/15] contrib: add a basic gitdm config Alex Bennée
2018-12-14 20:55 ` Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 02/15] MAINTAINERS: update status of FPU emulation Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 03/15] fp-test: pick TARGET_ARM to get its specialization Alex Bennée
2018-12-14 13:54 ` Alex Bennée [this message]
2018-12-14 13:54 ` [Qemu-devel] [PULL 05/15] target/tricore: use float32_is_denormal Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 06/15] softfloat: rename canonicalize to sf_canonicalize Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 07/15] softfloat: add float{32, 64}_is_zero_or_normal Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 08/15] tests/fp: add fp-bench Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 09/15] fpu: introduce hardfloat Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 10/15] hardfloat: implement float32/64 addition and subtraction Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 11/15] hardfloat: implement float32/64 multiplication Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 12/15] hardfloat: implement float32/64 division Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 13/15] hardfloat: implement float32/64 fused multiply-add Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 14/15] hardfloat: implement float32/64 square root Alex Bennée
2018-12-14 13:54 ` [Qemu-devel] [PULL 15/15] hardfloat: implement float32/64 comparison Alex Bennée
2018-12-16 21:51 ` [Qemu-devel] [PULL 00/15] Hardfloat + softfloat maintainers update and gitdm Peter Maydell
2018-12-17 9:29 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181214135452.25936-5-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=cota@braap.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).