[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.1.2 01/58] tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE
From: |
Michael Tokarev |
Subject: |
[Stable-9.1.2 01/58] tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE |
Date: |
Sat, 9 Nov 2024 15:08:02 +0300 |
From: Paolo Bonzini <pbonzini@redhat.com>
32-bit TSTEQ and TSTNE is subject to the same constraints as
for 64-bit, but setcond_i32 and negsetcond_i32 were incorrectly
using TCG_CT_CONST ("i") instead of TCG_CT_CONST_CMP ("C").
Adjust the constraint and make tcg_target_const_match use the
same sequence as tgen_cmp2: first check if the constant is a
valid operand for TSTEQ/TSTNE, then accept everything for 32-bit
non-test comparisons, finally check if the constant is a valid
operand for 64-bit non-test comparisons.
Reported-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 615586cb356811e46c2e5f85c36db4b93f8381cd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc
index ad587325fc..a27e346602 100644
--- a/tcg/s390x/tcg-target.c.inc
+++ b/tcg/s390x/tcg-target.c.inc
@@ -563,6 +563,20 @@ static bool tcg_target_const_match(int64_t val, int ct,
}
if (ct & TCG_CT_CONST_CMP) {
+ if (is_tst_cond(cond)) {
+ if (is_const_p16(uval) >= 0) {
+ return true; /* TMxx */
+ }
+ if (risbg_mask(uval)) {
+ return true; /* RISBG */
+ }
+ return false;
+ }
+
+ if (type == TCG_TYPE_I32) {
+ return true;
+ }
+
switch (cond) {
case TCG_COND_EQ:
case TCG_COND_NE:
@@ -582,13 +596,7 @@ static bool tcg_target_const_match(int64_t val, int ct,
break;
case TCG_COND_TSTNE:
case TCG_COND_TSTEQ:
- if (is_const_p16(uval) >= 0) {
- return true; /* TMxx */
- }
- if (risbg_mask(uval)) {
- return true; /* RISBG */
- }
- break;
+ /* checked above, fallthru */
default:
g_assert_not_reached();
}
@@ -3221,9 +3229,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode
op)
case INDEX_op_rotl_i64:
case INDEX_op_rotr_i32:
case INDEX_op_rotr_i64:
+ return C_O1_I2(r, r, ri);
case INDEX_op_setcond_i32:
case INDEX_op_negsetcond_i32:
- return C_O1_I2(r, r, ri);
case INDEX_op_setcond_i64:
case INDEX_op_negsetcond_i64:
return C_O1_I2(r, r, rC);
--
2.39.5
- [Stable-9.1.2 00/58] Patch Round-up for stable 9.1.2, freeze on 2024-11-18, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 01/58] tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE,
Michael Tokarev <=
- [Stable-9.1.2 02/58] KVM: Dynamic sized kvm memslots array, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 03/58] target/i386/tcg: Use DPL-level accesses for interrupts and call gates, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 04/58] accel/kvm: check for KVM_CAP_READONLY_MEM on VM, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 05/58] target/i386: Use only 16 and 32-bit operands for IN/OUT, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 06/58] tests: Wait for migration completion on destination QEMU to avoid failures, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 08/58] tests/qemu-iotests/211.out: Update to expect MapEntry 'compressed' field, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 07/58] Revert "hw/sh4/r2d: Realize IDE controller before accessing it", Michael Tokarev, 2024/11/09
- [Stable-9.1.2 11/58] target/i386: Walk NPT in guest real mode, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 10/58] tcg: Reset data_gen_ptr correctly, Michael Tokarev, 2024/11/09
- [Stable-9.1.2 09/58] raw-format: Fix error message for invalid offset/size, Michael Tokarev, 2024/11/09