[llvm] [AMDGPU] Align GlobalISel with SelectionDAG for f16 to i1/i8 saturated conversions (PR #188019)
Igor Wodiany via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 08:06:24 PDT 2026
================
@@ -5488,25 +5449,18 @@ define <8 x i8> @test_s_unsigned_v8f16_v8i8(<8 x half> inreg %f) {
; GFX12-GI-NEXT: s_wait_samplecnt 0x0
; GFX12-GI-NEXT: s_wait_bvhcnt 0x0
; GFX12-GI-NEXT: s_wait_kmcnt 0x0
-; GFX12-GI-NEXT: s_cvt_f32_f16 s0, s0
-; GFX12-GI-NEXT: s_cvt_f32_f16 s1, s1
-; GFX12-GI-NEXT: s_cvt_f32_f16 s2, s2
-; GFX12-GI-NEXT: s_cvt_f32_f16 s3, s3
-; GFX12-GI-NEXT: s_wait_alu depctr_sa_sdst(0)
-; GFX12-GI-NEXT: s_cvt_u32_f32 s0, s0
-; GFX12-GI-NEXT: s_cvt_u32_f32 s1, s1
-; GFX12-GI-NEXT: s_cvt_u32_f32 s2, s2
-; GFX12-GI-NEXT: s_cvt_u32_f32 s3, s3
-; GFX12-GI-NEXT: s_wait_alu depctr_sa_sdst(0)
-; GFX12-GI-NEXT: s_min_u32 s0, s0, 0xff
-; GFX12-GI-NEXT: s_min_u32 s1, s1, 0xff
-; GFX12-GI-NEXT: s_min_u32 s2, s2, 0xff
-; GFX12-GI-NEXT: s_min_u32 s3, s3, 0xff
-; GFX12-GI-NEXT: s_wait_alu depctr_sa_sdst(0)
-; GFX12-GI-NEXT: v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s0
-; GFX12-GI-NEXT: v_dual_mov_b32 v2, s1 :: v_dual_mov_b32 v3, s1
-; GFX12-GI-NEXT: v_dual_mov_b32 v4, s2 :: v_dual_mov_b32 v5, s2
-; GFX12-GI-NEXT: v_dual_mov_b32 v6, s3 :: v_dual_mov_b32 v7, s3
+; GFX12-GI-NEXT: v_cvt_u16_f16_e32 v0.l, s0
----------------
IgWod wrote:
So, after digging more it seems that the problem is with `selectG_FPEXT` that should select `S_CVT_F32_F16` for the lower 16-bits and `S_CVT_HI_F32_F16` higher, but it does not in this case -- `isExtractHiElt()` seems to be at fault. This results in the higher 16-bit being currently ignored.
https://github.com/llvm/llvm-project/pull/188019
More information about the llvm-commits
mailing list