summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-06-12 16:12:29 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-06-12 16:12:29 +0000
commite39fa6cbbb368df3f8365a4d2311b079de921dd7 (patch)
treef0a18f086b49c53fd65315ea36dccbe14d6cb71d /llvm/lib/Transforms/Vectorize
parentf69316c6179aa9b96e4fe04ec109c64e1995786c (diff)
downloadbcm5719-llvm-e39fa6cbbb368df3f8365a4d2311b079de921dd7.tar.gz
bcm5719-llvm-e39fa6cbbb368df3f8365a4d2311b079de921dd7.zip
[CostModel] Replace ShuffleKind::SK_Alternate with ShuffleKind::SK_Select (PR33744)
As discussed on PR33744, this patch relaxes ShuffleKind::SK_Alternate which requires shuffle masks to only match an alternating pattern from its 2 sources: e.g. v4f32: <0,5,2,7> or <4,1,6,3> This seems far too restrictive as most SIMD hardware which will implement it using a general blend/bit-select instruction, so replaces it with SK_Select, permitting elements from either source as long as they are inline: e.g. v4f32: <0,5,2,7>, <4,1,6,3>, <0,1,6,7>, <4,1,2,3> etc. This initial patch just updates the name and cost model shuffle mask analysis, later patch reviews will update SLP to better utilise this - it still limits itself to SK_Alternate style patterns. Differential Revision: https://reviews.llvm.org/D47985 llvm-svn: 334513
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index fb7c7e9eb59..4eff2485118 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -313,7 +313,7 @@ isShuffle(ArrayRef<Value *> VL) {
if ((CommonShuffleMode == FirstAlternate ||
CommonShuffleMode == SecondAlternate) &&
Vec2)
- return TargetTransformInfo::SK_Alternate;
+ return TargetTransformInfo::SK_Select;
// If Vec2 was never used, we have a permutation of a single vector, otherwise
// we have permutation of 2 vectors.
return Vec2 ? TargetTransformInfo::SK_PermuteTwoSrc
@@ -2461,8 +2461,7 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
Instruction *I1 = cast<Instruction>(VL[1]);
VecCost +=
TTI->getArithmeticInstrCost(I1->getOpcode(), VecTy, Op1VK, Op2VK);
- VecCost +=
- TTI->getShuffleCost(TargetTransformInfo::SK_Alternate, VecTy, 0);
+ VecCost += TTI->getShuffleCost(TargetTransformInfo::SK_Select, VecTy, 0);
return ReuseShuffleCost + VecCost - ScalarCost;
}
default:
OpenPOWER on IntegriCloud