Skip to content

Commit 8dcfcf2

Browse files
jayfoadc-rhodes
authored andcommitted
[AMDGPU] Add test for early release VGPRs with spills (#178444)
(cherry picked from commit 1873c74)
1 parent 6c94856 commit 8dcfcf2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
2+
; RUN: opt -mtriple=amdgcn -passes=amdgpu-attributor < %s | llc -mtriple=amdgcn -mcpu=gfx1100 | FileCheck %s
3+
4+
; This function uses scratch_store to spill some values to the stack. While
5+
; these stores are potentially outstanding it should not send the DEALLOC_VGPRS
6+
; message. FIXME.
7+
8+
define amdgpu_kernel void @f(ptr %ptr, i32 %arg) "amdgpu-flat-work-group-size"="64,64" {
9+
; CHECK-LABEL: f:
10+
; CHECK: ; %bb.0:
11+
; CHECK-NEXT: s_load_b64 s[2:3], s[0:1], 0x24
12+
; CHECK-NEXT: v_lshlrev_b32_e32 v0, 2, v0
13+
; CHECK-NEXT: s_load_b32 s0, s[0:1], 0x2c
14+
; CHECK-NEXT: scratch_store_b32 off, v0, off offset:4 ; 4-byte Folded Spill
15+
; CHECK-NEXT: s_waitcnt lgkmcnt(0)
16+
; CHECK-NEXT: global_load_b32 v0, v0, s[2:3]
17+
; CHECK-NEXT: s_bitcmp0_b32 s0, 0
18+
; CHECK-NEXT: s_waitcnt vmcnt(0)
19+
; CHECK-NEXT: scratch_store_b32 off, v0, off ; 4-byte Folded Spill
20+
; CHECK-NEXT: ;;#ASMSTART
21+
; CHECK-NEXT: ; clobber
22+
; CHECK-NEXT: ;;#ASMEND
23+
; CHECK-NEXT: s_cbranch_scc1 .LBB0_2
24+
; CHECK-NEXT: ; %bb.1: ; %true
25+
; CHECK-NEXT: s_clause 0x1 ; 8-byte Folded Reload
26+
; CHECK-NEXT: scratch_load_b32 v0, off, off offset:4
27+
; CHECK-NEXT: scratch_load_b32 v2, off, off
28+
; CHECK-NEXT: s_waitcnt vmcnt(1)
29+
; CHECK-NEXT: v_add_co_u32 v0, s0, s2, v0
30+
; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_1)
31+
; CHECK-NEXT: v_add_co_ci_u32_e64 v1, null, s3, 0, s0
32+
; CHECK-NEXT: s_waitcnt vmcnt(0)
33+
; CHECK-NEXT: global_store_b32 v[0:1], v2, off
34+
; CHECK-NEXT: .LBB0_2: ; %false
35+
; CHECK-NEXT: s_nop 0
36+
; CHECK-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
37+
; CHECK-NEXT: s_endpgm
38+
%tid = call i32 @llvm.amdgcn.workitem.id.x()
39+
%gep = getelementptr i32, ptr %ptr, i32 %tid
40+
%val = load i32, ptr %gep
41+
call void asm "; clobber", "~{v[0:31]},~{v[32:63]},~{v[64:95]},~{v[96:127]},~{v[128:159]},~{v[160:191]},~{v[192:223]},~{v[224:255]},~{memory}" ()
42+
%cond = trunc i32 %arg to i1
43+
br i1 %cond, label %true, label %false
44+
true:
45+
store i32 %val, ptr %gep
46+
br label %false
47+
false:
48+
ret void
49+
}

0 commit comments

Comments
 (0)