1 ; RUN: llc -march=amdgcn -mcpu=gfx902 -verify-machineinstrs -stop-after=si-form-memory-clauses < %s | FileCheck -check-prefix=GCN %s
3 ; GCN-LABEL: {{^}}name:{{[ ]*}}vector_clause
5 ; GCN: GLOBAL_LOAD_DWORDX4_SADDR
6 ; GCN: GLOBAL_LOAD_DWORDX4_SADDR
7 ; GCN: GLOBAL_LOAD_DWORDX4_SADDR
8 ; GCN: GLOBAL_LOAD_DWORDX4_SADDR
10 define amdgpu_kernel void @vector_clause(<4 x i32> addrspace(1)* noalias nocapture readonly %arg, <4 x i32> addrspace(1)* noalias nocapture %arg1) {
12 %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
13 %tmp2 = zext i32 %tmp to i64
14 %tmp3 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp2
15 %tmp4 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp3, align 16
16 %tmp5 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp2
17 %tmp6 = add nuw nsw i64 %tmp2, 1
18 %tmp7 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp6
19 %tmp8 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp7, align 16
20 %tmp9 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp6
21 %tmp10 = add nuw nsw i64 %tmp2, 2
22 %tmp11 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp10
23 %tmp12 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp11, align 16
24 %tmp13 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp10
25 %tmp14 = add nuw nsw i64 %tmp2, 3
26 %tmp15 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp14
27 %tmp16 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp15, align 16
28 %tmp17 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp14
29 store <4 x i32> %tmp8, <4 x i32> addrspace(1)* %tmp9, align 16
30 store <4 x i32> %tmp4, <4 x i32> addrspace(1)* %tmp5, align 16
31 store <4 x i32> %tmp12, <4 x i32> addrspace(1)* %tmp13, align 16
32 store <4 x i32> %tmp16, <4 x i32> addrspace(1)* %tmp17, align 16
36 ; GCN-LABEL: {{^}}name:{{[ ]*}}no_vector_clause
39 define amdgpu_kernel void @no_vector_clause(<4 x i32> addrspace(1)* noalias nocapture readonly %arg, <4 x i32> addrspace(1)* noalias nocapture %arg1) #0 {
41 %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
42 %tmp2 = zext i32 %tmp to i64
43 %tmp3 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp2
44 %tmp4 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp3, align 16
45 %tmp5 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp2
46 %tmp6 = add nuw nsw i64 %tmp2, 1
47 %tmp7 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp6
48 %tmp8 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp7, align 16
49 %tmp9 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp6
50 %tmp10 = add nuw nsw i64 %tmp2, 2
51 %tmp11 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp10
52 %tmp12 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp11, align 16
53 %tmp13 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp10
54 %tmp14 = add nuw nsw i64 %tmp2, 3
55 %tmp15 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg, i64 %tmp14
56 %tmp16 = load <4 x i32>, <4 x i32> addrspace(1)* %tmp15, align 16
57 %tmp17 = getelementptr inbounds <4 x i32>, <4 x i32> addrspace(1)* %arg1, i64 %tmp14
58 store <4 x i32> %tmp4, <4 x i32> addrspace(1)* %tmp5, align 16
59 store <4 x i32> %tmp8, <4 x i32> addrspace(1)* %tmp9, align 16
60 store <4 x i32> %tmp12, <4 x i32> addrspace(1)* %tmp13, align 16
61 store <4 x i32> %tmp16, <4 x i32> addrspace(1)* %tmp17, align 16
65 declare i32 @llvm.amdgcn.workitem.id.x()
67 attributes #0 = { "amdgpu-max-memory-clause"="1" }