[llvm] af1cf69 - [RISCV] Move OrigIdx == 0 check to start of lowerEXTRACT_SUBVECTOR. NFC (#109731)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 18:22:03 PDT 2024
Author: Craig Topper
Date: 2024-09-23T18:21:59-07:00
New Revision: af1cf699f0bf62e54288ac3a5ada6050a41a57a1
URL: https://github.com/llvm/llvm-project/commit/af1cf699f0bf62e54288ac3a5ada6050a41a57a1
DIFF: https://github.com/llvm/llvm-project/commit/af1cf699f0bf62e54288ac3a5ada6050a41a57a1.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index c4458b14f36ece..4bc2f1157b958a 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -10388,12 +10388,17 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
unsigned OrigIdx = Op.getConstantOperandVal(1);
const RISCVRegisterInfo *TRI = Subtarget.getRegisterInfo();
+ // With an index of 0 this is a cast-like subvector, which can be performed
+ // with subregister operations.
+ if (OrigIdx == 0)
+ return Op;
+
// We don't have the ability to slide mask vectors down indexed by their i1
// elements; the smallest we can do is i8. Often we are able to bitcast to
// equivalent i8 vectors. Note that when extracting a fixed-length vector
// from a scalable one, we might not necessarily have enough scalable
// elements to safely divide by 8: v8i1 = extract nxv1i1 is valid.
- if (SubVecVT.getVectorElementType() == MVT::i1 && OrigIdx != 0) {
+ if (SubVecVT.getVectorElementType() == MVT::i1) {
if (VecVT.getVectorMinNumElements() >= 8 &&
SubVecVT.getVectorMinNumElements() >= 8) {
assert(OrigIdx % 8 == 0 && "Invalid index");
@@ -10425,11 +10430,6 @@ SDValue RISCVTargetLowering::lowerEXTRACT_SUBVECTOR(SDValue Op,
}
}
- // With an index of 0 this is a cast-like subvector, which can be performed
- // with subregister operations.
- if (OrigIdx == 0)
- return Op;
-
const auto VLen = Subtarget.getRealVLen();
// If the subvector vector is a fixed-length type and we don't know VLEN
More information about the llvm-commits
mailing list