1; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -stress-regalloc=1 < %s | FileCheck -check-prefix=GCN %s
2
3; GCN-LABEL: {{^}}spill_csr_s5_copy:
4; GCN: s_or_saveexec_b64
5; GCN-NEXT: buffer_store_dword v40, off, s[0:3], s32 offset:4 ; 4-byte Folded Spill
6; GCN-NEXT: s_mov_b64 exec
7; GCN: v_writelane_b32 v40, s33, 2
8; GCN: s_swappc_b64
9
10; GCN: v_mov_b32_e32 [[K:v[0-9]+]], 9
11; GCN: buffer_store_dword [[K]], off, s[0:3], s33{{$}}
12
13; GCN: v_readlane_b32 s33, v40, 2
14; GCN: s_or_saveexec_b64
15; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s32 offset:4 ; 4-byte Folded Reload
16; GCN: s_mov_b64 exec
17; GCN: s_setpc_b64
18define void @spill_csr_s5_copy() #0 {
19bb:
20  %alloca = alloca i32, addrspace(5)
21  %tmp = tail call i64 @func() #1
22  %tmp1 = getelementptr inbounds i32, i32 addrspace(1)* null, i64 %tmp
23  %tmp2 = load i32, i32 addrspace(1)* %tmp1, align 4
24  %tmp3 = zext i32 %tmp2 to i64
25  store volatile i32 9, i32 addrspace(5)* %alloca
26  ret void
27}
28
29declare i64 @func()
30
31attributes #0 = { nounwind }
32attributes #1 = { nounwind readnone }
33