Skip to content

Commit 849eff1

Browse files
committed
Minor style and comment improvements
1 parent cb44b0a commit 849eff1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5352,11 +5352,8 @@ static bool isLocalRepeatingShuffle(ArrayRef<int> Mask, int Span) {
53525352

53535353
/// Is this mask only using elements from the first span of the input?
53545354
static bool isLowSourceShuffle(ArrayRef<int> Mask, int Span) {
5355-
for (auto [I, M] : enumerate(Mask)) {
5356-
if (M != -1 && M >= Span)
5357-
return false;
5358-
}
5359-
return true;
5355+
return !any_of(Mask,
5356+
[&](const auto &Idx) { return Idx != -1 && Idx >= Span; });
53605357
}
53615358

53625359
/// Try to widen element type to get a new mask value for a better permutation
@@ -5776,6 +5773,11 @@ static SDValue lowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG,
57765773
SubVec, SubIdx);
57775774
}
57785775
} else if (ContainerVT.bitsGT(M1VT) && isLowSourceShuffle(Mask, VLMAX)) {
5776+
// If we have a shuffle which only uses the first register in our
5777+
// source register group, we can do a linear number of m1 vrgathers
5778+
// reusing the same source register (but with different indices)
5779+
// TODO: This can be generalized for m2 or m4, or for any shuffle
5780+
// for which we can do a vslidedown followed by this expansion.
57795781
EVT SubIndexVT = M1VT.changeVectorElementType(IndexVT.getScalarType());
57805782
auto [InnerTrueMask, InnerVL] =
57815783
getDefaultScalableVLOps(M1VT, DL, DAG, Subtarget);

0 commit comments

Comments
 (0)