1*9880d681SAndroid Build Coastguard Worker;RUN: llc < %s -march=amdgcn -mcpu=verde -verify-machineinstrs | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker;RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store: 5*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 6*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[4:7], off, s[0:3], 0 glc 7*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[8:11], off, s[0:3], 0 slc 8*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store(<4 x i32> inreg, <4 x float>, <4 x float>, <4 x float>) { 9*9880d681SAndroid Build Coastguard Workermain_body: 10*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 0, i1 0, i1 0) 11*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %2, <4 x i32> %0, i32 0, i32 0, i1 1, i1 0) 12*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %3, <4 x i32> %0, i32 0, i32 0, i1 0, i1 1) 13*9880d681SAndroid Build Coastguard Worker ret void 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_immoffs: 17*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], off, s[0:3], 0 offset:42 18*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_immoffs(<4 x i32> inreg, <4 x float>) { 19*9880d681SAndroid Build Coastguard Workermain_body: 20*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 42, i1 0, i1 0) 21*9880d681SAndroid Build Coastguard Worker ret void 22*9880d681SAndroid Build Coastguard Worker} 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_idx: 25*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 idxen 26*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_idx(<4 x i32> inreg, <4 x float>, i32) { 27*9880d681SAndroid Build Coastguard Workermain_body: 28*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 0, i1 0, i1 0) 29*9880d681SAndroid Build Coastguard Worker ret void 30*9880d681SAndroid Build Coastguard Worker} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_ofs: 33*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 offen 34*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_ofs(<4 x i32> inreg, <4 x float>, i32) { 35*9880d681SAndroid Build Coastguard Workermain_body: 36*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 0, i32 %2, i1 0, i1 0) 37*9880d681SAndroid Build Coastguard Worker ret void 38*9880d681SAndroid Build Coastguard Worker} 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_both: 41*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v[4:5], s[0:3], 0 idxen offen 42*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_both(<4 x i32> inreg, <4 x float>, i32, i32) { 43*9880d681SAndroid Build Coastguard Workermain_body: 44*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 %3, i1 0, i1 0) 45*9880d681SAndroid Build Coastguard Worker ret void 46*9880d681SAndroid Build Coastguard Worker} 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_both_reversed: 49*9880d681SAndroid Build Coastguard Worker;CHECK: v_mov_b32_e32 v6, v4 50*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v[5:6], s[0:3], 0 idxen offen 51*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_both_reversed(<4 x i32> inreg, <4 x float>, i32, i32) { 52*9880d681SAndroid Build Coastguard Workermain_body: 53*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %3, i32 %2, i1 0, i1 0) 54*9880d681SAndroid Build Coastguard Worker ret void 55*9880d681SAndroid Build Coastguard Worker} 56*9880d681SAndroid Build Coastguard Worker 57*9880d681SAndroid Build Coastguard Worker; Ideally, the register allocator would avoid the wait here 58*9880d681SAndroid Build Coastguard Worker; 59*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_wait: 60*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v4, s[0:3], 0 idxen 61*9880d681SAndroid Build Coastguard Worker;CHECK: s_waitcnt vmcnt(0) expcnt(0) 62*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_load_dwordx4 v[0:3], v5, s[0:3], 0 idxen 63*9880d681SAndroid Build Coastguard Worker;CHECK: s_waitcnt vmcnt(0) 64*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx4 v[0:3], v6, s[0:3], 0 idxen 65*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_wait(<4 x i32> inreg, <4 x float>, i32, i32, i32) { 66*9880d681SAndroid Build Coastguard Workermain_body: 67*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %1, <4 x i32> %0, i32 %2, i32 0, i1 0, i1 0) 68*9880d681SAndroid Build Coastguard Worker %data = call <4 x float> @llvm.amdgcn.buffer.load.v4f32(<4 x i32> %0, i32 %3, i32 0, i1 0, i1 0) 69*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %data, <4 x i32> %0, i32 %4, i32 0, i1 0, i1 0) 70*9880d681SAndroid Build Coastguard Worker ret void 71*9880d681SAndroid Build Coastguard Worker} 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_x1: 74*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dword v0, v1, s[0:3], 0 idxen 75*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_x1(<4 x i32> inreg %rsrc, float %data, i32 %index) { 76*9880d681SAndroid Build Coastguard Workermain_body: 77*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> %rsrc, i32 %index, i32 0, i1 0, i1 0) 78*9880d681SAndroid Build Coastguard Worker ret void 79*9880d681SAndroid Build Coastguard Worker} 80*9880d681SAndroid Build Coastguard Worker 81*9880d681SAndroid Build Coastguard Worker;CHECK-LABEL: {{^}}buffer_store_x2: 82*9880d681SAndroid Build Coastguard Worker;CHECK: buffer_store_dwordx2 v[0:1], v2, s[0:3], 0 idxen 83*9880d681SAndroid Build Coastguard Workerdefine amdgpu_ps void @buffer_store_x2(<4 x i32> inreg %rsrc, <2 x float> %data, i32 %index) #0 { 84*9880d681SAndroid Build Coastguard Workermain_body: 85*9880d681SAndroid Build Coastguard Worker call void @llvm.amdgcn.buffer.store.v2f32(<2 x float> %data, <4 x i32> %rsrc, i32 %index, i32 0, i1 0, i1 0) 86*9880d681SAndroid Build Coastguard Worker ret void 87*9880d681SAndroid Build Coastguard Worker} 88*9880d681SAndroid Build Coastguard Worker 89*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #0 90*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.amdgcn.buffer.store.v2f32(<2 x float>, <4 x i32>, i32, i32, i1, i1) #0 91*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.amdgcn.buffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i1, i1) #0 92*9880d681SAndroid Build Coastguard Workerdeclare <4 x float> @llvm.amdgcn.buffer.load.v4f32(<4 x i32>, i32, i32, i1, i1) #1 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind } 95*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readonly } 96