1 ;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck %s
2 ;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s
4 ;CHECK-LABEL: {{^}}buffer_store:
5 ;CHECK: buffer_store_dwordx4 v[0:3], off, s[0:3], 0
6 ;CHECK: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 glc
7 ;CHECK: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 slc
8 define amdgpu_ps void @buffer_store(<4 x i32> inreg, <4 x float>, <4 x float>, <4 x float>) {
10 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 0, i1 0, i1 0)
11 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %2, <4 x i32> %0, i32 0, i32 0, i1 1, i1 0)
12 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %3, <4 x i32> %0, i32 0, i32 0, i1 0, i1 1)
16 ;CHECK-LABEL: {{^}}buffer_store_immoffs:
17 ;CHECK: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:42
18 define amdgpu_ps void @buffer_store_immoffs(<4 x i32> inreg, <4 x float>) {
20 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 42, i1 0, i1 0)
24 ;CHECK-LABEL: {{^}}buffer_store_idx:
25 ;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 idxen
26 define amdgpu_ps void @buffer_store_idx(<4 x i32> inreg, <4 x float>, i32) {
28 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 0, i1 0, i1 0)
32 ;CHECK-LABEL: {{^}}buffer_store_ofs:
33 ;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 offen
34 define amdgpu_ps void @buffer_store_ofs(<4 x i32> inreg, <4 x float>, i32) {
36 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 %2, i1 0, i1 0)
40 ;CHECK-LABEL: {{^}}buffer_store_both:
41 ;CHECK: buffer_store_dwordx4 v[0:3], v[4:5], s[0:3], 0 idxen offen
42 define amdgpu_ps void @buffer_store_both(<4 x i32> inreg, <4 x float>, i32, i32) {
44 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 %3, i1 0, i1 0)
48 ;CHECK-LABEL: {{^}}buffer_store_both_reversed:
49 ;CHECK: v_mov_b32_e32 v6, v4
50 ;CHECK: buffer_store_dwordx4 v[0:3], v[5:6], s[0:3], 0 idxen offen
51 define amdgpu_ps void @buffer_store_both_reversed(<4 x i32> inreg, <4 x float>, i32, i32) {
53 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %3, i32 %2, i1 0, i1 0)
57 ; Ideally, the register allocator would avoid the wait here
59 ;CHECK-LABEL: {{^}}buffer_store_wait:
60 ;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 idxen
61 ;CHECK: s_waitcnt expcnt(0)
62 ;CHECK: buffer_load_dwordx4 v[0:3], v5, s[0:3], 0 idxen
63 ;CHECK: s_waitcnt vmcnt(0)
64 ;CHECK: buffer_store_dwordx4 v[0:3], v6, s[0:3], 0 idxen
65 define amdgpu_ps void @buffer_store_wait(<4 x i32> inreg, <4 x float>, i32, i32, i32) {
67 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 0, i1 0, i1 0)
68 %data = call <4 x float> @llvm.amdgcn.buffer.load.v4f32(<4 x i32> %0, i32 %3, i32 0, i1 0, i1 0)
69 call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %data, <4 x i32> %0, i32 %4, i32 0, i1 0, i1 0)
73 ;CHECK-LABEL: {{^}}buffer_store_x1:
74 ;CHECK: buffer_store_dword v0, v1, s[0:3], 0 idxen
75 define amdgpu_ps void @buffer_store_x1(<4 x i32> inreg %rsrc, float %data, i32 %index) {
77 call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> %rsrc, i32 %index, i32 0, i1 0, i1 0)
81 ;CHECK-LABEL: {{^}}buffer_store_x2:
82 ;CHECK: buffer_store_dwordx2 v[0:1], v2, s[0:3], 0 idxen
83 define amdgpu_ps void @buffer_store_x2(<4 x i32> inreg %rsrc, <2 x float> %data, i32 %index) #0 {
85 call void @llvm.amdgcn.buffer.store.v2f32(<2 x float> %data, <4 x i32> %rsrc, i32 %index, i32 0, i1 0, i1 0)
89 declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #0
90 declare void @llvm.amdgcn.buffer.store.v2f32(<2 x float>, <4 x i32>, i32, i32, i1, i1) #0
91 declare void @llvm.amdgcn.buffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i1, i1) #0
92 declare <4 x float> @llvm.amdgcn.buffer.load.v4f32(<4 x i32>, i32, i32, i1, i1) #1
94 attributes #0 = { nounwind }
95 attributes #1 = { nounwind readonly }