55; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX10,GFX10-GISEL
66; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX11,GFX11-SDAG
77; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX11,GFX11-GISEL
8+ ; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX12,GFX12-SDAG
9+ ; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs < %s | FileCheck %s -check-prefixes=GFX12,GFX12-GISEL
810
911declare half @llvm.fma.f16 (half , half , half )
1012declare half @llvm.maxnum.f16 (half , half )
@@ -27,6 +29,16 @@ define half @test_fma(half %x, half %y, half %z) {
2729; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2830; GFX11-NEXT: v_fma_f16 v0, v0, v1, v2
2931; GFX11-NEXT: s_setpc_b64 s[30:31]
32+ ;
33+ ; GFX12-LABEL: test_fma:
34+ ; GFX12: ; %bb.0:
35+ ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
36+ ; GFX12-NEXT: s_wait_expcnt 0x0
37+ ; GFX12-NEXT: s_wait_samplecnt 0x0
38+ ; GFX12-NEXT: s_wait_bvhcnt 0x0
39+ ; GFX12-NEXT: s_wait_kmcnt 0x0
40+ ; GFX12-NEXT: v_fma_f16 v0, v0, v1, v2
41+ ; GFX12-NEXT: s_setpc_b64 s[30:31]
3042 %r = call half @llvm.fma.f16 (half %x , half %y , half %z )
3143 ret half %r
3244}
@@ -50,6 +62,16 @@ define half @test_fmac(half %x, half %y, half %z) {
5062; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
5163; GFX11-NEXT: v_fmac_f16_e32 v0, v1, v2
5264; GFX11-NEXT: s_setpc_b64 s[30:31]
65+ ;
66+ ; GFX12-LABEL: test_fmac:
67+ ; GFX12: ; %bb.0:
68+ ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
69+ ; GFX12-NEXT: s_wait_expcnt 0x0
70+ ; GFX12-NEXT: s_wait_samplecnt 0x0
71+ ; GFX12-NEXT: s_wait_bvhcnt 0x0
72+ ; GFX12-NEXT: s_wait_kmcnt 0x0
73+ ; GFX12-NEXT: v_fmac_f16_e32 v0, v1, v2
74+ ; GFX12-NEXT: s_setpc_b64 s[30:31]
5375 %r = call half @llvm.fma.f16 (half %y , half %z , half %x )
5476 ret half %r
5577}
@@ -81,6 +103,16 @@ define half @test_fmaak(half %x, half %y, half %z) {
81103; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
82104; GFX11-NEXT: v_fmaak_f16 v0, v0, v1, 0x4200
83105; GFX11-NEXT: s_setpc_b64 s[30:31]
106+ ;
107+ ; GFX12-LABEL: test_fmaak:
108+ ; GFX12: ; %bb.0:
109+ ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
110+ ; GFX12-NEXT: s_wait_expcnt 0x0
111+ ; GFX12-NEXT: s_wait_samplecnt 0x0
112+ ; GFX12-NEXT: s_wait_bvhcnt 0x0
113+ ; GFX12-NEXT: s_wait_kmcnt 0x0
114+ ; GFX12-NEXT: v_fmaak_f16 v0, v0, v1, 0x4200
115+ ; GFX12-NEXT: s_setpc_b64 s[30:31]
84116 %r = call half @llvm.fma.f16 (half %x , half %y , half 0xH4200)
85117 ret half %r
86118}
@@ -112,6 +144,16 @@ define half @test_fmamk(half %x, half %y, half %z) {
112144; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
113145; GFX11-NEXT: v_fmamk_f16 v0, v0, 0x4200, v2
114146; GFX11-NEXT: s_setpc_b64 s[30:31]
147+ ;
148+ ; GFX12-LABEL: test_fmamk:
149+ ; GFX12: ; %bb.0:
150+ ; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0
151+ ; GFX12-NEXT: s_wait_expcnt 0x0
152+ ; GFX12-NEXT: s_wait_samplecnt 0x0
153+ ; GFX12-NEXT: s_wait_bvhcnt 0x0
154+ ; GFX12-NEXT: s_wait_kmcnt 0x0
155+ ; GFX12-NEXT: v_fmamk_f16 v0, v0, 0x4200, v2
156+ ; GFX12-NEXT: s_setpc_b64 s[30:31]
115157 %r = call half @llvm.fma.f16 (half %x , half 0xH4200, half %z )
116158 ret half %r
117159}
@@ -193,6 +235,42 @@ define i32 @test_D139469_f16(half %arg) {
193235; GFX11-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
194236; GFX11-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
195237; GFX11-GISEL-NEXT: s_setpc_b64 s[30:31]
238+ ;
239+ ; GFX12-SDAG-LABEL: test_D139469_f16:
240+ ; GFX12-SDAG: ; %bb.0: ; %bb
241+ ; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
242+ ; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
243+ ; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
244+ ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
245+ ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
246+ ; GFX12-SDAG-NEXT: v_mov_b32_e32 v1, 0x211e
247+ ; GFX12-SDAG-NEXT: v_mul_f16_e32 v2, 0x291e, v0
248+ ; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
249+ ; GFX12-SDAG-NEXT: v_fmac_f16_e32 v1, 0x291e, v0
250+ ; GFX12-SDAG-NEXT: v_min_num_f16_e32 v0, v2, v1
251+ ; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1)
252+ ; GFX12-SDAG-NEXT: v_cmp_gt_f16_e32 vcc_lo, 0, v0
253+ ; GFX12-SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
254+ ; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
255+ ;
256+ ; GFX12-GISEL-LABEL: test_D139469_f16:
257+ ; GFX12-GISEL: ; %bb.0: ; %bb
258+ ; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
259+ ; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
260+ ; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
261+ ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
262+ ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
263+ ; GFX12-GISEL-NEXT: v_mov_b32_e32 v1, 0x211e
264+ ; GFX12-GISEL-NEXT: v_mul_f16_e32 v2, 0x291e, v0
265+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
266+ ; GFX12-GISEL-NEXT: v_fmac_f16_e32 v1, 0x291e, v0
267+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e32 vcc_lo, 0, v2
268+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
269+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e64 s0, 0, v1
270+ ; GFX12-GISEL-NEXT: s_or_b32 s0, vcc_lo, s0
271+ ; GFX12-GISEL-NEXT: s_wait_alu 0xfffe
272+ ; GFX12-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
273+ ; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
196274bb:
197275 %i = fmul contract half %arg , 0xH291E
198276 %i1 = fcmp olt half %i , 0xH0000
@@ -306,6 +384,55 @@ define <2 x i32> @test_D139469_v2f16(<2 x half> %arg) {
306384; GFX11-GISEL-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
307385; GFX11-GISEL-NEXT: v_cndmask_b32_e64 v1, 0, 1, s0
308386; GFX11-GISEL-NEXT: s_setpc_b64 s[30:31]
387+ ;
388+ ; GFX12-SDAG-LABEL: test_D139469_v2f16:
389+ ; GFX12-SDAG: ; %bb.0: ; %bb
390+ ; GFX12-SDAG-NEXT: s_wait_loadcnt_dscnt 0x0
391+ ; GFX12-SDAG-NEXT: s_wait_expcnt 0x0
392+ ; GFX12-SDAG-NEXT: s_wait_samplecnt 0x0
393+ ; GFX12-SDAG-NEXT: s_wait_bvhcnt 0x0
394+ ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
395+ ; GFX12-SDAG-NEXT: s_movk_i32 s0, 0x211e
396+ ; GFX12-SDAG-NEXT: v_pk_mul_f16 v1, 0x291e, v0 op_sel_hi:[0,1]
397+ ; GFX12-SDAG-NEXT: s_wait_alu 0xfffe
398+ ; GFX12-SDAG-NEXT: v_pk_fma_f16 v0, 0x291e, v0, s0 op_sel_hi:[0,1,0]
399+ ; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
400+ ; GFX12-SDAG-NEXT: v_pk_min_num_f16 v0, v1, v0
401+ ; GFX12-SDAG-NEXT: v_lshrrev_b32_e32 v1, 16, v0
402+ ; GFX12-SDAG-NEXT: v_cmp_gt_f16_e32 vcc_lo, 0, v0
403+ ; GFX12-SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
404+ ; GFX12-SDAG-NEXT: s_delay_alu instid0(VALU_DEP_3)
405+ ; GFX12-SDAG-NEXT: v_cmp_gt_f16_e32 vcc_lo, 0, v1
406+ ; GFX12-SDAG-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
407+ ; GFX12-SDAG-NEXT: s_setpc_b64 s[30:31]
408+ ;
409+ ; GFX12-GISEL-LABEL: test_D139469_v2f16:
410+ ; GFX12-GISEL: ; %bb.0: ; %bb
411+ ; GFX12-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
412+ ; GFX12-GISEL-NEXT: s_wait_expcnt 0x0
413+ ; GFX12-GISEL-NEXT: s_wait_samplecnt 0x0
414+ ; GFX12-GISEL-NEXT: s_wait_bvhcnt 0x0
415+ ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
416+ ; GFX12-GISEL-NEXT: v_mov_b32_e32 v1, 0x211e211e
417+ ; GFX12-GISEL-NEXT: v_pk_mul_f16 v2, 0x291e291e, v0
418+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
419+ ; GFX12-GISEL-NEXT: v_pk_fma_f16 v0, 0x291e291e, v0, v1
420+ ; GFX12-GISEL-NEXT: v_lshrrev_b32_e32 v1, 16, v2
421+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e32 vcc_lo, 0, v2
422+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
423+ ; GFX12-GISEL-NEXT: v_lshrrev_b32_e32 v3, 16, v0
424+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e64 s0, 0, v0
425+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e64 s1, 0, v1
426+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
427+ ; GFX12-GISEL-NEXT: v_cmp_gt_f16_e64 s2, 0, v3
428+ ; GFX12-GISEL-NEXT: s_or_b32 s0, vcc_lo, s0
429+ ; GFX12-GISEL-NEXT: s_wait_alu 0xfffe
430+ ; GFX12-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
431+ ; GFX12-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2)
432+ ; GFX12-GISEL-NEXT: s_or_b32 s0, s1, s2
433+ ; GFX12-GISEL-NEXT: s_wait_alu 0xfffe
434+ ; GFX12-GISEL-NEXT: v_cndmask_b32_e64 v1, 0, 1, s0
435+ ; GFX12-GISEL-NEXT: s_setpc_b64 s[30:31]
309436bb:
310437 %i = fmul contract <2 x half > %arg , <half 0xH291E, half 0xH291E>
311438 %i1 = fcmp olt <2 x half > %i , <half 0xH0000, half 0xH0000>
0 commit comments