From: David Hildenbrand <david@redhat.com>
To: "Ilya Leoshkevich" <iii@linux.ibm.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Cornelia Huck" <cohuck@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Ulrich Weigand <ulrich.weigand@de.ibm.com>
Subject: Re: [PATCH 1/3] target/s390x: fix handling of zeroes in vfmin/vfmax
Date: Tue, 12 Jul 2022 09:16:35 +0200 [thread overview]
Message-ID: <821506d2-8d1f-a3c4-5d30-8e3fa322a082@redhat.com> (raw)
In-Reply-To: <20220712015717.3602602-2-iii@linux.ibm.com>
On 12.07.22 03:57, Ilya Leoshkevich wrote:
> vfmin_res() / vfmax_res() are trying to check whether a and b are both
> zeroes, but in reality they check that they are the same kind of zero.
> This causes incorrect results when comparing positive and negative
> zeroes.
>
> Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)")
> Co-developed-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
> target/s390x/tcg/vec_fpu_helper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/s390x/tcg/vec_fpu_helper.c b/target/s390x/tcg/vec_fpu_helper.c
> index 2a618a1093..75cf605b9f 100644
> --- a/target/s390x/tcg/vec_fpu_helper.c
> +++ b/target/s390x/tcg/vec_fpu_helper.c
> @@ -824,7 +824,7 @@ static S390MinMaxRes vfmin_res(uint16_t dcmask_a, uint16_t dcmask_b,
> default:
> g_assert_not_reached();
> }
> - } else if (unlikely(dcmask_a & dcmask_b & DCMASK_ZERO)) {
> + } else if (unlikely((dcmask_a & DCMASK_ZERO) && (dcmask_b & DCMASK_ZERO))) {
> switch (type) {
> case S390_MINMAX_TYPE_JAVA:
> return neg_a ? S390_MINMAX_RES_A : S390_MINMAX_RES_B;
> @@ -874,7 +874,7 @@ static S390MinMaxRes vfmax_res(uint16_t dcmask_a, uint16_t dcmask_b,
> default:
> g_assert_not_reached();
> }
> - } else if (unlikely(dcmask_a & dcmask_b & DCMASK_ZERO)) {
> + } else if (unlikely((dcmask_a & DCMASK_ZERO) && (dcmask_b & DCMASK_ZERO))) {
> const bool neg_a = dcmask_a & DCMASK_NEGATIVE;
>
> switch (type) {
Thanks!
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-07-12 7:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 1:57 [PATCH 0/3] target/s390x: vfmin/vfmax fixes Ilya Leoshkevich
2022-07-12 1:57 ` [PATCH 1/3] target/s390x: fix handling of zeroes in vfmin/vfmax Ilya Leoshkevich
2022-07-12 4:23 ` Richard Henderson
2022-07-12 7:16 ` David Hildenbrand [this message]
2022-07-12 1:57 ` [PATCH 2/3] target/s390x: fix NaN propagation rules Ilya Leoshkevich
2022-07-12 4:24 ` Richard Henderson
2022-07-12 7:17 ` David Hildenbrand
2022-07-12 1:57 ` [PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax Ilya Leoshkevich
2022-07-12 4:49 ` Richard Henderson
2022-07-12 12:32 ` Ilya Leoshkevich
2022-07-13 15:44 ` Richard Henderson
2022-07-13 16:14 ` Ilya Leoshkevich
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=821506d2-8d1f-a3c4-5d30-8e3fa322a082@redhat.com \
--to=david@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=iii@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=ulrich.weigand@de.ibm.com \
/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).