[llvm] [AMDGPU] Improve codegen for uniform f16<-->i32 conversions (PR #176833)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 20 05:00:33 PST 2026
================
@@ -475,6 +475,17 @@ let SubtargetPredicate = HasSALUFloatInsts, AddedComplexity = 9 in {
(S_CVT_I32_F32 $src0)>;
def : GCNPat<(i16 (UniformUnaryFrag<fp_to_uint> f32:$src0)),
(S_CVT_U32_F32 $src0)>;
+ // f16 -> i32 : form chain f16 -> f32 -> i32
+ def : GCNPat<(i32 (UniformUnaryFrag<fp_to_sint> f16:$src0)),
+ (S_CVT_I32_F32 (S_CVT_F32_F16 $src0))>;
+ def : GCNPat<(i32 (UniformUnaryFrag<fp_to_uint> f16:$src0)),
+ (S_CVT_U32_F32 (S_CVT_F32_F16 $src0))>;
+
+ // i32 -> f16 : form chain i32 -> f32 -> f16
----------------
arsenm wrote:
```suggestion
// i32 -> f16 : from chain i32 -> f32 -> f16
```
https://github.com/llvm/llvm-project/pull/176833
More information about the llvm-commits
mailing list