[PATCH] D146176: [RISCV] Don't accidentally match deinterleave masks as interleaves
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 08:47:59 PDT 2023
luke updated this revision to Diff 505825.
luke added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146176/new/
https://reviews.llvm.org/D146176
Files:
llvm/include/llvm/IR/Instructions.h
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Index: llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -264,13 +264,12 @@
// deinterleaves of 2 vectors can be lowered into the following
// sequences
if (EltTp.getScalarSizeInBits() < ST->getELEN()) {
- auto InterleaveMask = createInterleaveMask(Mask.size() / 2, 2);
// Example sequence:
// vsetivli zero, 4, e8, mf4, ta, ma (ignored)
// vwaddu.vv v10, v8, v9
// li a0, -1 (ignored)
// vwmaccu.vx v10, a0, v9
- if (ShuffleVectorInst::isInterleaveMask(Mask, 2, Mask.size() * 2))
+ if (ShuffleVectorInst::isInterleaveMask(Mask, 2, Mask.size()))
return 2 * LT.first * getLMULCost(LT.second);
if (Mask[0] == 0 || Mask[0] == 1) {
Index: llvm/include/llvm/IR/Instructions.h
===================================================================
--- llvm/include/llvm/IR/Instructions.h
+++ llvm/include/llvm/IR/Instructions.h
@@ -2448,6 +2448,10 @@
/// StartIndexes are the first indexes of each vector being interleaved,
/// substituting any indexes that were undef
/// E.g. <4, -1, 2, 5, 1, 3> (Factor=3): StartIndexes=<4, 0, 2>
+ ///
+ /// Note that this does not check if the input vectors are consecutive:
+ /// It will return true for masks such as
+ /// <0, 4, 6, 1, 5, 7> (Factor=3, LaneLen=2)
static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
unsigned NumInputElts,
SmallVectorImpl<unsigned> &StartIndexes);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146176.505825.patch
Type: text/x-patch
Size: 1764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230316/e7cb5433/attachment.bin>
More information about the llvm-commits
mailing list