52 lines
2.1 KiB
Diff
52 lines
2.1 KiB
Diff
|
|
From 81d20b4ec93e9689bff056a0a8bf6ff260da0c68 Mon Sep 17 00:00:00 2001
|
||
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Wed, 13 Mar 2024 05:40:28 +0000
|
||
|
|
Subject: [PATCH] target/s390x: fix handling of zeroes in vfmin/vfmax mainline
|
||
|
|
inclusion commit 13c59eb09bd6d1fbc13f08b708226421f14a232b category: bugfix
|
||
|
|
|
||
|
|
---------------------------------------------------------------
|
||
|
|
|
||
|
|
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: tangbinzy <tangbin_yewu@cmss.chinamobile.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.27.0
|
||
|
|
|