SLPVectorizer: Try vectorizing 'splat' stores

Vectorize sequential stores of a broadcasted value.
5% on eon.

radar://16124699

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202067 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Arnold Schwaighofer 2014-02-24 19:52:29 +00:00
parent b55c398992
commit 68085c7bef
2 changed files with 23 additions and 4 deletions

View File

@ -1101,6 +1101,10 @@ bool BoUpSLP::isFullyVectorizableTinyTree() {
if (VectorizableTree.size() != 2)
return false;
// Handle splat stores.
if (!VectorizableTree[0].NeedToGather && isSplat(VectorizableTree[1].Scalars))
return true;
// Gathering cost would be too much for tiny trees.
if (VectorizableTree[0].NeedToGather || VectorizableTree[1].NeedToGather)
return false;

View File

@ -138,3 +138,18 @@ for.body: ; preds = %entry, %for.body
for.end: ; preds = %for.body, %entry
ret void
}
; CHECK-LABEL: store_splat
; CHECK: store <4 x float>
define void @store_splat(float*, float) {
%3 = getelementptr inbounds float* %0, i64 0
store float %1, float* %3, align 4
%4 = getelementptr inbounds float* %0, i64 1
store float %1, float* %4, align 4
%5 = getelementptr inbounds float* %0, i64 2
store float %1, float* %5, align 4
%6 = getelementptr inbounds float* %0, i64 3
store float %1, float* %6, align 4
ret void
}