[SVE][CodeGen] Use splice instruction when lowering VECTOR_SPLICE
authorDavid Sherwood <david.sherwood@arm.com>
Thu, 16 Dec 2021 08:57:18 +0000 (08:57 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 11 Jan 2022 11:58:17 +0000 (11:58 +0000)
commit3a272d1eaf2679f9fdd7eb49b4e3250d31f0d9a3
tree27f8aeb71b5dd6bccfac16eb2d2a9735be5c4d83
parent0b5b35fdbdbf029bb6915e183541556c4eeadd3f
[SVE][CodeGen] Use splice instruction when lowering VECTOR_SPLICE

For certain negative indices passed to the VECTOR_SPLICE operation
we can actually directly use the SVE splice instruction by creating
the appropriate predicate. The predicate needs to be constructed in
such a way that all but the last -idx elements are false. We can do
this efficiently using a combination of 'ptrue' (with the appropriate
fixed pattern, e.g. vl1, vl2, etc.) and 'rev'. The advantage of using
these instructions to generate the predicate is they do not set any
flags, unlike the whilelo instruction. This is critical when the splice
operation is in a loop, since we want MachineLICM to hoist the
predicate generation out of the loop.

Differential Revision: https://reviews.llvm.org/D115863
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
llvm/test/CodeGen/AArch64/named-vector-shuffles-sve.ll