[llvm] AMDGPU/GlobalISel: Legalize BF16 for FP math opcodes (PR #214059)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 06:21:47 PDT 2026


================
@@ -1047,14 +1051,18 @@ AMDGPULegalizerInfo::AMDGPULegalizerInfo(const GCNSubtarget &ST_,
     MinNumMaxNum.minScalar(0, F32);
   }
 
-  if (ST.hasVOP3PInsts())
+  if (ST.hasVOP3PInsts()) {
     FPOpActions.clampMaxNumElementsStrict(0, F16, 2);
+    StrictFPOpActions.clampMaxNumElementsStrict(0, F16, 2);
+  }
 
   FPOpActions.scalarize(0);
+  StrictFPOpActions.scalarize(0);
   TrigActions.scalarize(0);
   FDIVActions.scalarize(0);
   if (!ST.has16BitInsts()) {
     FPOpActions.minScalar(0, F32);
----------------
petar-avramovic wrote:

Think we should be more verbose here, this should be only widen for f16. We kind of need to look through other overlapping actions (`widenScalarFor({BF16}`) and the order in which they are declared to figure it out

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


More information about the llvm-commits mailing list