1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GCN
3 ; RUN: llc -global-isel -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck %s --check-prefixes=GCN
5 declare void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) nocapture, i32 %size, i32 %voffset, i32 %soffset, i32 %offset, i32 %aux)
7 define amdgpu_ps float @buffer_load_lds_dword(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds) {
8 ; GCN-LABEL: buffer_load_lds_dword:
9 ; GCN: ; %bb.0: ; %main_body
10 ; GCN-NEXT: s_mov_b32 m0, s4
12 ; GCN-NEXT: buffer_load_dword off, s[0:3], 0 lds
13 ; GCN-NEXT: buffer_load_dword off, s[0:3], 0 offset:4 glc lds
14 ; GCN-NEXT: buffer_load_dword off, s[0:3], 0 offset:8 slc lds
15 ; GCN-NEXT: v_mov_b32_e32 v0, s4
16 ; GCN-NEXT: s_waitcnt vmcnt(0)
17 ; GCN-NEXT: ds_read_b32 v0, v0
18 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
19 ; GCN-NEXT: ; return to shader part epilog
21 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 0, i32 0, i32 0, i32 0)
22 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 0, i32 0, i32 4, i32 1)
23 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 0, i32 0, i32 8, i32 2)
24 %res = load float, ptr addrspace(3) %lds
28 define amdgpu_ps void @buffer_load_lds_dword_imm_voffset(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds) {
29 ; GCN-LABEL: buffer_load_lds_dword_imm_voffset:
30 ; GCN: ; %bb.0: ; %main_body
31 ; GCN-NEXT: v_mov_b32_e32 v0, 0x800
32 ; GCN-NEXT: s_mov_b32 m0, s4
34 ; GCN-NEXT: buffer_load_dword v0, s[0:3], 0 offen lds
37 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 2048, i32 0, i32 0, i32 0)
41 define amdgpu_ps void @buffer_load_lds_dword_v_offset(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds, i32 %voffset) {
42 ; GCN-LABEL: buffer_load_lds_dword_v_offset:
43 ; GCN: ; %bb.0: ; %main_body
44 ; GCN-NEXT: s_mov_b32 m0, s4
46 ; GCN-NEXT: buffer_load_dword v0, s[0:3], 0 offen lds
49 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 %voffset, i32 0, i32 0, i32 0)
53 define amdgpu_ps void @buffer_load_lds_dword_s_offset(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds, i32 inreg %soffset) {
54 ; GCN-LABEL: buffer_load_lds_dword_s_offset:
55 ; GCN: ; %bb.0: ; %main_body
56 ; GCN-NEXT: s_mov_b32 m0, s4
58 ; GCN-NEXT: buffer_load_dword off, s[0:3], s5 lds
61 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 0, i32 %soffset, i32 0, i32 0)
65 define amdgpu_ps void @buffer_load_lds_dword_vs_offset(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds, i32 %voffset, i32 inreg %soffset) {
66 ; GCN-LABEL: buffer_load_lds_dword_vs_offset:
67 ; GCN: ; %bb.0: ; %main_body
68 ; GCN-NEXT: s_mov_b32 m0, s4
70 ; GCN-NEXT: buffer_load_dword v0, s[0:3], s5 offen lds
73 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 %voffset, i32 %soffset, i32 0, i32 0)
77 define amdgpu_ps void @buffer_load_lds_dword_vs_imm_offset(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds, i32 %voffset, i32 inreg %soffset) {
78 ; GCN-LABEL: buffer_load_lds_dword_vs_imm_offset:
79 ; GCN: ; %bb.0: ; %main_body
80 ; GCN-NEXT: s_mov_b32 m0, s4
82 ; GCN-NEXT: buffer_load_dword v0, s[0:3], s5 offen offset:2048 lds
85 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 4, i32 %voffset, i32 %soffset, i32 2048, i32 0)
89 define amdgpu_ps void @buffer_load_lds_ushort(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds) {
90 ; GCN-LABEL: buffer_load_lds_ushort:
91 ; GCN: ; %bb.0: ; %main_body
92 ; GCN-NEXT: v_mov_b32_e32 v0, 0x800
93 ; GCN-NEXT: s_mov_b32 m0, s4
95 ; GCN-NEXT: buffer_load_ushort v0, s[0:3], 0 offen lds
98 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 2, i32 2048, i32 0, i32 0, i32 0)
102 define amdgpu_ps void @buffer_load_lds_ubyte(ptr addrspace(8) inreg %rsrc, ptr addrspace(3) inreg %lds) {
103 ; GCN-LABEL: buffer_load_lds_ubyte:
104 ; GCN: ; %bb.0: ; %main_body
105 ; GCN-NEXT: s_mov_b32 m0, s4
107 ; GCN-NEXT: buffer_load_ubyte off, s[0:3], 0 offset:2048 lds
110 call void @llvm.amdgcn.raw.ptr.buffer.load.lds(ptr addrspace(8) %rsrc, ptr addrspace(3) %lds, i32 1, i32 0, i32 0, i32 2048, i32 0)