[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 23 00:01:02 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.158 -> 1.159

---
Log message:

Implement mul.ll:test11


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

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.158 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.159
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.158	Sun Feb 22 23:47:48 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Feb 23 00:00:11 2004
@@ -616,12 +616,13 @@
       Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1);
       const Type *SCOpTy = SCIOp0->getType();
 
-      // If the source is X < 0, and X is a signed integer type, convert this
-      // multiply into a shift/and combination.
-      if (SCI->getOpcode() == Instruction::SetLT &&
-          isa<Constant>(SCIOp1) && cast<Constant>(SCIOp1)->isNullValue() &&
-          SCOpTy->isInteger() && SCOpTy->isSigned()) {
-
+      // If the source is X < 0 or X <= -1, and X is a signed integer type,
+      // convert this multiply into a shift/and combination.
+      if (SCOpTy->isSigned() && isa<ConstantInt>(SCIOp1) &&
+          ((SCI->getOpcode() == Instruction::SetLT &&
+            cast<Constant>(SCIOp1)->isNullValue()) ||
+           (SCI->getOpcode() == Instruction::SetLE &&
+            cast<ConstantInt>(SCIOp1)->isAllOnesValue()))) {
         // Shift the X value right to turn it into "all signbits".
         Constant *Amt = ConstantUInt::get(Type::UByteTy,
                                           SCOpTy->getPrimitiveSize()*8-1);





More information about the llvm-commits mailing list