[llvm-branch-commits] [llvm-branch] r100442 - /llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Gabor Greif ggreif at gmail.com
Mon Apr 5 11:12:18 PDT 2010


Author: ggreif
Date: Mon Apr  5 13:12:17 2010
New Revision: 100442

URL: http://llvm.org/viewvc/llvm-project?rev=100442&view=rev
Log:
shift operands of intrinsics

Modified:
    llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Modified: llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=100442&r1=100441&r2=100442&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Mon Apr  5 13:12:17 2010
@@ -732,10 +732,10 @@
           // the right place.
           Instruction *NewVal;
           if (InputBit > ResultBit)
-            NewVal = BinaryOperator::CreateLShr(I->getOperand(1),
+            NewVal = BinaryOperator::CreateLShr(II->getOperand(0),
                     ConstantInt::get(I->getType(), InputBit-ResultBit));
           else
-            NewVal = BinaryOperator::CreateShl(I->getOperand(1),
+            NewVal = BinaryOperator::CreateShl(II->getOperand(0),
                     ConstantInt::get(I->getType(), ResultBit-InputBit));
           NewVal->takeName(I);
           return InsertNewInstBefore(NewVal, *I);
@@ -1052,12 +1052,12 @@
     case Intrinsic::x86_sse2_mul_sd:
     case Intrinsic::x86_sse2_min_sd:
     case Intrinsic::x86_sse2_max_sd:
-      TmpV = SimplifyDemandedVectorElts(II->getOperand(1), DemandedElts,
+      TmpV = SimplifyDemandedVectorElts(II->getOperand(0), DemandedElts,
                                         UndefElts, Depth+1);
-      if (TmpV) { II->setOperand(1, TmpV); MadeChange = true; }
-      TmpV = SimplifyDemandedVectorElts(II->getOperand(2), DemandedElts,
+      if (TmpV) { II->setOperand(0, TmpV); MadeChange = true; }
+      TmpV = SimplifyDemandedVectorElts(II->getOperand(1), DemandedElts,
                                         UndefElts2, Depth+1);
-      if (TmpV) { II->setOperand(2, TmpV); MadeChange = true; }
+      if (TmpV) { II->setOperand(1, TmpV); MadeChange = true; }
 
       // If only the low elt is demanded and this is a scalarizable intrinsic,
       // scalarize it now.
@@ -1069,8 +1069,8 @@
         case Intrinsic::x86_sse2_sub_sd:
         case Intrinsic::x86_sse2_mul_sd:
           // TODO: Lower MIN/MAX/ABS/etc
-          Value *LHS = II->getOperand(1);
-          Value *RHS = II->getOperand(2);
+          Value *LHS = II->getOperand(0);
+          Value *RHS = II->getOperand(1);
           // Extract the element as scalars.
           LHS = InsertNewInstBefore(ExtractElementInst::Create(LHS, 
             ConstantInt::get(Type::getInt32Ty(I->getContext()), 0U)), *II);





More information about the llvm-branch-commits mailing list