]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 400491 s390x: Sign-extend immediate operand of LOCHI and friends
authorAndreas Arnez <arnez@linux.ibm.com>
Tue, 30 Oct 2018 16:06:38 +0000 (17:06 +0100)
committerAndreas Arnez <arnez@linux.ibm.com>
Wed, 14 Nov 2018 15:22:24 +0000 (16:22 +0100)
The VEX implementation of each of the z/Architecture instructions LOCHI,
LOCHHI, and LOCGHI treats the immediate 16-bit operand as an unsigned
integer instead of a signed integer.  This is fixed.

NEWS
VEX/priv/guest_s390_toIR.c

diff --git a/NEWS b/NEWS
index 63287bb3b27ee9e6d1f8107d73ff8ca600e6dd04..e0917e25f208f1edade2284f0698124a774138ba 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,7 @@ where XXXXXX is the bug number as listed below.
 399301  Use inlined frames in Massif XTree output. 
 399322  Improve callgrind_annotate output
 400490  s390x: VRs allocated as if separate from FPRs
+400491  s390x: Operand of LOCH treated as unsigned integer
 
 Release 3.14.0 (9 October 2018)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 60b608138306c637f5bbf7e4a05c3421b855a21f..9c4d79b87e119dcc4705e27721e42091291b421e 100644 (file)
@@ -16307,7 +16307,7 @@ static const HChar *
 s390_irgen_LOCHHI(UChar r1, UChar m3, UShort i2, UChar unused)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
-   put_gpr_w0(r1, mkU32(i2));
+   put_gpr_w0(r1, mkU32((UInt)(Int)(Short)i2));
 
    return "lochhi";
 }
@@ -16316,7 +16316,7 @@ static const HChar *
 s390_irgen_LOCHI(UChar r1, UChar m3, UShort i2, UChar unused)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
-   put_gpr_w1(r1, mkU32(i2));
+   put_gpr_w1(r1, mkU32((UInt)(Int)(Short)i2));
 
    return "lochi";
 }
@@ -16325,7 +16325,7 @@ static const HChar *
 s390_irgen_LOCGHI(UChar r1, UChar m3, UShort i2, UChar unused)
 {
    next_insn_if(binop(Iop_CmpEQ32, s390_call_calculate_cond(m3), mkU32(0)));
-   put_gpr_dw0(r1, mkU64(i2));
+   put_gpr_dw0(r1, mkU64((UInt)(Int)(Short)i2));
 
    return "locghi";
 }