diff options
author | Cullen Rhodes <cullen.rhodes@arm.com> | 2021-01-08 14:06:13 +0000 |
---|---|---|
committer | Cullen Rhodes <cullen.rhodes@arm.com> | 2021-03-09 10:44:22 +0000 |
commit | 2750f3ed3155aedccf42e7eccec915d6578d18e4 (patch) | |
tree | 13992a8acacab8409571a9302b19140451de1a72 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | 7e5cea5b509f5535eab6d1ea9b90e033570758a6 (diff) | |
download | llvm-2750f3ed3155aedccf42e7eccec915d6578d18e4.zip llvm-2750f3ed3155aedccf42e7eccec915d6578d18e4.tar.gz llvm-2750f3ed3155aedccf42e7eccec915d6578d18e4.tar.bz2 |
[IR] Introduce llvm.experimental.vector.splice intrinsic
This patch introduces a new intrinsic @llvm.experimental.vector.splice
that constructs a vector of the same type as the two input vectors,
based on a immediate where the sign of the immediate distinguishes two
variants. A positive immediate specifies an index into the first vector
and a negative immediate specifies the number of trailing elements to
extract from the first vector.
For example:
@llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, 1) ==> <B, C, D, E> ; index
@llvm.experimental.vector.splice(<A,B,C,D>, <E,F,G,H>, -3) ==> <B, C, D, E> ; trailing element count
These intrinsics support both fixed and scalable vectors, where the
former is lowered to a shufflevector to maintain existing behaviour,
although while marked as experimental the recommended way to express
this operation for fixed-width vectors is to use shufflevector. For
scalable vectors where it is not possible to express a shufflevector
mask for this operation, a new ISD node has been implemented.
This is one of the named shufflevector intrinsics proposed on the
mailing-list in the RFC at [1].
Patch by Paul Walker and Cullen Rhodes.
[1] https://lists.llvm.org/pipermail/llvm-dev/2020-November/146864.html
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D94708
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 61c5628..9ec9489 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -849,6 +849,9 @@ void TargetLoweringBase::initActions() { setOperationAction(ISD::VECREDUCE_FMIN, VT, Expand); setOperationAction(ISD::VECREDUCE_SEQ_FADD, VT, Expand); setOperationAction(ISD::VECREDUCE_SEQ_FMUL, VT, Expand); + + // Named vector shuffles default to expand. + setOperationAction(ISD::VECTOR_SPLICE, VT, Expand); } // Most targets ignore the @llvm.prefetch intrinsic. |