From: Florian Krohm Date: Wed, 4 Feb 2026 20:36:09 +0000 (+0000) Subject: s390: Fix s390_irgen_SRNMB X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d94716b45d5af90ebe790715493f73d841f3575f;p=thirdparty%2Fvalgrind.git s390: Fix s390_irgen_SRNMB When B2 is 0 the least significant 8 bits in D2 must designate a valid rounding mode. Bits D2[0:55] are ignored. Mask D2 accordingly. Found by disasm-test. --- diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index d9d31084c..d9309e522 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -9337,6 +9337,7 @@ s390_irgen_SRNMB(UChar b2, UShort d2) { /* Can only check at IR generation time when b2 == 0 */ if (b2 == 0) { + d2 &= 0xff; // d2[0:55] is ignored s390_insn_assert(d2 <= 3 || d2 == 7); // valid rounding mode } IRTemp op2addr = newTemp(Ity_I64); diff --git a/none/tests/s390x/disasm-test/disasm-test.vgtest b/none/tests/s390x/disasm-test/disasm-test.vgtest index b440fadc2..a5d9d844c 100644 --- a/none/tests/s390x/disasm-test/disasm-test.vgtest +++ b/none/tests/s390x/disasm-test/disasm-test.vgtest @@ -3,17 +3,15 @@ # Therefore the real test here is run in the "post" command. # # Excluded opcodes: -# exrl - Offset is expected to denote a decodable insn; no such scaffolding -# kma - cannot express constraint that r3 must be different from r1 and r2 +# exrl - Offset is expected to denote a decodable insn; no such scaffolding +# kma - Cannot express constraint that r3 must be different from r1 and r2 +# srnmb - The compile-time checkable constraint cannot be expressed in opcode.c # The following need to be fixed # vgef - runs into an assert instead of spec. exc. # vgeg - runs into an assert instead of spec. exc. # vscef - runs into an assert instead of spec. exc. # vsceg - runs into an assert instead of spec. exc. # vstef - runs into an assert instead of spec. exc. -# srnmb - The compile-time checkable constraint cannot be expressed in opcode.c -# But the s390_insn_assert is wrong nevertheless because bits [0:55] are ignored. -# Need to mask d2 before checking (d2 & 0xff) prereq: ./disasm-test --check-march=arch14 prog: /bin/true