Don't emit SAR X, 0 in the case of sdiv Y, 2

llvm-svn: 21986
This commit is contained in:
Chris Lattner 2005-05-13 21:50:27 +00:00
parent 7d387d207d
commit 79e9fa5de1
1 changed files with 7 additions and 2 deletions

View File

@ -2699,8 +2699,13 @@ unsigned ISel::SelectExpr(SDOperand N) {
}
unsigned RegSize = MVT::getSizeInBits(N.getValueType());
Tmp1 = SelectExpr(N.getOperand(0));
unsigned TmpReg = MakeReg(N.getValueType());
BuildMI(BB, SAROpc, 2, TmpReg).addReg(Tmp1).addImm(Log-1);
unsigned TmpReg;
if (Log != 1) {
TmpReg = MakeReg(N.getValueType());
BuildMI(BB, SAROpc, 2, TmpReg).addReg(Tmp1).addImm(Log-1);
} else {
TmpReg = Tmp1;
}
unsigned TmpReg2 = MakeReg(N.getValueType());
BuildMI(BB, SHROpc, 2, TmpReg2).addReg(TmpReg).addImm(RegSize-Log);
unsigned TmpReg3 = MakeReg(N.getValueType());