18234b489STim Renouf; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s 28234b489STim Renouf; RUN: llc -mtriple=amdgcn--amdpal -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s 38234b489STim Renouf 48234b489STim Renouf; The buffer_loads and buffer_stores all access the same location. Check they do 58234b489STim Renouf; not get reordered by the scheduler. 68234b489STim Renouf 78234b489STim Renouf; GCN-LABEL: {{^}}_amdgpu_cs_main: 88234b489STim Renouf; GCN: buffer_load_dword 98234b489STim Renouf; GCN: buffer_store_dword 108234b489STim Renouf; GCN: buffer_load_dword 118234b489STim Renouf; GCN: buffer_store_dword 128234b489STim Renouf; GCN: buffer_load_dword 138234b489STim Renouf; GCN: buffer_store_dword 148234b489STim Renouf; GCN: buffer_load_dword 158234b489STim Renouf; GCN: buffer_store_dword 168234b489STim Renouf 178234b489STim Renouf; Function Attrs: nounwind 188234b489STim Renoufdefine amdgpu_cs void @_amdgpu_cs_main(<3 x i32> inreg %arg3, <3 x i32> %arg5) { 198234b489STim Renouf.entry: 208234b489STim Renouf %tmp9 = add <3 x i32> %arg3, %arg5 218234b489STim Renouf %tmp10 = extractelement <3 x i32> %tmp9, i32 0 228234b489STim Renouf %tmp11 = shl i32 %tmp10, 2 238234b489STim Renouf %tmp12 = inttoptr i64 undef to <4 x i32> addrspace(4)* 248234b489STim Renouf %tmp13 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 258234b489STim Renouf %tmp14 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %tmp13, i32 0, i32 %tmp11, i1 false, i1 false) #0 268234b489STim Renouf %tmp17 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 278234b489STim Renouf call void @llvm.amdgcn.buffer.store.f32(float %tmp14, <4 x i32> %tmp17, i32 0, i32 %tmp11, i1 false, i1 false) #0 288234b489STim Renouf %tmp20 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 298234b489STim Renouf %tmp21 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %tmp20, i32 0, i32 %tmp11, i1 false, i1 false) #0 308234b489STim Renouf %tmp22 = fadd reassoc nnan arcp contract float %tmp21, 1.000000e+00 318234b489STim Renouf call void @llvm.amdgcn.buffer.store.f32(float %tmp22, <4 x i32> %tmp20, i32 0, i32 %tmp11, i1 false, i1 false) #0 328234b489STim Renouf %tmp25 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 338234b489STim Renouf %tmp26 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %tmp25, i32 0, i32 %tmp11, i1 false, i1 false) #0 348234b489STim Renouf %tmp27 = fadd reassoc nnan arcp contract float %tmp26, 1.000000e+00 358234b489STim Renouf call void @llvm.amdgcn.buffer.store.f32(float %tmp27, <4 x i32> %tmp25, i32 0, i32 %tmp11, i1 false, i1 false) #0 368234b489STim Renouf %tmp30 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 378234b489STim Renouf %tmp31 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %tmp30, i32 0, i32 %tmp11, i1 false, i1 false) #0 388234b489STim Renouf %tmp32 = fadd reassoc nnan arcp contract float %tmp31, 1.000000e+00 398234b489STim Renouf call void @llvm.amdgcn.buffer.store.f32(float %tmp32, <4 x i32> %tmp30, i32 0, i32 %tmp11, i1 false, i1 false) #0 408234b489STim Renouf %tmp35 = load <4 x i32>, <4 x i32> addrspace(4)* %tmp12, align 16 418234b489STim Renouf %tmp36 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %tmp35, i32 0, i32 %tmp11, i1 false, i1 false) #0 428234b489STim Renouf %tmp37 = fadd reassoc nnan arcp contract float %tmp36, 1.000000e+00 438234b489STim Renouf call void @llvm.amdgcn.buffer.store.f32(float %tmp37, <4 x i32> %tmp35, i32 0, i32 %tmp11, i1 false, i1 false) #0 448234b489STim Renouf ret void 458234b489STim Renouf} 468234b489STim Renouf 470821c882SJay Foad; GCN-LABEL: {{^}}test1: 480821c882SJay Foad; GCN: buffer_store_dword 49*9ac10658SJay Foad; GCN: buffer_load_dword 500821c882SJay Foad; GCN: buffer_store_dword 510821c882SJay Foaddefine amdgpu_cs void @test1(<4 x i32> inreg %buf, i32 %off) { 520821c882SJay Foad.entry: 530821c882SJay Foad call void @llvm.amdgcn.raw.buffer.store.i32(i32 0, <4 x i32> %buf, i32 8, i32 0, i32 0) 540821c882SJay Foad %val = call i32 @llvm.amdgcn.raw.buffer.load.i32(<4 x i32> %buf, i32 %off, i32 0, i32 0) 550821c882SJay Foad call void @llvm.amdgcn.raw.buffer.store.i32(i32 %val, <4 x i32> %buf, i32 0, i32 0, i32 0) 560821c882SJay Foad ret void 570821c882SJay Foad} 580821c882SJay Foad 598234b489STim Renoufdeclare float @llvm.amdgcn.buffer.load.f32(<4 x i32>, i32, i32, i1, i1) #2 608234b489STim Renouf 618234b489STim Renoufdeclare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #3 628234b489STim Renouf 630821c882SJay Foaddeclare i32 @llvm.amdgcn.raw.buffer.load.i32(<4 x i32>, i32, i32, i32) #2 640821c882SJay Foad 650821c882SJay Foaddeclare void @llvm.amdgcn.raw.buffer.store.i32(i32, <4 x i32>, i32, i32, i32) #3 660821c882SJay Foad 678234b489STim Renoufattributes #2 = { nounwind readonly } 688234b489STim Renoufattributes #3 = { nounwind writeonly } 69