[llvm] [RISCV] Move OrigIdx == 0 check to start of lowerEXTRACT_SUBVECTOR. NFC (PR #109731)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 16:15:52 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/109731
Allows us to remove a separate check OrigIdx for the mask case.
>From bf0d2232f7bfe1167f4bb016fbcdf22521d3d57e Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Mon, 23 Sep 2024 16:14:07 -0700
Subject: [PATCH] [RISCV] Move OrigIdx == 0 check to start of
lowerEXTRACT_SUBVECTOR. NFC
Allows us to remove a separate check OrigIdx for the mask case.
---
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
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