[llvm] 3305f5a - [RISCV][GISEL] Check for legal element count in typeIsLegalBoolVec
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 10:49:51 PDT 2024
Author: Michael Maitland
Date: 2024-03-25T10:49:41-07:00
New Revision: 3305f5a980363d7e224094bc42bcbebcf162618e
URL: https://github.com/llvm/llvm-project/commit/3305f5a980363d7e224094bc42bcbebcf162618e
DIFF: https://github.com/llvm/llvm-project/commit/3305f5a980363d7e224094bc42bcbebcf162618e.diff
LOG: [RISCV][GISEL] Check for legal element count in typeIsLegalBoolVec
https://github.com/llvm/llvm-project/pull/84553 added
typeIsLegalBoolVec but it was missing a check for minimum element count.
This patch adds that.
Added:
Modified:
llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
index 44938f0bb35d1b..9a388f4cd2717b 100644
--- a/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
+++ b/llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
@@ -58,10 +58,12 @@ typeIsLegalIntOrFPVec(unsigned TypeIdx,
static LegalityPredicate
typeIsLegalBoolVec(unsigned TypeIdx, std::initializer_list<LLT> BoolVecTys,
const RISCVSubtarget &ST) {
- LegalityPredicate HasV = [=, &ST](const LegalityQuery &Query) {
- return ST.hasVInstructions();
+ LegalityPredicate P = [=, &ST](const LegalityQuery &Query) {
+ return ST.hasVInstructions() &&
+ (Query.Types[TypeIdx].getElementCount().getKnownMinValue() != 1 ||
+ ST.getELen() == 64);
};
- return all(typeInSet(TypeIdx, BoolVecTys), HasV);
+ return all(typeInSet(TypeIdx, BoolVecTys), P);
}
RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
More information about the llvm-commits
mailing list