[llvm] [RISCV][GISEL] Legalize G_EXTRACT_SUBVECTOR (PR #109426)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 11:12:32 PDT 2024
================
@@ -597,6 +597,24 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
SplatActions.clampScalar(1, sXLen, sXLen);
+ LegalityPredicate ExtractSubvecBitcastPred = [=](const LegalityQuery &Query) {
+ LLT DstTy = Query.Types[0];
+ LLT SrcTy = Query.Types[1];
+ return DstTy.getElementType() == LLT::scalar(1) &&
+ DstTy.getElementCount().getKnownMinValue() >= 8 &&
+ SrcTy.getElementCount().getKnownMinValue() >= 8;
+ };
+ getActionDefinitionsBuilder(G_EXTRACT_SUBVECTOR)
+ // 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.
+ .bitcastIf(
+ all(typeIsLegalBoolVec(0, BoolVecTys, ST), ExtractSubvecBitcastPred),
+ /*Mutation=*/nullptr)
+ .customIf(
+ LegalityPredicates::any(typeIsLegalBoolVec(0, BoolVecTys, ST),
----------------
topperc wrote:
You can't just check type0. You have to check type1 too. If type isn't legal, the operation needs to be split before you can do custom legalization.
https://github.com/llvm/llvm-project/pull/109426
More information about the llvm-commits
mailing list