[llvm] AMDGPU: Custom lower fptrunc vectors for f32 -> f16 (PR #141883)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 19:21:24 PDT 2025
================
@@ -1061,9 +1061,10 @@ 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}})
+ .customFor({{V4S16, V4S32}, {V8S16, V8S32}});
+ } else
FPTruncActions.legalFor({{S32, S64}, {S16, S32}});
----------------
shiltian wrote:
```suggestion
if (ST.hasCvtPkF16F32Inst()) {
FPTruncActions.legalFor({{S32, S64}, {S16, S32}, {V2S16, V2S32}})
.customFor({{V4S16, V4S32}, {V8S16, V8S32}});
} else {
FPTruncActions.legalFor({{S32, S64}, {S16, S32}});
}
```
Also it looks like the format is off
https://github.com/llvm/llvm-project/pull/141883
More information about the llvm-commits
mailing list