[llvm] [RISCV][GlobalISel] Fix fptosi/fptoui from half to i64 on RV32 (PR #222316)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 11:09:32 PDT 2026
================
@@ -630,6 +630,10 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
.customFor(ST.is64Bit() && ST.hasStdExtZfh(), {{s32, s16}})
.widenScalarToNextPow2(0)
.minScalar(0, s32)
+ // The magnitude of a half is at most 65504, so with Zfh use fcvt.w[u].h
+ // and extend the i32 result. Without Zfh, use the libcalls.
+ .libcallFor(!ST.hasStdExtZfh(), {{s64, s16}})
+ .narrowScalarFor({{s64, s16}}, changeTo(0, s32))
.libcallFor({{s32, s32}, {s64, s32}, {s32, s64}, {s64, s64}})
----------------
arsenm wrote:
This will need to update to use extended LLTs at some point. What happens with bfloat as-is?
https://github.com/llvm/llvm-project/pull/222316
More information about the llvm-commits
mailing list