qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: cohuck@redhat.com, "Emilio G. Cota" <cota@braap.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Peter Maydell" <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PATCH  v2 1/7] fp-bench: fix update_random_ops
Date: Wed, 16 Jan 2019 20:23:43 +0000	[thread overview]
Message-ID: <20190116202349.29272-2-alex.bennee@linaro.org> (raw)
In-Reply-To: <20190116202349.29272-1-alex.bennee@linaro.org>

From: "Emilio G. Cota" <cota@braap.org>

The second test in the branches is wrong; fix while converting
to a switch statement, which is easier to get right.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/fp/fp-bench.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
index f5bc5edebf..546bac9c9c 100644
--- a/tests/fp/fp-bench.c
+++ b/tests/fp/fp-bench.c
@@ -143,15 +143,20 @@ static void update_random_ops(int n_ops, enum precision prec)
     for (i = 0; i < n_ops; i++) {
         uint64_t r = random_ops[i];
 
-        if (prec == PREC_SINGLE || PREC_FLOAT32) {
+        switch (prec) {
+        case PREC_SINGLE:
+        case PREC_FLOAT32:
             do {
                 r = xorshift64star(r);
             } while (!float32_is_normal(r));
-        } else if (prec == PREC_DOUBLE || PREC_FLOAT64) {
+            break;
+        case PREC_DOUBLE:
+        case PREC_FLOAT64:
             do {
                 r = xorshift64star(r);
             } while (!float64_is_normal(r));
-        } else {
+            break;
+        default:
             g_assert_not_reached();
         }
         random_ops[i] = r;
-- 
2.17.1

  reply	other threads:[~2019-01-16 20:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 20:23 [Qemu-devel] [PATCH v2 0/7] current fpu/next queue Alex Bennée
2019-01-16 20:23 ` Alex Bennée [this message]
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 2/7] fp-bench: remove wrong exponent raise in fill_random Alex Bennée
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 3/7] softfloat: enforce softfloat if the host's FMA is broken Alex Bennée
2019-01-16 22:13   ` Richard Henderson
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 4/7] softfloat: fallback to __int128 maths for s390x and others Alex Bennée
2019-01-16 22:17   ` Richard Henderson
2019-01-17  7:48     ` Alex Bennée
2019-01-17  6:08   ` Thomas Huth
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 5/7] tests/Makefile: add floating point tests Alex Bennée
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 6/7] scripts/archive-source: include softfloat tests Alex Bennée
2019-01-16 20:23 ` [Qemu-devel] [PATCH v2 7/7] tests/Makfile: add check-softfloat rule Alex Bennée
2019-01-16 22:18   ` Richard Henderson

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=20190116202349.29272-2-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=cohuck@redhat.com \
    --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).