Skip to content

Commit af1cf69

Browse files
authored
[RISCV] Move OrigIdx == 0 check to start of lowerEXTRACT_SUBVECTOR. NFC (#109731)
Allows us to remove a separate check of OrigIdx != 0 for the mask case.
1 parent 0673642 commit af1cf69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10388,12 +10388,17 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
1038810388
unsigned OrigIdx = Op.getConstantOperandVal(1);
1038910389
const RISCVRegisterInfo *TRI = Subtarget.getRegisterInfo();
1039010390

10391+
// With an index of 0 this is a cast-like subvector, which can be performed
10392+
// with subregister operations.
10393+
if (OrigIdx == 0)
10394+
return Op;
10395+
1039110396
// We don't have the ability to slide mask vectors down indexed by their i1
1039210397
// elements; the smallest we can do is i8. Often we are able to bitcast to
1039310398
// equivalent i8 vectors. Note that when extracting a fixed-length vector
1039410399
// from a scalable one, we might not necessarily have enough scalable
1039510400
// elements to safely divide by 8: v8i1 = extract nxv1i1 is valid.
10396-
if (SubVecVT.getVectorElementType() == MVT::i1 && OrigIdx != 0) {
10401+
if (SubVecVT.getVectorElementType() == MVT::i1) {
1039710402
if (VecVT.getVectorMinNumElements() >= 8 &&
1039810403
SubVecVT.getVectorMinNumElements() >= 8) {
1039910404
assert(OrigIdx % 8 == 0 && "Invalid index");
@@ -10425,11 +10430,6 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
1042510430
}
1042610431
}
1042710432

10428-
// With an index of 0 this is a cast-like subvector, which can be performed
10429-
// with subregister operations.
10430-
if (OrigIdx == 0)
10431-
return Op;
10432-
1043310433
const auto VLen = Subtarget.getRealVLen();
1043410434

1043510435
// If the subvector vector is a fixed-length type and we don't know VLEN

0 commit comments

Comments
 (0)