xref: /llvm-project/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.implicit.ptr.buffer.ll (revision bc6955f18ced3ca89d49bc28eeb58cd6d367e136)
1; RUN: llc -mtriple=amdgcn-mesa-mesa3d -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2
3; FIXME: Requires stack object to not assert
4; GCN-LABEL: {{^}}test_ps:
5; GCN: s_load_dwordx2 s[4:5], s[0:1], 0x0
6; GCN: buffer_store_dword v0, off, s[4:7], 0{{$}}
7; GCN: s_load_dword s{{[0-9]+}}, s[0:1], 0x0
8; GCN-NEXT: s_waitcnt
9; GCN-NEXT: ; return
10define amdgpu_ps i32 @test_ps() #1 {
11  %alloca = alloca i32, addrspace(5)
12  store volatile i32 0, ptr addrspace(5) %alloca
13  %implicit_buffer_ptr = call ptr addrspace(4) @llvm.amdgcn.implicit.buffer.ptr()
14  %value = load volatile i32, ptr addrspace(4) %implicit_buffer_ptr
15  ret i32 %value
16}
17
18; GCN-LABEL: {{^}}test_cs:
19; GCN: s_mov_b64 s[4:5], s[0:1]
20; GCN: buffer_store_dword v{{[0-9]+}}, off, s[4:7], 0{{$}}
21; GCN: s_load_dword s0, s[0:1], 0x0
22define amdgpu_cs i32 @test_cs() #1 {
23  %alloca = alloca i32, addrspace(5)
24  store volatile i32 0, ptr addrspace(5) %alloca
25  %implicit_buffer_ptr = call ptr addrspace(4) @llvm.amdgcn.implicit.buffer.ptr()
26  %value = load volatile i32, ptr addrspace(4) %implicit_buffer_ptr
27  ret i32 %value
28}
29
30declare ptr addrspace(4) @llvm.amdgcn.implicit.buffer.ptr() #0
31
32attributes #0 = { nounwind readnone speculatable }
33attributes #1 = { nounwind }
34