diff options
author | Nate Begeman <natebegeman@mac.com> | 2010-12-17 23:12:19 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2010-12-17 23:12:19 +0000 |
commit | 9a3dc552022e0e034ef34da889f6ceb9de260c96 (patch) | |
tree | 25cd98ac86ca12b5db1ee28a76d926d36297f842 /lib/Analysis/ValueTracking.cpp | |
parent | 976ef86689ed065361a748f81c44ca3510af2202 (diff) |
Add vector versions of some existing scalar transforms to aid codegen in matching psign & pblend operations to the IR produced by clang/gcc for their C idioms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | lib/Analysis/ValueTracking.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp index 75062953cb..f8145cd0e3 100644 --- a/lib/Analysis/ValueTracking.cpp +++ b/lib/Analysis/ValueTracking.cpp @@ -678,6 +678,13 @@ unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD, Tmp += C->getZExtValue(); if (Tmp > TyBits) Tmp = TyBits; } + // vector ashr X, <C, C, C, C> -> adds C sign bits + if (ConstantVector *C = dyn_cast<ConstantVector>(U->getOperand(1))) { + if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(C->getSplatValue())) { + Tmp += CI->getZExtValue(); + if (Tmp > TyBits) Tmp = TyBits; + } + } return Tmp; case Instruction::Shl: if (ConstantInt *C = dyn_cast<ConstantInt>(U->getOperand(1))) { |