mips32/mips64: Fix the problem with lwl and lwr for mips32 and mips64.
This patch is fixing the problem with lwl and lwr for mips32 and mips64
that was discovered while running v8 tests for mips32.
git-svn-id: svn://svn.valgrind.org/vex/trunk@2749 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_mips_toIR.c b/priv/guest_mips_toIR.c
index 926874e..7c248ed 100644
--- a/priv/guest_mips_toIR.c
+++ b/priv/guest_mips_toIR.c
@@ -12846,10 +12846,13 @@
/* rt content - adjusted */
t5 = newTemp(Ity_I32);
- assign(t5, binop(Iop_And32, mkNarrowTo32(ty, getIReg(rt)),
- binop(Iop_Shr32, mkU32(0xFFFFFFFF), narrowTo(Ity_I8,
- binop(Iop_Shl32, binop(Iop_Add32, mkexpr(t4), mkU32(0x1)),
- mkU8(0x3))))));
+ assign(t5, binop(Iop_And32,
+ mkNarrowTo32(ty, getIReg(rt)),
+ binop(Iop_Shr32,
+ mkU32(0x00FFFFFF),
+ narrowTo(Ity_I8, binop(Iop_Mul32,
+ mkU32(0x08),
+ mkexpr(t4))))));
putIReg(rt, mkWidenFrom32(ty, binop(Iop_Or32, mkexpr(t5),
mkexpr(t3)), True));
@@ -12868,10 +12871,13 @@
/* rt content - adjusted */
t5 = newTemp(Ity_I32);
- assign(t5, binop(Iop_And32, unop(Iop_64HIto32, getIReg(rt)),
- binop(Iop_Shr32, mkU32(0xFFFFFFFF), narrowTo(Ity_I8,
- binop(Iop_Shl32, binop(Iop_Add32, mkexpr(t4), mkU32(0x1)),
- mkU8(0x3))))));
+ assign(t5, binop(Iop_And32,
+ mkNarrowTo32(ty, getIReg(rt)),
+ binop(Iop_Shr32,
+ mkU32(0x00FFFFFF),
+ narrowTo(Ity_I8, binop(Iop_Mul32,
+ mkU32(0x08),
+ mkexpr(t4))))));
putIReg(rt, mkWidenFrom32(ty, binop(Iop_Or32, mkexpr(t5),
mkexpr(t3)), True));
@@ -12887,7 +12893,7 @@
#endif
/* t2 = word addr */
- /* t4 = addr mod 8 */
+ /* t4 = addr mod 4 */
LWX_SWX_PATTERN;
/* t3 = word content - shifted */
@@ -12898,9 +12904,13 @@
/* rt content - adjusted */
t5 = newTemp(Ity_I32);
- assign(t5, binop(Iop_And32, getIReg(rt), binop(Iop_Shr32,
- mkU32(0xFFFFFFFF), narrowTo(Ity_I8, binop(Iop_Shl32,
- binop(Iop_Add32, mkexpr(t4), mkU32(0x1)), mkU8(0x3))))));
+ assign(t5, binop(Iop_And32,
+ getIReg(rt),
+ binop(Iop_Shr32,
+ mkU32(0x00FFFFFF),
+ narrowTo(Ity_I8, binop(Iop_Mul32,
+ mkU32(0x08),
+ mkexpr(t4))))));
putIReg(rt, binop(Iop_Or32, mkexpr(t5), mkexpr(t3)));
}
@@ -12944,7 +12954,7 @@
/* rt content - adjusted */
t5 = newTemp(Ity_I32);
- assign(t5, binop(Iop_And32, unop(Iop_64HIto32, getIReg(rt)),
+ assign(t5, binop(Iop_And32, mkNarrowTo32(ty, getIReg(rt)),
unop(Iop_Not32, binop(Iop_Shr32, mkU32(0xFFFFFFFF),
narrowTo(Ity_I8, binop(Iop_Shl32, mkexpr(t4), mkU8(0x3)))))));