Correct the logic in LowerPartSet which cleared the bits from 0 to low-1.
authorZhou Sheng <zhousheng00@gmail.com>
Sat, 26 May 2007 03:43:13 +0000 (03:43 +0000)
committerZhou Sheng <zhousheng00@gmail.com>
Sat, 26 May 2007 03:43:13 +0000 (03:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37331 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/IntrinsicLowering.cpp

index b870545008a9b13f749ea2c11e42fcc0b0e8c813..c2e4024d11a59dc7f4272aab1a9ecbc0aecdfe58 100644 (file)
@@ -557,11 +557,13 @@ static Instruction *LowerPartSet(CallInst *CI) {
     Rplcmnt->addIncoming(NewRes, reverse);
     Rplcmnt->addIncoming(Rep4, small);
     Value* t0   = CastInst::createIntegerCast(NumBits,ValTy,false,"",result);
-    Value* t1   = BinaryOperator::createShl(ValMask, t0, "", result);
-    Value* t2   = BinaryOperator::createShl(t1, Lo, "", result);
-    Value* t3   = BinaryOperator::createAnd(t2, Val, "", result);
-    Value* t4   = BinaryOperator::createShl(Rplcmnt, Lo, "", result);
-    Value* Rslt = BinaryOperator::createOr(t3, t4, "part_set", result);
+    Value* t1   = BinaryOperator::createShl(ValMask, Lo, "", result);
+    Value* t2   = BinaryOperator::createNot(t1, "", result);
+    Value* t3   = BinaryOperator::createShl(t1, t0, "", result);
+    Value* t4   = BinaryOperator::createOr(t2, t3, "", result);
+    Value* t5   = BinaryOperator::createAnd(t4, Val, "", result);
+    Value* t6   = BinaryOperator::createShl(Rplcmnt, Lo, "", result);
+    Value* Rslt = BinaryOperator::createOr(t5, t6, "part_set", result);
     new ReturnInst(Rslt, result);
   }