[llvm] AMDGPU: Custom lower fptrunc vectors for f32 -> f16 (PR #141883)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 06:23:16 PDT 2025


================
@@ -1061,10 +1061,12 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
   }
 
   auto &FPTruncActions = getActionDefinitionsBuilder(G_FPTRUNC);
-  if (ST.hasCvtPkF16F32Inst())
-    FPTruncActions.legalFor({{S32, S64}, {S16, S32}, {V2S16, V2S32}});
-  else
+  if (ST.hasCvtPkF16F32Inst()) {
+    FPTruncActions.legalFor({{S32, S64}, {S16, S32}, {V2S16, V2S32}})
+        .clampMaxNumElements(0, S16, 2);
+  } else {
----------------
arsenm wrote:

Don't think this is actually tested 

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


More information about the llvm-commits mailing list