OLD | NEW |
---|---|
(Empty) | |
1 ; RUN: opt -constant-insert-extract-element-index %s -S | FileCheck %s | |
2 | |
3 ; The datalayout is needed to determine the alignment of the load/stores. | |
4 target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64 :64:64-p:32:32:32-v128:32:32" | |
5 | |
6 | |
7 ; The following insert/extract elements are all indexed with an in-range | |
8 ; constant, they should remain unchanged. | |
9 | |
10 define void @test_16xi1_unchanged(<16 x i1> %in) { | |
11 ; CHECK: @test_16xi1_unchanged | |
jvoung (off chromium)
2014/04/04 23:20:21
Now that we're at LLVM 3.4, you can use CHECK-LABE
JF
2014/04/15 01:52:27
Done here and in fix-vector-load-store-alignment.l
| |
12 ; CHECK-NOT: alloca | |
jvoung (off chromium)
2014/04/04 23:20:21
might as well CHECK that at least one extracteleme
JF
2014/04/15 01:52:27
Done.
| |
13 %e.0 = extractelement <16 x i1> %in, i32 0 | |
14 %e.1 = extractelement <16 x i1> %in, i32 1 | |
15 %e.2 = extractelement <16 x i1> %in, i32 2 | |
16 %e.3 = extractelement <16 x i1> %in, i32 3 | |
17 %e.4 = extractelement <16 x i1> %in, i32 4 | |
18 %e.5 = extractelement <16 x i1> %in, i32 5 | |
19 %e.6 = extractelement <16 x i1> %in, i32 6 | |
20 %e.7 = extractelement <16 x i1> %in, i32 7 | |
21 %e.8 = extractelement <16 x i1> %in, i32 8 | |
22 %e.9 = extractelement <16 x i1> %in, i32 9 | |
23 %e.10 = extractelement <16 x i1> %in, i32 10 | |
24 %e.11 = extractelement <16 x i1> %in, i32 11 | |
25 %e.12 = extractelement <16 x i1> %in, i32 12 | |
26 %e.13 = extractelement <16 x i1> %in, i32 13 | |
27 %e.14 = extractelement <16 x i1> %in, i32 14 | |
28 %e.15 = extractelement <16 x i1> %in, i32 15 | |
29 ; | |
30 %i.0 = insertelement <16 x i1> %in, i1 true, i32 0 | |
31 %i.1 = insertelement <16 x i1> %in, i1 true, i32 1 | |
32 %i.2 = insertelement <16 x i1> %in, i1 true, i32 2 | |
33 %i.3 = insertelement <16 x i1> %in, i1 true, i32 3 | |
34 %i.4 = insertelement <16 x i1> %in, i1 true, i32 4 | |
35 %i.5 = insertelement <16 x i1> %in, i1 true, i32 5 | |
36 %i.6 = insertelement <16 x i1> %in, i1 true, i32 6 | |
37 %i.7 = insertelement <16 x i1> %in, i1 true, i32 7 | |
38 %i.8 = insertelement <16 x i1> %in, i1 true, i32 8 | |
39 %i.9 = insertelement <16 x i1> %in, i1 true, i32 9 | |
40 %i.10 = insertelement <16 x i1> %in, i1 true, i32 10 | |
41 %i.11 = insertelement <16 x i1> %in, i1 true, i32 11 | |
42 %i.12 = insertelement <16 x i1> %in, i1 true, i32 12 | |
43 %i.13 = insertelement <16 x i1> %in, i1 true, i32 13 | |
44 %i.14 = insertelement <16 x i1> %in, i1 true, i32 14 | |
45 %i.15 = insertelement <16 x i1> %in, i1 true, i32 15 | |
46 ret void | |
47 } | |
48 | |
49 define void @test_8xi1_unchanged(<8 x i1> %in) { | |
50 ; CHECK: @test_8xi1_unchanged | |
51 ; CHECK-NOT: alloca | |
52 %e.0 = extractelement <8 x i1> %in, i32 0 | |
53 %e.1 = extractelement <8 x i1> %in, i32 1 | |
54 %e.2 = extractelement <8 x i1> %in, i32 2 | |
55 %e.3 = extractelement <8 x i1> %in, i32 3 | |
56 %e.4 = extractelement <8 x i1> %in, i32 4 | |
57 %e.5 = extractelement <8 x i1> %in, i32 5 | |
58 %e.6 = extractelement <8 x i1> %in, i32 6 | |
59 %e.7 = extractelement <8 x i1> %in, i32 7 | |
60 ; | |
61 %i.0 = insertelement <8 x i1> %in, i1 true, i32 0 | |
62 %i.1 = insertelement <8 x i1> %in, i1 true, i32 1 | |
63 %i.2 = insertelement <8 x i1> %in, i1 true, i32 2 | |
64 %i.3 = insertelement <8 x i1> %in, i1 true, i32 3 | |
65 %i.4 = insertelement <8 x i1> %in, i1 true, i32 4 | |
66 %i.5 = insertelement <8 x i1> %in, i1 true, i32 5 | |
67 %i.6 = insertelement <8 x i1> %in, i1 true, i32 6 | |
68 %i.7 = insertelement <8 x i1> %in, i1 true, i32 7 | |
69 ret void | |
70 } | |
71 | |
72 define void @test_4xi1_unchanged(<4 x i1> %in) { | |
73 ; CHECK: @test_4xi1_unchanged | |
74 ; CHECK-NOT: alloca | |
75 %e.0 = extractelement <4 x i1> %in, i32 0 | |
76 %e.1 = extractelement <4 x i1> %in, i32 1 | |
77 %e.2 = extractelement <4 x i1> %in, i32 2 | |
78 %e.3 = extractelement <4 x i1> %in, i32 3 | |
79 ; | |
80 %i.0 = insertelement <4 x i1> %in, i1 true, i32 0 | |
81 %i.1 = insertelement <4 x i1> %in, i1 true, i32 1 | |
82 %i.2 = insertelement <4 x i1> %in, i1 true, i32 2 | |
83 %i.3 = insertelement <4 x i1> %in, i1 true, i32 3 | |
84 ret void | |
85 } | |
86 | |
87 define void @test_16xi8_unchanged(<16 x i8> %in) { | |
88 ; CHECK: @test_16xi8_unchanged | |
89 ; CHECK-NOT: alloca | |
90 %e.0 = extractelement <16 x i8> %in, i32 0 | |
91 %e.1 = extractelement <16 x i8> %in, i32 1 | |
92 %e.2 = extractelement <16 x i8> %in, i32 2 | |
93 %e.3 = extractelement <16 x i8> %in, i32 3 | |
94 %e.4 = extractelement <16 x i8> %in, i32 4 | |
95 %e.5 = extractelement <16 x i8> %in, i32 5 | |
96 %e.6 = extractelement <16 x i8> %in, i32 6 | |
97 %e.7 = extractelement <16 x i8> %in, i32 7 | |
98 %e.8 = extractelement <16 x i8> %in, i32 8 | |
99 %e.9 = extractelement <16 x i8> %in, i32 9 | |
100 %e.10 = extractelement <16 x i8> %in, i32 10 | |
101 %e.11 = extractelement <16 x i8> %in, i32 11 | |
102 %e.12 = extractelement <16 x i8> %in, i32 12 | |
103 %e.13 = extractelement <16 x i8> %in, i32 13 | |
104 %e.14 = extractelement <16 x i8> %in, i32 14 | |
105 %e.15 = extractelement <16 x i8> %in, i32 15 | |
106 ; | |
107 %i.0 = insertelement <16 x i8> %in, i8 42, i32 0 | |
108 %i.1 = insertelement <16 x i8> %in, i8 42, i32 1 | |
109 %i.2 = insertelement <16 x i8> %in, i8 42, i32 2 | |
110 %i.3 = insertelement <16 x i8> %in, i8 42, i32 3 | |
111 %i.4 = insertelement <16 x i8> %in, i8 42, i32 4 | |
112 %i.5 = insertelement <16 x i8> %in, i8 42, i32 5 | |
113 %i.6 = insertelement <16 x i8> %in, i8 42, i32 6 | |
114 %i.7 = insertelement <16 x i8> %in, i8 42, i32 7 | |
115 %i.8 = insertelement <16 x i8> %in, i8 42, i32 8 | |
116 %i.9 = insertelement <16 x i8> %in, i8 42, i32 9 | |
117 %i.10 = insertelement <16 x i8> %in, i8 42, i32 10 | |
118 %i.11 = insertelement <16 x i8> %in, i8 42, i32 11 | |
119 %i.12 = insertelement <16 x i8> %in, i8 42, i32 12 | |
120 %i.13 = insertelement <16 x i8> %in, i8 42, i32 13 | |
121 %i.14 = insertelement <16 x i8> %in, i8 42, i32 14 | |
122 %i.15 = insertelement <16 x i8> %in, i8 42, i32 15 | |
123 ret void | |
124 } | |
125 | |
126 define void @test_8xi16_unchanged(<8 x i16> %in) { | |
127 ; CHECK: @test_8xi16_unchanged | |
128 ; CHECK-NOT: alloca | |
129 %e.0 = extractelement <8 x i16> %in, i32 0 | |
130 %e.1 = extractelement <8 x i16> %in, i32 1 | |
131 %e.2 = extractelement <8 x i16> %in, i32 2 | |
132 %e.3 = extractelement <8 x i16> %in, i32 3 | |
133 %e.4 = extractelement <8 x i16> %in, i32 4 | |
134 %e.5 = extractelement <8 x i16> %in, i32 5 | |
135 %e.6 = extractelement <8 x i16> %in, i32 6 | |
136 %e.7 = extractelement <8 x i16> %in, i32 7 | |
137 ; | |
138 %i.0 = insertelement <8 x i16> %in, i16 42, i32 0 | |
139 %i.1 = insertelement <8 x i16> %in, i16 42, i32 1 | |
140 %i.2 = insertelement <8 x i16> %in, i16 42, i32 2 | |
141 %i.3 = insertelement <8 x i16> %in, i16 42, i32 3 | |
142 %i.4 = insertelement <8 x i16> %in, i16 42, i32 4 | |
143 %i.5 = insertelement <8 x i16> %in, i16 42, i32 5 | |
144 %i.6 = insertelement <8 x i16> %in, i16 42, i32 6 | |
145 %i.7 = insertelement <8 x i16> %in, i16 42, i32 7 | |
146 ret void | |
147 } | |
148 | |
149 define void @test_4xi32_unchanged(<4 x i32> %in) { | |
150 ; CHECK: @test_4xi32_unchanged | |
151 ; CHECK-NOT: alloca | |
152 %e.0 = extractelement <4 x i32> %in, i32 0 | |
153 %e.1 = extractelement <4 x i32> %in, i32 1 | |
154 %e.2 = extractelement <4 x i32> %in, i32 2 | |
155 %e.3 = extractelement <4 x i32> %in, i32 3 | |
156 ; | |
157 %i.0 = insertelement <4 x i32> %in, i32 42, i32 0 | |
158 %i.1 = insertelement <4 x i32> %in, i32 42, i32 1 | |
159 %i.2 = insertelement <4 x i32> %in, i32 42, i32 2 | |
160 %i.3 = insertelement <4 x i32> %in, i32 42, i32 3 | |
161 ret void | |
162 } | |
163 | |
164 define void @test_4xfloat_unchanged(<4 x float> %in) { | |
165 ; CHECK: @test_4xfloat_unchanged | |
166 ; CHECK-NOT: alloca | |
167 %e.0 = extractelement <4 x float> %in, i32 0 | |
168 %e.1 = extractelement <4 x float> %in, i32 1 | |
169 %e.2 = extractelement <4 x float> %in, i32 2 | |
170 %e.3 = extractelement <4 x float> %in, i32 3 | |
171 ; | |
172 %i.0 = insertelement <4 x float> %in, float 42.0, i32 0 | |
173 %i.1 = insertelement <4 x float> %in, float 42.0, i32 1 | |
174 %i.2 = insertelement <4 x float> %in, float 42.0, i32 2 | |
175 %i.3 = insertelement <4 x float> %in, float 42.0, i32 3 | |
176 ret void | |
177 } | |
178 | |
179 | |
180 ; The following insert/extract elements are all indexed with an | |
181 ; out-of-range constant, they should get modified. | |
182 | |
183 define <16 x i1> @test_16xi1_out_of_range(<16 x i1> %in) { | |
184 ; CHECK: @test_16xi1_out_of_range | |
185 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 | |
186 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <16 x i1>* | |
187 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ECAST]], align 16 | |
188 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 16 | |
189 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
190 %e.16 = extractelement <16 x i1> %in, i32 16 | |
191 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 | |
192 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <16 x i1>* | |
193 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ICAST]], align 16 | |
194 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 16 | |
195 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
196 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i1>* %[[ICAST]], align 16 | |
197 %i.16 = insertelement <16 x i1> %in, i1 %e.16, i32 16 | |
198 ; CHECK-NEXT: ret <16 x i1> %[[ILOAD]] | |
199 ret <16 x i1> %i.16 | |
200 } | |
201 | |
202 define <8 x i1> @test_8xi1_out_of_range(<8 x i1> %in) { | |
203 ; CHECK: @test_8xi1_out_of_range | |
204 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 | |
205 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <8 x i1>* | |
206 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ECAST]], align 8 | |
207 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 8 | |
208 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
209 %e.8 = extractelement <8 x i1> %in, i32 8 | |
210 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 | |
211 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <8 x i1>* | |
212 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ICAST]], align 8 | |
213 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 8 | |
214 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
215 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i1>* %[[ICAST]], align 8 | |
216 %i.8 = insertelement <8 x i1> %in, i1 %e.8, i32 8 | |
217 ; CHECK-NEXT: ret <8 x i1> %[[ILOAD]] | |
218 ret <8 x i1> %i.8 | |
219 } | |
220 | |
221 define <4 x i1> @test_4xi1_out_of_range(<4 x i1> %in) { | |
222 ; CHECK: @test_4xi1_out_of_range | |
223 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 | |
224 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <4 x i1>* | |
225 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ECAST]], align 4 | |
226 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 4 | |
227 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
228 %e.4 = extractelement <4 x i1> %in, i32 4 | |
229 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 | |
230 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <4 x i1>* | |
231 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ICAST]], align 4 | |
232 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 4 | |
233 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
234 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i1>* %[[ICAST]], align 4 | |
235 %i.4 = insertelement <4 x i1> %in, i1 %e.4, i32 4 | |
236 ; CHECK-NEXT: ret <4 x i1> %[[ILOAD]] | |
237 ret <4 x i1> %i.4 | |
238 } | |
239 | |
240 define <16 x i8> @test_16xi8_out_of_range(<16 x i8> %in) { | |
241 ; CHECK: @test_16xi8_out_of_range | |
242 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 | |
243 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i8* %[[EALLOCA]] to <16 x i8>* | |
244 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ECAST]], align 4 | |
245 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i8* %[[EALLOCA]], i32 16 | |
246 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i8* %[[EGEP]], align 1 | |
247 %e.16 = extractelement <16 x i8> %in, i32 16 | |
248 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 | |
249 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i8* %[[IALLOCA]] to <16 x i8>* | |
250 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ICAST]], align 4 | |
251 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i8* %[[IALLOCA]], i32 16 | |
252 ; CHECK-NEXT: store i8 %[[ELOAD]], i8* %[[IGEP]], align 1 | |
253 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i8>* %[[ICAST]], align 4 | |
254 %i.16 = insertelement <16 x i8> %in, i8 %e.16, i32 16 | |
255 ; CHECK-NEXT: ret <16 x i8> %[[ILOAD]] | |
256 ret <16 x i8> %i.16 | |
257 } | |
258 | |
259 define <8 x i16> @test_8xi16_out_of_range(<8 x i16> %in) { | |
260 ; CHECK: @test_8xi16_out_of_range | |
261 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 | |
262 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i16* %[[EALLOCA]] to <8 x i16>* | |
263 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ECAST]], align 4 | |
264 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i16* %[[EALLOCA]], i32 8 | |
265 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i16* %[[EGEP]], align 2 | |
266 %e.8 = extractelement <8 x i16> %in, i32 8 | |
267 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 | |
268 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i16* %[[IALLOCA]] to <8 x i16>* | |
269 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ICAST]], align 4 | |
270 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i16* %[[IALLOCA]], i32 8 | |
271 ; CHECK-NEXT: store i16 %[[ELOAD]], i16* %[[IGEP]], align 2 | |
272 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i16>* %[[ICAST]], align 4 | |
273 %i.8 = insertelement <8 x i16> %in, i16 %e.8, i32 8 | |
274 ; CHECK-NEXT: ret <8 x i16> %[[ILOAD]] | |
275 ret <8 x i16> %i.8 | |
276 } | |
277 | |
278 define <4 x i32> @test_4xi32_out_of_range(<4 x i32> %in) { | |
279 ; CHECK: @test_4xi32_out_of_range | |
280 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 | |
281 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i32* %[[EALLOCA]] to <4 x i32>* | |
282 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ECAST]], align 4 | |
283 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i32* %[[EALLOCA]], i32 4 | |
284 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i32* %[[EGEP]], align 4 | |
285 %e.4 = extractelement <4 x i32> %in, i32 4 | |
286 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 | |
287 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i32* %[[IALLOCA]] to <4 x i32>* | |
288 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ICAST]], align 4 | |
289 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i32* %[[IALLOCA]], i32 4 | |
290 ; CHECK-NEXT: store i32 %[[ELOAD]], i32* %[[IGEP]], align 4 | |
291 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i32>* %[[ICAST]], align 4 | |
292 %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 4 | |
293 ; CHECK-NEXT: ret <4 x i32> %[[ILOAD]] | |
294 ret <4 x i32> %i.4 | |
295 } | |
296 | |
297 define <4 x float> @test_4xfloat_out_of_range(<4 x float> %in) { | |
298 ; CHECK: @test_4xfloat_out_of_range | |
299 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca float, i32 4, align 4 | |
300 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast float* %[[EALLOCA]] to <4 x float>* | |
301 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ECAST]], align 4 | |
302 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr float* %[[EALLOCA]], i32 4 | |
303 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load float* %[[EGEP]], align 4 | |
304 %e.4 = extractelement <4 x float> %in, i32 4 | |
305 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca float, i32 4, align 4 | |
306 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast float* %[[IALLOCA]] to <4 x float>* | |
307 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ICAST]], align 4 | |
308 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr float* %[[IALLOCA]], i32 4 | |
309 ; CHECK-NEXT: store float %[[ELOAD]], float* %[[IGEP]], align 4 | |
310 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x float>* %[[ICAST]], align 4 | |
311 %i.4 = insertelement <4 x float> %in, float %e.4, i32 4 | |
312 ; CHECK-NEXT: ret <4 x float> %[[ILOAD]] | |
313 ret <4 x float> %i.4 | |
314 } | |
315 | |
316 | |
317 ; The following insert/extract elements are all indexed with a variable, | |
318 ; they should get modified. | |
319 | |
320 define <16 x i1> @test_16xi1_variable(<16 x i1> %in, i32 %idx) { | |
321 ; CHECK: @test_16xi1_variable | |
322 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 | |
323 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <16 x i1>* | |
324 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ECAST]], align 16 | |
325 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx | |
326 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
327 %e.16 = extractelement <16 x i1> %in, i32 %idx | |
328 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 16, align 16 | |
329 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <16 x i1>* | |
330 ; CHECK-NEXT: store <16 x i1> %in, <16 x i1>* %[[ICAST]], align 16 | |
331 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx | |
332 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
333 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i1>* %[[ICAST]], align 16 | |
334 %i.16 = insertelement <16 x i1> %in, i1 %e.16, i32 %idx | |
335 ; CHECK-NEXT: ret <16 x i1> %[[ILOAD]] | |
336 ret <16 x i1> %i.16 | |
337 } | |
338 | |
339 define <8 x i1> @test_8xi1_variable(<8 x i1> %in, i32 %idx) { | |
340 ; CHECK: @test_8xi1_variable | |
341 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 | |
342 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <8 x i1>* | |
343 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ECAST]], align 8 | |
344 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx | |
345 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
346 %e.8 = extractelement <8 x i1> %in, i32 %idx | |
347 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 8, align 8 | |
348 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <8 x i1>* | |
349 ; CHECK-NEXT: store <8 x i1> %in, <8 x i1>* %[[ICAST]], align 8 | |
350 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx | |
351 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
352 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i1>* %[[ICAST]], align 8 | |
353 %i.8 = insertelement <8 x i1> %in, i1 %e.8, i32 %idx | |
354 ; CHECK-NEXT: ret <8 x i1> %[[ILOAD]] | |
355 ret <8 x i1> %i.8 | |
356 } | |
357 | |
358 define <4 x i1> @test_4xi1_variable(<4 x i1> %in, i32 %idx) { | |
359 ; CHECK: @test_4xi1_variable | |
360 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 | |
361 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i1* %[[EALLOCA]] to <4 x i1>* | |
362 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ECAST]], align 4 | |
363 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i1* %[[EALLOCA]], i32 %idx | |
364 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i1* %[[EGEP]], align 1 | |
365 %e.4 = extractelement <4 x i1> %in, i32 %idx | |
366 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i1, i32 4, align 4 | |
367 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i1* %[[IALLOCA]] to <4 x i1>* | |
368 ; CHECK-NEXT: store <4 x i1> %in, <4 x i1>* %[[ICAST]], align 4 | |
369 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i1* %[[IALLOCA]], i32 %idx | |
370 ; CHECK-NEXT: store i1 %[[ELOAD]], i1* %[[IGEP]], align 1 | |
371 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i1>* %[[ICAST]], align 4 | |
372 %i.4 = insertelement <4 x i1> %in, i1 %e.4, i32 %idx | |
373 ; CHECK-NEXT: ret <4 x i1> %[[ILOAD]] | |
374 ret <4 x i1> %i.4 | |
375 } | |
376 | |
377 define <16 x i8> @test_16xi8_variable(<16 x i8> %in, i32 %idx) { | |
378 ; CHECK: @test_16xi8_variable | |
379 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 | |
380 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i8* %[[EALLOCA]] to <16 x i8>* | |
381 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ECAST]], align 4 | |
382 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i8* %[[EALLOCA]], i32 %idx | |
383 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i8* %[[EGEP]], align 1 | |
384 %e.16 = extractelement <16 x i8> %in, i32 %idx | |
385 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i8, i32 16, align 4 | |
386 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i8* %[[IALLOCA]] to <16 x i8>* | |
387 ; CHECK-NEXT: store <16 x i8> %in, <16 x i8>* %[[ICAST]], align 4 | |
388 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i8* %[[IALLOCA]], i32 %idx | |
389 ; CHECK-NEXT: store i8 %[[ELOAD]], i8* %[[IGEP]], align 1 | |
390 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <16 x i8>* %[[ICAST]], align 4 | |
391 %i.16 = insertelement <16 x i8> %in, i8 %e.16, i32 %idx | |
392 ; CHECK-NEXT: ret <16 x i8> %[[ILOAD]] | |
393 ret <16 x i8> %i.16 | |
394 } | |
395 | |
396 define <8 x i16> @test_8xi16_variable(<8 x i16> %in, i32 %idx) { | |
397 ; CHECK: @test_8xi16_variable | |
398 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 | |
399 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i16* %[[EALLOCA]] to <8 x i16>* | |
400 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ECAST]], align 4 | |
401 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i16* %[[EALLOCA]], i32 %idx | |
402 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i16* %[[EGEP]], align 2 | |
403 %e.8 = extractelement <8 x i16> %in, i32 %idx | |
404 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i16, i32 8, align 4 | |
405 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i16* %[[IALLOCA]] to <8 x i16>* | |
406 ; CHECK-NEXT: store <8 x i16> %in, <8 x i16>* %[[ICAST]], align 4 | |
407 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i16* %[[IALLOCA]], i32 %idx | |
408 ; CHECK-NEXT: store i16 %[[ELOAD]], i16* %[[IGEP]], align 2 | |
409 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <8 x i16>* %[[ICAST]], align 4 | |
410 %i.8 = insertelement <8 x i16> %in, i16 %e.8, i32 %idx | |
411 ; CHECK-NEXT: ret <8 x i16> %[[ILOAD]] | |
412 ret <8 x i16> %i.8 | |
413 } | |
414 | |
415 define <4 x i32> @test_4xi32_variable(<4 x i32> %in, i32 %idx) { | |
416 ; CHECK: @test_4xi32_variable | |
417 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 | |
418 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast i32* %[[EALLOCA]] to <4 x i32>* | |
419 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ECAST]], align 4 | |
420 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr i32* %[[EALLOCA]], i32 %idx | |
421 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load i32* %[[EGEP]], align 4 | |
422 %e.4 = extractelement <4 x i32> %in, i32 %idx | |
423 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca i32, i32 4, align 4 | |
424 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast i32* %[[IALLOCA]] to <4 x i32>* | |
425 ; CHECK-NEXT: store <4 x i32> %in, <4 x i32>* %[[ICAST]], align 4 | |
426 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr i32* %[[IALLOCA]], i32 %idx | |
427 ; CHECK-NEXT: store i32 %[[ELOAD]], i32* %[[IGEP]], align 4 | |
428 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x i32>* %[[ICAST]], align 4 | |
429 %i.4 = insertelement <4 x i32> %in, i32 %e.4, i32 %idx | |
430 ; CHECK-NEXT: ret <4 x i32> %[[ILOAD]] | |
431 ret <4 x i32> %i.4 | |
432 } | |
433 | |
434 define <4 x float> @test_4xfloat_variable(<4 x float> %in, i32 %idx) { | |
435 ; CHECK: @test_4xfloat_variable | |
436 ; CHECK-NEXT: %[[EALLOCA:[0-9]+]] = alloca float, i32 4, align 4 | |
437 ; CHECK-NEXT: %[[ECAST:[0-9]+]] = bitcast float* %[[EALLOCA]] to <4 x float>* | |
438 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ECAST]], align 4 | |
439 ; CHECK-NEXT: %[[EGEP:[0-9]+]] = getelementptr float* %[[EALLOCA]], i32 %idx | |
440 ; CHECK-NEXT: %[[ELOAD:[0-9]+]] = load float* %[[EGEP]], align 4 | |
441 %e.4 = extractelement <4 x float> %in, i32 %idx | |
442 ; CHECK-NEXT: %[[IALLOCA:[0-9]+]] = alloca float, i32 4, align 4 | |
443 ; CHECK-NEXT: %[[ICAST:[0-9]+]] = bitcast float* %[[IALLOCA]] to <4 x float>* | |
444 ; CHECK-NEXT: store <4 x float> %in, <4 x float>* %[[ICAST]], align 4 | |
445 ; CHECK-NEXT: %[[IGEP:[0-9]+]] = getelementptr float* %[[IALLOCA]], i32 %idx | |
446 ; CHECK-NEXT: store float %[[ELOAD]], float* %[[IGEP]], align 4 | |
447 ; CHECK-NEXT: %[[ILOAD:[0-9]+]] = load <4 x float>* %[[ICAST]], align 4 | |
448 %i.4 = insertelement <4 x float> %in, float %e.4, i32 %idx | |
449 ; CHECK-NEXT: ret <4 x float> %[[ILOAD]] | |
450 ret <4 x float> %i.4 | |
451 } | |
OLD | NEW |