1 ; RUN: llc -mtriple=amdgcn--amdpal -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN %s
3 ; The first image store and the second image load use the same descriptor and
4 ; the same coordinate. Check that they do not get swapped by the machine
5 ; instruction scheduler.
7 ; GCN-LABEL: {{^}}_amdgpu_cs_main:
13 define dllexport amdgpu_cs void @_amdgpu_cs_main(i32 inreg %arg, i32 inreg %arg1, i32 inreg %arg2, <3 x i32> inreg %arg3, i32 inreg %arg4, <3 x i32> %arg5) local_unnamed_addr #0 {
15 %tmp = call i64 @llvm.amdgcn.s.getpc() #1
16 %tmp6 = bitcast i64 %tmp to <2 x i32>
17 %.0.vec.insert = insertelement <2 x i32> undef, i32 %arg2, i32 0
18 %.4.vec.insert = shufflevector <2 x i32> %.0.vec.insert, <2 x i32> %tmp6, <2 x i32> <i32 0, i32 3>
19 %tmp7 = bitcast <2 x i32> %.4.vec.insert to i64
20 %tmp8 = inttoptr i64 %tmp7 to [4294967295 x i8] addrspace(4)*
21 %tmp9 = add <3 x i32> %arg3, %arg5
22 %tmp10 = getelementptr [4294967295 x i8], [4294967295 x i8] addrspace(4)* %tmp8, i64 0, i64 32
23 %tmp11 = bitcast i8 addrspace(4)* %tmp10 to <8 x i32> addrspace(4)*, !amdgpu.uniform !0
24 %tmp12 = load <8 x i32>, <8 x i32> addrspace(4)* %tmp11, align 16
25 %tmp13.0 = extractelement <3 x i32> %tmp9, i32 0
26 %tmp13.1 = extractelement <3 x i32> %tmp9, i32 1
27 %tmp14 = call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp12, i32 0, i32 0) #0
28 %tmp15 = inttoptr i64 %tmp7 to <8 x i32> addrspace(4)*
29 %tmp16 = load <8 x i32>, <8 x i32> addrspace(4)* %tmp15, align 16
30 call void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float> %tmp14, i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp16, i32 0, i32 0) #0
31 %tmp17 = load <8 x i32>, <8 x i32> addrspace(4)* %tmp15, align 16
32 %tmp18 = call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 165, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp17, i32 0, i32 0) #0
33 %tmp19 = getelementptr [4294967295 x i8], [4294967295 x i8] addrspace(4)* %tmp8, i64 0, i64 64
34 %tmp20 = bitcast i8 addrspace(4)* %tmp19 to <8 x i32> addrspace(4)*, !amdgpu.uniform !0
35 %tmp21 = load <8 x i32>, <8 x i32> addrspace(4)* %tmp20, align 16
36 call void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float> %tmp18, i32 15, i32 %tmp13.0, i32 %tmp13.1, <8 x i32> %tmp21, i32 0, i32 0) #0
40 ; Function Attrs: nounwind readnone speculatable
41 declare i64 @llvm.amdgcn.s.getpc() #1
43 ; Function Attrs: nounwind readonly
44 declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32, i32, i32, <8 x i32>, i32, i32) #2
46 ; Function Attrs: nounwind writeonly
47 declare void @llvm.amdgcn.image.store.2d.v4f32.i32(<4 x float>, i32, i32, i32, <8 x i32>, i32, i32) #3
49 attributes #0 = { nounwind }
50 attributes #1 = { nounwind readnone speculatable }
51 attributes #2 = { nounwind readonly }
52 attributes #3 = { nounwind writeonly }