Index: src/IceTargetLoweringX86BaseImpl.h |
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h |
index 677bc98d42f041e0b5f4eb07496f47e94117ba7f..00c2870e391505f4ab1046d70ed1bff1f9f884b7 100644 |
--- a/src/IceTargetLoweringX86BaseImpl.h |
+++ b/src/IceTargetLoweringX86BaseImpl.h |
@@ -1618,11 +1618,17 @@ void TargetX86Base<Machine>::lowerArithmetic(const InstArithmetic *Inst) { |
if (isByteSizedArithType(Dest->getType())) { |
_mov(T, Src0, Traits::RegisterSet::Reg_eax); |
Src1 = legalize(Src1, Legal_Reg | Legal_Mem); |
+ _imul(T, Src0 == Src1 ? T : Src1); |
+ _mov(Dest, T); |
+ } else if (auto *ImmConst = llvm::dyn_cast<ConstantInteger32>(Src1)) { |
+ T = makeReg(Dest->getType()); |
+ _imul_imm(T, Src0, ImmConst); |
+ _mov(Dest, T); |
} else { |
_mov(T, Src0); |
+ _imul(T, Src0 == Src1 ? T : Src1); |
+ _mov(Dest, T); |
} |
- _imul(T, Src0 == Src1 ? T : Src1); |
- _mov(Dest, T); |
break; |
case InstArithmetic::Shl: |
_mov(T, Src0); |