Subzero: Legalize the movzx argument.
The movzx operand must be a register or memory operand. An immediate operand is not allowed.
BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4384
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/2598153002 .
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 4e7cbc8..deaacc6 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -1669,7 +1669,8 @@
return false;
Variable *T = makeReg(Traits::WordType);
if (typeWidthInBytes(Src0->getType()) < typeWidthInBytes(T->getType())) {
- _movzx(T, Src0);
+ Operand *Src0RM = legalize(Src0, Legal_Reg | Legal_Mem);
+ _movzx(T, Src0RM);
} else {
_mov(T, Src0);
}
@@ -4206,7 +4207,8 @@
// converting it to a 64-bit value, and using ctpop_i64. _movzx should
// ensure we will not have any bits set on Val's upper 32 bits.
Variable *V = makeReg(IceType_i64);
- _movzx(V, Val);
+ Operand *ValRM = legalize(Val, Legal_Reg | Legal_Mem);
+ _movzx(V, ValRM);
Val = V;
}
ValTy = IceType_i64;
@@ -6845,7 +6847,8 @@
assert(Traits::Is64Bit);
_mov(Index, RangeIndex); // trunc
} else {
- _movzx(Index, RangeIndex);
+ Operand *RangeIndexRM = legalize(RangeIndex, Legal_Reg | Legal_Mem);
+ _movzx(Index, RangeIndexRM);
}
} else {
Index = legalizeToReg(RangeIndex);