All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL 0/7] check-softfloat, fp-bench and clang compile fixes
Date: Fri, 18 Jan 2019 15:19:35 -0500	[thread overview]
Message-ID: <20190118201935.GA31012@flamenco> (raw)
In-Reply-To: <87va2lyibo.fsf@linaro.org>

On Fri, Jan 18, 2019 at 17:41:15 +0000, Alex Bennée wrote:
> 
> Emilio G. Cota <cota@braap.org> writes:
> 
> > On Thu, Jan 17, 2019 at 18:55:33 +0000, Peter Maydell wrote:
> >> On Thu, 17 Jan 2019 at 18:30, Emilio G. Cota <cota@braap.org> wrote:
> >> > What are the contents of "int-to-float.err"?
> >>
> >> linux1@lxub05:~$ cat qemu/build/all/tests/fp/int-to-float.err
(snip)
> >> >> Testing i32_to_f128
> >> 372 tests total.
> >> 21 tests performed; 20 errors found.
> >
> > I see, so i32_to_f128 is failing on this host. Is there
> > a s390x machine I could access? I don't see one in the
> > gcc compile farm.
> 
> I've managed to reproduce this in a s390x VM, for Debian install runes:
> 
>   https://wiki.qemu.org/Documentation/Platforms/S390X#Debian_Install_Example_.28TCG.29

It's an endianness issue -- I've reproduced it on both gcc110
(POWER7) from gcc's compile farm and on the s390 machine provided
by Peter (thanks!). Both machines are big endian.

I have a fix for the 128 conversions (below), but not for the
int-to-f80 conversions (the ones that work on little endian).
I have no more time to look into this, so if someone can take
a look, I'd appreciate it.

I'm a little puzzled because given these definitions:

// our floatx80
typedef struct {
    uint64_t low;
    uint16_t high;
} floatx80;

// softfloat's
#ifdef LITTLEENDIAN
struct extFloat80M { uint64_t signif; uint16_t signExp; };
#else
struct extFloat80M { uint16_t signExp; uint64_t signif; };
#endif

I fail to see why just copying low/high to/from signif/signExp
to convert between them fails to work.

Thanks,

		Emilio

---
diff --git a/tests/fp/wrap.inc.c b/tests/fp/wrap.inc.c
index d3bf600cd0..68f57bc167 100644
--- a/tests/fp/wrap.inc.c
+++ b/tests/fp/wrap.inc.c
@@ -87,8 +87,13 @@ static float128_t qemu_to_soft128(float128 a)
     float128_t ret;
     struct uint128 *to = (struct uint128 *)&ret;

+#ifdef LITTLEENDIAN
     to->v0 = a.low;
     to->v64 = a.high;
+#else
+    to->v0 = a.high;
+    to->v64 = a.low;
+#endif
     return ret;
 }

@@ -97,8 +102,13 @@ static float128 soft_to_qemu128(float128_t a)
     struct uint128 *from = (struct uint128 *)&a;
     float128 ret;

+#ifdef LITTLEENDIAN
     ret.low = from->v0;
     ret.high = from->v64;
+#else
+    ret.low = from->v64;
+    ret.high = from->v0;
+#endif
     return ret;
 }

  parent reply	other threads:[~2019-01-18 20:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 13:26 [Qemu-devel] [PULL 0/7] check-softfloat, fp-bench and clang compile fixes Alex Bennée
2019-01-17 13:26 ` [Qemu-devel] [PULL 1/7] fp-bench: fix update_random_ops Alex Bennée
2019-01-17 13:26 ` [Qemu-devel] [PULL 2/7] fp-bench: remove wrong exponent raise in fill_random Alex Bennée
2019-01-17 13:26 ` [Qemu-devel] [PULL 3/7] softfloat: enforce softfloat if the host's FMA is broken Alex Bennée
2019-01-17 13:27 ` [Qemu-devel] [PULL 4/7] include/fpu/softfloat: Fix compilation with Clang on s390x Alex Bennée
2019-01-17 13:27 ` [Qemu-devel] [PULL 5/7] tests/Makefile: add floating point tests Alex Bennée
2019-01-17 13:27 ` [Qemu-devel] [PULL 6/7] scripts/archive-source: include softfloat tests Alex Bennée
2019-01-17 13:27 ` [Qemu-devel] [PULL 7/7] tests/Makfile: add check-softfloat rule Alex Bennée
2019-01-17 17:37 ` [Qemu-devel] [PULL 0/7] check-softfloat, fp-bench and clang compile fixes Peter Maydell
2019-01-17 18:30   ` Emilio G. Cota
2019-01-17 18:55     ` Peter Maydell
2019-01-17 20:08       ` Emilio G. Cota
2019-01-18 17:41         ` Alex Bennée
2019-01-18 17:42           ` Peter Maydell
2019-01-18 20:19           ` Emilio G. Cota [this message]
2019-01-17 20:10       ` Alex Bennée
2019-01-18  9:03         ` Philippe Mathieu-Daudé
2019-01-18 17:00           ` Alex Bennée
2019-01-18 18:16             ` Emilio G. Cota
2019-01-18 18:30               ` Peter Maydell
2019-01-18 19:45                 ` 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=20190118201935.GA31012@flamenco \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.