[llvm] [RISCV][GISel] Attempt to simplify how we handle type legality for F and D extensions. (PR #72174)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 16:01:07 PST 2023
================
@@ -212,51 +221,26 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) {
getActionDefinitionsBuilder({G_FADD, G_FSUB, G_FMUL, G_FDIV, G_FMA, G_FNEG,
G_FABS, G_FSQRT, G_FMAXNUM, G_FMINNUM})
- .legalIf([=, &ST](const LegalityQuery &Query) -> bool {
- return (ST.hasStdExtF() && typeIs(0, s32)(Query)) ||
- (ST.hasStdExtD() && typeIs(0, s64)(Query));
- });
+ .legalIf(typeIsLegalScalarFP(0, ST));
getActionDefinitionsBuilder(G_FPTRUNC).legalIf(
- [=, &ST](const LegalityQuery &Query) -> bool {
- return (ST.hasStdExtD() && typeIs(0, s32)(Query) &&
- typeIs(1, s64)(Query));
- });
+ all(typeIsLegalScalarFP(0, ST), typeIsLegalScalarFP(1, ST)));
----------------
topperc wrote:
This is slighty different than the original logic. In RISC-V, hasStdExtD implies hasStdExtF and I assume a G_FPTRUNC where the source type isn't larger than the dest type is ill-formed. So I assume if the source type is legal and the dest type is legal the whole thing should be legal.
Same for G_FPEXT.
https://github.com/llvm/llvm-project/pull/72174
More information about the llvm-commits
mailing list