[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelPattern.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri May 13 14:50:43 PDT 2005



Changes in directory llvm/lib/Target/X86:

X86ISelPattern.cpp updated: 1.129 -> 1.130
---
Log message:

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


---
Diffs of the changes:  (+7 -2)

 X86ISelPattern.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86ISelPattern.cpp
diff -u llvm/lib/Target/X86/X86ISelPattern.cpp:1.129 llvm/lib/Target/X86/X86ISelPattern.cpp:1.130
--- llvm/lib/Target/X86/X86ISelPattern.cpp:1.129	Fri May 13 16:48:20 2005
+++ llvm/lib/Target/X86/X86ISelPattern.cpp	Fri May 13 16:50:27 2005
@@ -2699,8 +2699,13 @@
           }
           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());






More information about the llvm-commits mailing list