68 lines
2.7 KiB
Diff
68 lines
2.7 KiB
Diff
From 1acfca06f0dbbc586f0d86833196a4463dc8b8c2 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@redhat.com>
|
|
Date: Tue, 23 May 2023 12:34:33 +0200
|
|
Subject: [PATCH 15/22] target/s390x: fix handling of zeroes in vfmin/vfmax
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Cédric Le Goater <clg@redhat.com>
|
|
RH-MergeRequest: 279: Backport latest s390x-related fixes from upstream QEMU for qemu-kvm in RHEL 8.9
|
|
RH-Bugzilla: 2169308 2209605
|
|
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
RH-Commit: [14/21] 27f66691e08192a5c9f2ecbde3603c0adece4857
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/2169308
|
|
|
|
commit 13c59eb09bd6d1fbc13f08b708226421f14a232b
|
|
Author: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
Date: Wed Jul 13 20:26:10 2022 +0200
|
|
|
|
target/s390x: fix handling of zeroes in vfmin/vfmax
|
|
|
|
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>
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
|
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
Message-Id: <20220713182612.3780050-2-iii@linux.ibm.com>
|
|
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
|
Signed-off-by: Cédric Le Goater <clg@redhat.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 1a77993471..d1249706f9 100644
|
|
--- a/target/s390x/tcg/vec_fpu_helper.c
|
|
+++ b/target/s390x/tcg/vec_fpu_helper.c
|
|
@@ -794,7 +794,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;
|
|
@@ -844,7 +844,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) {
|
|
--
|
|
2.37.3
|
|
|