[SVE] Add support for scalable vectorization of loops with selects and cmps
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 19 Jan 2021 15:38:03 +0000 (15:38 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Fri, 22 Jan 2021 09:48:13 +0000 (09:48 +0000)
commit2e080eb00ad76654313e0e119bb7fa0ffe2f9866
tree6602dc1236b4f8791ab600422a4357ce888e1626
parent3e8d1e8b12ba9017b861fff94afdd4a29b39de17
[SVE] Add support for scalable vectorization of loops with selects and cmps

I have removed an unnecessary assert in LoopVectorizationCostModel::getInstructionCost
that prevented a cost being calculated for select instructions when using
scalable vectors. In addition, I have changed AArch64TTIImpl::getCmpSelInstrCost
to only do special cost calculations for fixed width vectors and fall
back to the base version for scalable vectors.

I have added a simple cost model test for cmps and selects:

  test/Analysis/CostModel/sve-cmpsel.ll

and some simple tests that show we vectorize loops with cmp and select:

  test/Transforms/LoopVectorize/AArch64/sve-basic-vec.ll

Differential Revision: https://reviews.llvm.org/D95039
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Analysis/CostModel/sve-cmpsel.ll [new file with mode: 0644]
llvm/test/Transforms/LoopVectorize/AArch64/sve-basic-vec.ll [new file with mode: 0644]