1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
; RUN: opt -S -march=r600 -mcpu=cayman -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine < %s | FileCheck %s
; Artificial datalayout
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"
define void @add_ints_1_1_1(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
; CHECK-LABEL: @add_ints_1_1_1(
; CHECK: <4 x i32>
; CHECK: ret
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp ult i64 %i.0, 200
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
%0 = load i32 addrspace(1)* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0
%1 = load i32 addrspace(1)* %arrayidx1, align 4
%add = add nsw i32 %0, %1
%arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0
store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
%inc = add i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 {
; CHECK-LABEL: @add_ints_as_1_0_0(
; CHECK-NOT: <4 x i32>
; CHECK: ret
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp ult i64 %i.0, 200
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32* %b, i64 %i.0
%0 = load i32* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0
%1 = load i32* %arrayidx1, align 4
%add = add nsw i32 %0, %1
%arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0
store i32 %add, i32 addrspace(1)* %arrayidx2, align 4
%inc = add i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 {
; CHECK-LABEL: @add_ints_as_0_1_0(
; CHECK-NOT: <4 x i32>
; CHECK: ret
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp ult i64 %i.0, 200
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
%0 = load i32 addrspace(1)* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0
%1 = load i32* %arrayidx1, align 4
%add = add nsw i32 %0, %1
%arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
store i32 %add, i32* %arrayidx2, align 4
%inc = add i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* %c) #0 {
; CHECK-LABEL: @add_ints_as_0_1_1(
; CHECK-NOT: <4 x i32>
; CHECK: ret
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp ult i64 %i.0, 200
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
%0 = load i32 addrspace(1)* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0
%1 = load i32 addrspace(1)* %arrayidx1, align 4
%add = add nsw i32 %0, %1
%arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
store i32 %add, i32* %arrayidx2, align 4
%inc = add i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* %c) #0 {
; CHECK-LABEL: @add_ints_as_0_1_2(
; CHECK-NOT: <4 x i32>
; CHECK: ret
entry:
br label %for.cond
for.cond: ; preds = %for.body, %entry
%i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
%cmp = icmp ult i64 %i.0, 200
br i1 %cmp, label %for.body, label %for.end
for.body: ; preds = %for.cond
%arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0
%0 = load i32 addrspace(1)* %arrayidx, align 4
%arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0
%1 = load i32 addrspace(2)* %arrayidx1, align 4
%add = add nsw i32 %0, %1
%arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0
store i32 %add, i32* %arrayidx2, align 4
%inc = add i64 %i.0, 1
br label %for.cond
for.end: ; preds = %for.cond
ret void
}
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" }
|