Skip to content

Commit 52aebbf

Browse files
committed
More testing
1 parent 3ac18d3 commit 52aebbf

File tree

2 files changed

+70
-4
lines changed

2 files changed

+70
-4
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefix=ASM-DAG %s
3+
; RUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck -check-prefix=ASM-GISEL %s
4+
5+
; Test that we can use v0 for temporaries in the if.then block.
6+
define i32 @dead(i1 %cond, i32 %x, ptr addrspace(1) %ptr1, ptr addrspace(1) %ptr2) #0 {
7+
; ASM-DAG-LABEL: dead:
8+
; ASM-DAG: ; %bb.0: ; %entry
9+
; ASM-DAG-NEXT: s_wait_loadcnt_dscnt 0x0
10+
; ASM-DAG-NEXT: s_wait_expcnt 0x0
11+
; ASM-DAG-NEXT: s_wait_samplecnt 0x0
12+
; ASM-DAG-NEXT: s_wait_bvhcnt 0x0
13+
; ASM-DAG-NEXT: s_wait_kmcnt 0x0
14+
; ASM-DAG-NEXT: v_mov_b32_e32 v4, v0
15+
; ASM-DAG-NEXT: v_mov_b32_e32 v0, v1
16+
; ASM-DAG-NEXT: s_mov_b32 s0, exec_lo
17+
; ASM-DAG-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
18+
; ASM-DAG-NEXT: v_and_b32_e32 v1, 1, v4
19+
; ASM-DAG-NEXT: v_cmpx_eq_u32_e32 1, v1
20+
; ASM-DAG-NEXT: s_cbranch_execz .LBB0_2
21+
; ASM-DAG-NEXT: ; %bb.1: ; %if.then
22+
; ASM-DAG-NEXT: v_add_nc_u32_e32 v0, 1, v0
23+
; ASM-DAG-NEXT: global_store_b32 v[2:3], v0, off
24+
; ASM-DAG-NEXT: ; implicit-def: $vgpr0
25+
; ASM-DAG-NEXT: .LBB0_2: ; %if.end
26+
; ASM-DAG-NEXT: s_wait_alu 0xfffe
27+
; ASM-DAG-NEXT: s_or_b32 exec_lo, exec_lo, s0
28+
; ASM-DAG-NEXT: s_wait_alu 0xfffe
29+
; ASM-DAG-NEXT: s_setpc_b64 s[30:31]
30+
;
31+
; ASM-GISEL-LABEL: dead:
32+
; ASM-GISEL: ; %bb.0: ; %entry
33+
; ASM-GISEL-NEXT: s_wait_loadcnt_dscnt 0x0
34+
; ASM-GISEL-NEXT: s_wait_expcnt 0x0
35+
; ASM-GISEL-NEXT: s_wait_samplecnt 0x0
36+
; ASM-GISEL-NEXT: s_wait_bvhcnt 0x0
37+
; ASM-GISEL-NEXT: s_wait_kmcnt 0x0
38+
; ASM-GISEL-NEXT: v_mov_b32_e32 v4, v0
39+
; ASM-GISEL-NEXT: v_mov_b32_e32 v0, v1
40+
; ASM-GISEL-NEXT: s_mov_b32 s0, exec_lo
41+
; ASM-GISEL-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
42+
; ASM-GISEL-NEXT: v_and_b32_e32 v1, 1, v4
43+
; ASM-GISEL-NEXT: v_cmpx_ne_u32_e32 0, v1
44+
; ASM-GISEL-NEXT: s_cbranch_execz .LBB0_2
45+
; ASM-GISEL-NEXT: ; %bb.1: ; %if.then
46+
; ASM-GISEL-NEXT: v_add_nc_u32_e32 v0, 1, v0
47+
; ASM-GISEL-NEXT: global_store_b32 v[2:3], v0, off
48+
; ASM-GISEL-NEXT: ; implicit-def: $vgpr0
49+
; ASM-GISEL-NEXT: .LBB0_2: ; %if.end
50+
; ASM-GISEL-NEXT: s_wait_alu 0xfffe
51+
; ASM-GISEL-NEXT: s_or_b32 exec_lo, exec_lo, s0
52+
; ASM-GISEL-NEXT: s_wait_alu 0xfffe
53+
; ASM-GISEL-NEXT: s_setpc_b64 s[30:31]
54+
entry:
55+
%dead = call i32 @llvm.amdgcn.dead()
56+
br i1 %cond, label %if.then, label %if.end
57+
58+
if.then: ; preds = %entry
59+
%temp = add i32 %x, 1
60+
store i32 %temp, ptr addrspace(1) %ptr1
61+
br label %if.end
62+
63+
if.end:
64+
%res = phi i32 [ %x, %entry ], [ %dead, %if.then ]
65+
ret i32 %res
66+
}

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.init.whole.wave-w32.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,9 +1233,9 @@ define amdgpu_cs_chain void @with_inactive_vgprs(ptr inreg %callee, i32 inreg %e
12331233
; DAGISEL10-NEXT: s_mov_b32 exec_lo, s2
12341234
; DAGISEL10-NEXT: s_setpc_b64 s[4:5]
12351235
entry:
1236-
%0 = call i32 @llvm.amdgcn.dead()
1237-
%1 = call i1 @llvm.amdgcn.init.whole.wave()
1238-
br i1 %1, label %shader, label %tail.block
1236+
%imp.def = call i32 @llvm.amdgcn.dead()
1237+
%initial.exec = call i1 @llvm.amdgcn.init.whole.wave()
1238+
br i1 %initial.exec, label %shader, label %tail.block
12391239

12401240
shader: ; preds = %entry
12411241
%use.another.vgpr = load i32, ptr %callee ; smth that won't be moved past the inline asm
@@ -1246,7 +1246,7 @@ shader: ; preds = %entry
12461246

12471247
tail.block: ; preds = %.exit27, %.exit49, %244, %243, %entry
12481248
%active.vgpr.arg = phi i32 [ %active.vgpr, %entry ], [ %active.vgpr.new, %shader ]
1249-
%inactive.vgpr.arg = phi i32 [ %inactive.vgpr, %entry ], [ %0, %shader ]
1249+
%inactive.vgpr.arg = phi i32 [ %inactive.vgpr, %entry ], [ %imp.def, %shader ]
12501250
%vgprs.0 = insertvalue { i32, i32 } poison, i32 %active.vgpr.arg, 0
12511251
%vgprs = insertvalue { i32, i32 } %vgprs.0, i32 %inactive.vgpr.arg, 1
12521252
call void (ptr, i32, i32, { i32, i32 }, i32, ...) @llvm.amdgcn.cs.chain.p0.i32.i32.sl_i32i32(ptr inreg %callee, i32 inreg %exec, i32 inreg %sgpr, { i32, i32} %vgprs, i32 0)

0 commit comments

Comments
 (0)