emitIAS for movsx and movzx. Force dest to be the full 32-bit reg instead of sometimes being a 16-bit reg. This is to save on a operand size prefix (and avoid passing the DestTy down to the dispatchers). BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/647223004
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp index 232acdd..0319768 100644 --- a/src/IceTargetLoweringX8632.cpp +++ b/src/IceTargetLoweringX8632.cpp
@@ -2018,8 +2018,16 @@ } else if (Src0RM->getType() == IceType_i1) { // t = Src0RM; t &= 1; Dest = t Constant *One = Ctx->getConstantInt32(IceType_i32, 1); - Variable *T = makeReg(IceType_i32); - _movzx(T, Src0RM); + Type DestTy = Dest->getType(); + Variable *T; + if (DestTy == IceType_i8) { + T = makeReg(DestTy); + _mov(T, Src0RM); + } else { + // Use 32-bit for both 16-bit and 32-bit, since 32-bit ops are shorter. + T = makeReg(IceType_i32); + _movzx(T, Src0RM); + } _and(T, One); _mov(Dest, T); } else {