1 ; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s
3 ; Artificial datalayout
4 target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-v2048:2048:2048-n32:64"
7 define void @add_ints_1_1_1(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
8 ; CHECK-LABEL: @add_ints_1_1_1(
15 for.body: ; preds = %entry, %for.body
16 %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
17 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01
18 %0 = load i32, i32 addrspace(1)* %arrayidx, align 4
19 %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %c, i64 %i.01
20 %1 = load i32, i32 addrspace(1)* %arrayidx1, align 4
21 %add = add nsw i32 %0, %1
22 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %i.01
23 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
24 %inc = add i64 %i.01, 1
25 %cmp = icmp ult i64 %inc, 200
26 br i1 %cmp, label %for.body, label %for.end
28 for.end: ; preds = %for.body
32 define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 {
33 ; CHECK-LABEL: @add_ints_as_1_0_0(
34 ; CHECK-NOT: <4 x i32>
40 for.body: ; preds = %entry, %for.body
41 %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
42 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %i.01
43 %0 = load i32, i32* %arrayidx, align 4
44 %arrayidx1 = getelementptr inbounds i32, i32* %c, i64 %i.01
45 %1 = load i32, i32* %arrayidx1, align 4
46 %add = add nsw i32 %0, %1
47 %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %a, i64 %i.01
48 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
49 %inc = add i64 %i.01, 1
50 %cmp = icmp ult i64 %inc, 200
51 br i1 %cmp, label %for.body, label %for.end
53 for.end: ; preds = %for.body
57 define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 {
58 ; CHECK-LABEL: @add_ints_as_0_1_0(
59 ; CHECK-NOT: <4 x i32>
65 for.body: ; preds = %entry, %for.body
66 %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
67 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01
68 %0 = load i32, i32 addrspace(1)* %arrayidx, align 4
69 %arrayidx1 = getelementptr inbounds i32, i32* %c, i64 %i.01
70 %1 = load i32, i32* %arrayidx1, align 4
71 %add = add nsw i32 %0, %1
72 %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01
73 store i32 %add, i32* %arrayidx2, align 4
74 %inc = add i64 %i.01, 1
75 %cmp = icmp ult i64 %inc, 200
76 br i1 %cmp, label %for.body, label %for.end
78 for.end: ; preds = %for.body
82 define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
83 ; CHECK-LABEL: @add_ints_as_0_1_1(
84 ; CHECK-NOT: <4 x i32>
90 for.body: ; preds = %entry, %for.body
91 %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
92 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01
93 %0 = load i32, i32 addrspace(1)* %arrayidx, align 4
94 %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %c, i64 %i.01
95 %1 = load i32, i32 addrspace(1)* %arrayidx1, align 4
96 %add = add nsw i32 %0, %1
97 %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01
98 store i32 %add, i32* %arrayidx2, align 4
99 %inc = add i64 %i.01, 1
100 %cmp = icmp ult i64 %inc, 200
101 br i1 %cmp, label %for.body, label %for.end
103 for.end: ; preds = %for.body
107 define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* %c) #0 {
108 ; CHECK-LABEL: @add_ints_as_0_1_2(
109 ; CHECK-NOT: <4 x i32>
115 for.body: ; preds = %entry, %for.body
116 %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
117 %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %b, i64 %i.01
118 %0 = load i32, i32 addrspace(1)* %arrayidx, align 4
119 %arrayidx1 = getelementptr inbounds i32, i32 addrspace(2)* %c, i64 %i.01
120 %1 = load i32, i32 addrspace(2)* %arrayidx1, align 4
121 %add = add nsw i32 %0, %1
122 %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %i.01
123 store i32 %add, i32* %arrayidx2, align 4
124 %inc = add i64 %i.01, 1
125 %cmp = icmp ult i64 %inc, 200
126 br i1 %cmp, label %for.body, label %for.end
128 for.end: ; preds = %for.body
132 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }