diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 22:21:14 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 22:21:14 +0000 |
| commit | 58ec791b4c8387b078babc1f586bf62d4c062177 (patch) | |
| tree | f027e7e9621cdafa43069ddea7d239c559c04751 /llvm/lib/CodeGen/IntrinsicLowering.cpp | |
| parent | 0ff60618d5dcdc4fd6fe2cce21f0e2a1869b46fa (diff) | |
| download | bcm5719-llvm-58ec791b4c8387b078babc1f586bf62d4c062177.tar.gz bcm5719-llvm-58ec791b4c8387b078babc1f586bf62d4c062177.zip | |
Fix problems in the PartSet lowering having to do with incorrect bit width.
llvm-svn: 36180
Diffstat (limited to 'llvm/lib/CodeGen/IntrinsicLowering.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/IntrinsicLowering.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/IntrinsicLowering.cpp b/llvm/lib/CodeGen/IntrinsicLowering.cpp index 501c12c6fe4..72c0f3b084a 100644 --- a/llvm/lib/CodeGen/IntrinsicLowering.cpp +++ b/llvm/lib/CodeGen/IntrinsicLowering.cpp @@ -538,8 +538,10 @@ static Instruction *LowerPartSet(CallInst *CI) { new BranchInst(large, small, is_large, entry); // Block "large" - BinaryOperator* MaskBits = + Instruction* MaskBits = BinaryOperator::createSub(RepBitWidth, NumBits, "", large); + MaskBits = CastInst::createIntegerCast(MaskBits, RepMask->getType(), + false, "", large); BinaryOperator* Mask1 = BinaryOperator::createLShr(RepMask, MaskBits, "", large); BinaryOperator* Rep2 = BinaryOperator::createAnd(Mask1, Rep, "", large); @@ -575,10 +577,10 @@ static Instruction *LowerPartSet(CallInst *CI) { Value* t8 = BinaryOperator::createXor(t7, ValMask, "", reverse); Value* t9 = BinaryOperator::createAnd(t8, Val, "", reverse); Value* t10 = BinaryOperator::createShl(Rep4, Lo, "", reverse); - if (RepBits < ValBits) + if (32 < ValBits) RepBitWidth = cast<ConstantInt>(ConstantExpr::getZExt(RepBitWidth, ValTy)); - else if (RepBits > ValBits) + else if (32 > ValBits) RepBitWidth = cast<ConstantInt>(ConstantExpr::getTrunc(RepBitWidth, ValTy)); Value* t11 = BinaryOperator::createSub(RepBitWidth, Hi, "", reverse); |

