[TargetTransformInfo] Add pow2 analysis for scalar constants

Add ConstantInt analysis to getOperandInfo so we get more realistic div/rem expansion costs comparable to the vector costs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336827 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Simon Pilgrim
2018-07-11 17:51:27 +00:00
parent 04804b2f45
commit 7a7cfd8a89
3 changed files with 150 additions and 144 deletions
+6
View File
@@ -636,6 +636,12 @@ getOperandInfo(Value *V, TargetTransformInfo::OperandValueProperties &OpProps) {
TargetTransformInfo::OK_AnyValue;
OpProps = TargetTransformInfo::OP_None;
if (auto *CI = dyn_cast<ConstantInt>(V)) {
if (CI->getValue().isPowerOf2())
OpProps = TargetTransformInfo::OP_PowerOf2;
return TargetTransformInfo::OK_UniformConstantValue;
}
const Value *Splat = getSplatValue(V);
// Check for a splat of a constant or for a non uniform vector of constants