[llvm] [RISCV][GISel] Support fptoi and itofp for Zfh. (PR #96707)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 20:41:44 PDT 2024
================
@@ -416,16 +416,19 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
FConstantActions.legalFor({s16});
FConstantActions.lowerFor({s32, s64});
- getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI})
- .legalIf(all(typeInSet(0, {s32, sXLen}), typeIsScalarFPArith(1, ST)))
- .widenScalarToNextPow2(0)
- .clampScalar(0, s32, sXLen)
- .libcall();
+ auto &FPToIActions =
+ getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI})
+ .legalIf(all(typeInSet(0, {s32, sXLen}), typeIsScalarFPArith(1, ST)));
+ if (ST.hasStdExtZfh())
+ FPToIActions.legalFor({{s32, s16}, {sXLen, s16}});
+ FPToIActions.widenScalarToNextPow2(0).clampScalar(0, s32, sXLen).libcall();
----------------
tschuett wrote:
Did clang-format forced you to put them on one line? The multi-line is more common.
https://github.com/llvm/llvm-project/pull/96707
More information about the llvm-commits
mailing list