For SSE scalar comparison operations where one operand is in memory,
do not read more memory than needed.
git-svn-id: svn://svn.valgrind.org/vex/trunk@1521 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest-amd64/toIR.c b/priv/guest-amd64/toIR.c
index d366728..60ec669 100644
--- a/priv/guest-amd64/toIR.c
+++ b/priv/guest-amd64/toIR.c
@@ -7601,7 +7601,7 @@
vpanic("findSSECmpOp(amd64,guest)");
}
-/* Handles SSE 32F comparisons. */
+/* Handles SSE 32F/64F comparisons. */
static ULong dis_SSEcmp_E_to_G ( Prefix pfx, Long delta,
HChar* opname, Bool all_lanes, Int sz )
@@ -7629,8 +7629,15 @@
addr = disAMode ( &alen, pfx, delta, dis_buf, 1 );
imm8 = getUChar(delta+alen);
findSSECmpOp(&needNot, &op, imm8, all_lanes, sz);
- assign( plain, binop(op, getXMMReg(gregOfRexRM(pfx,rm)),
- loadLE(Ity_V128, mkexpr(addr))) );
+ assign( plain,
+ binop(
+ op,
+ getXMMReg(gregOfRexRM(pfx,rm)),
+ all_lanes ? loadLE(Ity_V128, mkexpr(addr))
+ : sz == 8 ? unop( Iop_64UtoV128, loadLE(Ity_I64, mkexpr(addr)))
+ : /*sz==4*/ unop( Iop_32UtoV128, loadLE(Ity_I32, mkexpr(addr)))
+ )
+ );
delta += alen+1;
DIP("%s $%d,%s,%s\n", opname,
(Int)imm8,