[llvm] [AArch64][GlobalISel] Improve lowering of vector fp16 fptrunc and fpext (PR #163398)

Ryan Cowan via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 28 09:09:45 PDT 2025


================
@@ -817,10 +818,24 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
       .legalFor(
           {{s16, s32}, {s16, s64}, {s32, s64}, {v4s16, v4s32}, {v2s32, v2s64}})
       .libcallFor({{s16, s128}, {s32, s128}, {s64, s128}})
-      .clampNumElements(0, v4s16, v4s16)
-      .clampNumElements(0, v2s32, v2s32)
+      .moreElementsToNextPow2(1)
+      .customIf([](const LegalityQuery &Q) {
----------------
HolyMolyCowMan wrote:

It looks like G_FPTRUNC already has a custom lower function: https://github.com/llvm/llvm-project/commit/bfbfa18591db4eff68a6692b8503efd1571cdb88, which I assume prevents us from doing the same?

https://github.com/llvm/llvm-project/pull/163398


More information about the llvm-commits mailing list