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