1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=SSE2 | FileCheck %s --check-prefixes=CHECK
3 ; RUN: opt < %s -passes=vector-combine -S -mtriple=x86_64-- -mattr=AVX2 | FileCheck %s --check-prefixes=CHECK
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7 declare void @use(i64*)
9 ;-------------------------------------------------------------------------------
11 define void @both_operands_need_extraction.2elts(<2 x i64*> %baseptrs, <2 x i64> %indices) {
12 ; CHECK-LABEL: @both_operands_need_extraction.2elts(
13 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS:%.*]], <2 x i64> [[INDICES:%.*]]
14 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
15 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
16 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
17 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
18 ; CHECK-NEXT: ret void
20 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs, <2 x i64> %indices
22 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
23 call void @use(i64* %ptr.0)
25 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
26 call void @use(i64* %ptr.1)
31 define void @both_operands_need_extraction.3elts(<3 x i64*> %baseptrs, <3 x i64> %indices) {
32 ; CHECK-LABEL: @both_operands_need_extraction.3elts(
33 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], <3 x i64> [[INDICES:%.*]]
34 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
35 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
36 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
37 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
38 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
39 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
40 ; CHECK-NEXT: ret void
42 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, <3 x i64> %indices
44 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
45 call void @use(i64* %ptr.0)
47 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
48 call void @use(i64* %ptr.1)
50 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
51 call void @use(i64* %ptr.2)
56 define void @both_operands_need_extraction.4elts(<4 x i64*> %baseptrs, <4 x i64> %indices) {
57 ; CHECK-LABEL: @both_operands_need_extraction.4elts(
58 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <4 x i64*> [[BASEPTRS:%.*]], <4 x i64> [[INDICES:%.*]]
59 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
60 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
61 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
62 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
63 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
64 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
65 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
66 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
67 ; CHECK-NEXT: ret void
69 %ptrs = getelementptr inbounds i64, <4 x i64*> %baseptrs, <4 x i64> %indices
71 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
72 call void @use(i64* %ptr.0)
74 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
75 call void @use(i64* %ptr.1)
77 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
78 call void @use(i64* %ptr.2)
80 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
81 call void @use(i64* %ptr.3)
86 ;-------------------------------------------------------------------------------
88 define void @indicies_need_extraction.2elts(i64* %baseptr, <2 x i64> %indices) {
89 ; CHECK-LABEL: @indicies_need_extraction.2elts(
90 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, i64* [[BASEPTR:%.*]], <2 x i64> [[INDICES:%.*]]
91 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
92 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
93 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
94 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
95 ; CHECK-NEXT: ret void
97 %ptrs = getelementptr inbounds i64, i64* %baseptr, <2 x i64> %indices
99 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
100 call void @use(i64* %ptr.0)
102 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
103 call void @use(i64* %ptr.1)
108 define void @indicies_need_extraction.3elts(i64* %baseptr, <3 x i64> %indices) {
109 ; CHECK-LABEL: @indicies_need_extraction.3elts(
110 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, i64* [[BASEPTR:%.*]], <3 x i64> [[INDICES:%.*]]
111 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
112 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
113 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
114 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
115 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
116 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
117 ; CHECK-NEXT: ret void
119 %ptrs = getelementptr inbounds i64, i64* %baseptr, <3 x i64> %indices
121 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
122 call void @use(i64* %ptr.0)
124 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
125 call void @use(i64* %ptr.1)
127 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
128 call void @use(i64* %ptr.2)
133 define void @indicies_need_extraction.4elts(i64* %baseptr, <4 x i64> %indices) {
134 ; CHECK-LABEL: @indicies_need_extraction.4elts(
135 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, i64* [[BASEPTR:%.*]], <4 x i64> [[INDICES:%.*]]
136 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
137 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
138 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
139 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
140 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
141 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
142 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
143 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
144 ; CHECK-NEXT: ret void
146 %ptrs = getelementptr inbounds i64, i64* %baseptr, <4 x i64> %indices
148 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
149 call void @use(i64* %ptr.0)
151 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
152 call void @use(i64* %ptr.1)
154 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
155 call void @use(i64* %ptr.2)
157 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
158 call void @use(i64* %ptr.3)
163 ;-------------------------------------------------------------------------------
165 define void @baseptrs_need_extraction.2elts(<2 x i64*> %baseptrs, i64 %indice) {
166 ; CHECK-LABEL: @baseptrs_need_extraction.2elts(
167 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS:%.*]], i64 [[INDICE:%.*]]
168 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
169 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
170 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
171 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
172 ; CHECK-NEXT: ret void
174 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs, i64 %indice
176 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
177 call void @use(i64* %ptr.0)
179 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
180 call void @use(i64* %ptr.1)
185 define void @baseptrs_need_extraction.3elts(<3 x i64*> %baseptrs, i64 %indice) {
186 ; CHECK-LABEL: @baseptrs_need_extraction.3elts(
187 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], i64 [[INDICE:%.*]]
188 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
189 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
190 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
191 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
192 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
193 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
194 ; CHECK-NEXT: ret void
196 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, i64 %indice
198 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
199 call void @use(i64* %ptr.0)
201 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
202 call void @use(i64* %ptr.1)
204 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
205 call void @use(i64* %ptr.2)
210 define void @baseptrs_need_extraction.4elts(<4 x i64*> %baseptrs, i64 %indice) {
211 ; CHECK-LABEL: @baseptrs_need_extraction.4elts(
212 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <4 x i64*> [[BASEPTRS:%.*]], i64 [[INDICE:%.*]]
213 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
214 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
215 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
216 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
217 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
218 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
219 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
220 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
221 ; CHECK-NEXT: ret void
223 %ptrs = getelementptr inbounds i64, <4 x i64*> %baseptrs, i64 %indice
225 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
226 call void @use(i64* %ptr.0)
228 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
229 call void @use(i64* %ptr.1)
231 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
232 call void @use(i64* %ptr.2)
234 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
235 call void @use(i64* %ptr.3)
240 ;-------------------------------------------------------------------------------
242 define void @first_baseptr_is_known.2elts(<2 x i64*> %baseptrs, i64* %second_baseptr, <2 x i64> %indices) {
243 ; CHECK-LABEL: @first_baseptr_is_known.2elts(
244 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <2 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
245 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS_NEW]], <2 x i64> [[INDICES:%.*]]
246 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
247 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
248 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
249 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
250 ; CHECK-NEXT: ret void
252 %baseptrs.new = insertelement <2 x i64*> %baseptrs, i64* %second_baseptr, i64 0
253 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs.new, <2 x i64> %indices
255 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
256 call void @use(i64* %ptr.0)
258 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
259 call void @use(i64* %ptr.1)
264 define void @first_indice_is_known.2elts(<2 x i64*> %baseptrs, <2 x i64> %indices, i64 %second_indice) {
265 ; CHECK-LABEL: @first_indice_is_known.2elts(
266 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <2 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
267 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS:%.*]], <2 x i64> [[INDICES_NEW]]
268 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
269 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
270 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
271 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
272 ; CHECK-NEXT: ret void
274 %indices.new = insertelement <2 x i64> %indices, i64 %second_indice, i64 0
275 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs, <2 x i64> %indices.new
277 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
278 call void @use(i64* %ptr.0)
280 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
281 call void @use(i64* %ptr.1)
286 define void @first_indice_and_baseptr_are_known.2elts(<2 x i64*> %baseptrs, i64* %second_baseptr, <2 x i64> %indices, i64 %second_indice) {
287 ; CHECK-LABEL: @first_indice_and_baseptr_are_known.2elts(
288 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <2 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
289 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <2 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
290 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS_NEW]], <2 x i64> [[INDICES_NEW]]
291 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
292 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
293 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
294 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
295 ; CHECK-NEXT: ret void
297 %baseptrs.new = insertelement <2 x i64*> %baseptrs, i64* %second_baseptr, i64 0
298 %indices.new = insertelement <2 x i64> %indices, i64 %second_indice, i64 0
299 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs.new, <2 x i64> %indices.new
301 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
302 call void @use(i64* %ptr.0)
304 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
305 call void @use(i64* %ptr.1)
310 ;-------------------------------------------------------------------------------
312 define void @first_baseptr_is_known.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices) {
313 ; CHECK-LABEL: @first_baseptr_is_known.3elts(
314 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
315 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES:%.*]]
316 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
317 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
318 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
319 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
320 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
321 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
322 ; CHECK-NEXT: ret void
324 %baseptrs.new = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
325 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices
327 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
328 call void @use(i64* %ptr.0)
330 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
331 call void @use(i64* %ptr.1)
333 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
334 call void @use(i64* %ptr.2)
339 define void @first_indice_is_known.3elts(<3 x i64*> %baseptrs, <3 x i64> %indices, i64 %second_indice) {
340 ; CHECK-LABEL: @first_indice_is_known.3elts(
341 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
342 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], <3 x i64> [[INDICES_NEW]]
343 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
344 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
345 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
346 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
347 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
348 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
349 ; CHECK-NEXT: ret void
351 %indices.new = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
352 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, <3 x i64> %indices.new
354 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
355 call void @use(i64* %ptr.0)
357 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
358 call void @use(i64* %ptr.1)
360 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
361 call void @use(i64* %ptr.2)
366 define void @first_indice_and_baseptr_are_known.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices, i64 %second_indice) {
367 ; CHECK-LABEL: @first_indice_and_baseptr_are_known.3elts(
368 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
369 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
370 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES_NEW]]
371 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
372 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
373 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
374 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
375 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
376 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
377 ; CHECK-NEXT: ret void
379 %baseptrs.new = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
380 %indices.new = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
381 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices.new
383 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
384 call void @use(i64* %ptr.0)
386 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
387 call void @use(i64* %ptr.1)
389 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
390 call void @use(i64* %ptr.2)
395 ;-------------------------------------------------------------------------------
397 define void @first_two_baseptrs_is_known.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, i64* %third_baseptr, <3 x i64> %indices) {
398 ; CHECK-LABEL: @first_two_baseptrs_is_known.3elts(
399 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
400 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[THIRD_BASEPTR:%.*]], i64 1
401 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES:%.*]]
402 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
403 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
404 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
405 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
406 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
407 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
408 ; CHECK-NEXT: ret void
410 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
411 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %third_baseptr, i64 1
412 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices
414 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
415 call void @use(i64* %ptr.0)
417 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
418 call void @use(i64* %ptr.1)
420 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
421 call void @use(i64* %ptr.2)
426 define void @first_two_indices_is_known.3elts(<3 x i64*> %baseptrs, <3 x i64> %indices, i64 %second_indice, i64 %third_indice) {
427 ; CHECK-LABEL: @first_two_indices_is_known.3elts(
428 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
429 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[THIRD_INDICE:%.*]], i64 1
430 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], <3 x i64> [[INDICES_NEW]]
431 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
432 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
433 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
434 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
435 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
436 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
437 ; CHECK-NEXT: ret void
439 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
440 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %third_indice, i64 1
441 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, <3 x i64> %indices.new
443 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
444 call void @use(i64* %ptr.0)
446 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
447 call void @use(i64* %ptr.1)
449 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
450 call void @use(i64* %ptr.2)
455 define void @first_two_indices_and_first_two_baseptrs_are_known.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, i64* %third_baseptr, <3 x i64> %indices, i64 %second_indice, i64 %third_indice) {
456 ; CHECK-LABEL: @first_two_indices_and_first_two_baseptrs_are_known.3elts(
457 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
458 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[THIRD_BASEPTR:%.*]], i64 1
459 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
460 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[THIRD_INDICE:%.*]], i64 1
461 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES_NEW]]
462 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
463 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
464 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
465 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
466 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
467 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
468 ; CHECK-NEXT: ret void
470 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
471 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %third_baseptr, i64 1
472 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
473 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %third_indice, i64 1
474 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices.new
476 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
477 call void @use(i64* %ptr.0)
479 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
480 call void @use(i64* %ptr.1)
482 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
483 call void @use(i64* %ptr.2)
488 ;-------------------------------------------------------------------------------
490 define void @first_two_baseptrs_is_knownequal.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices) {
491 ; CHECK-LABEL: @first_two_baseptrs_is_knownequal.3elts(
492 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
493 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[SECOND_BASEPTR]], i64 1
494 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES:%.*]]
495 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
496 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
497 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
498 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
499 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
500 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
501 ; CHECK-NEXT: ret void
503 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
504 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %second_baseptr, i64 1
505 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices
507 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
508 call void @use(i64* %ptr.0)
510 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
511 call void @use(i64* %ptr.1)
513 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
514 call void @use(i64* %ptr.2)
519 define void @first_two_indices_is_knownequal.3elts(<3 x i64*> %baseptrs, <3 x i64> %indices, i64 %second_indice) {
520 ; CHECK-LABEL: @first_two_indices_is_knownequal.3elts(
521 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
522 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[SECOND_INDICE]], i64 1
523 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], <3 x i64> [[INDICES_NEW]]
524 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
525 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
526 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
527 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
528 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
529 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
530 ; CHECK-NEXT: ret void
532 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
533 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %second_indice, i64 1
534 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, <3 x i64> %indices.new
536 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
537 call void @use(i64* %ptr.0)
539 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
540 call void @use(i64* %ptr.1)
542 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
543 call void @use(i64* %ptr.2)
548 define void @first_two_indices_and_first_two_baseptrs_are_knownequal.3elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices, i64 %second_indice) {
549 ; CHECK-LABEL: @first_two_indices_and_first_two_baseptrs_are_knownequal.3elts(
550 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
551 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[SECOND_BASEPTR]], i64 1
552 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
553 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[SECOND_INDICE]], i64 1
554 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES_NEW]]
555 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
556 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
557 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
558 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
559 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
560 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
561 ; CHECK-NEXT: ret void
563 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
564 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %second_baseptr, i64 1
565 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
566 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %second_indice, i64 1
567 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices.new
569 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
570 call void @use(i64* %ptr.0)
572 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
573 call void @use(i64* %ptr.1)
575 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
576 call void @use(i64* %ptr.2)
581 ;-------------------------------------------------------------------------------
583 define void @first_baseptr_is_known.4elts(<4 x i64*> %baseptrs, i64* %second_baseptr, <4 x i64> %indices) {
584 ; CHECK-LABEL: @first_baseptr_is_known.4elts(
585 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <4 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
586 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <4 x i64*> [[BASEPTRS_NEW]], <4 x i64> [[INDICES:%.*]]
587 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
588 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
589 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
590 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
591 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
592 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
593 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
594 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
595 ; CHECK-NEXT: ret void
597 %baseptrs.new = insertelement <4 x i64*> %baseptrs, i64* %second_baseptr, i64 0
598 %ptrs = getelementptr inbounds i64, <4 x i64*> %baseptrs.new, <4 x i64> %indices
600 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
601 call void @use(i64* %ptr.0)
603 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
604 call void @use(i64* %ptr.1)
606 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
607 call void @use(i64* %ptr.2)
609 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
610 call void @use(i64* %ptr.3)
615 define void @first_indice_is_known.4elts(<4 x i64*> %baseptrs, <4 x i64> %indices, i64 %second_indice) {
616 ; CHECK-LABEL: @first_indice_is_known.4elts(
617 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <4 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
618 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <4 x i64*> [[BASEPTRS:%.*]], <4 x i64> [[INDICES_NEW]]
619 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
620 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
621 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
622 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
623 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
624 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
625 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
626 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
627 ; CHECK-NEXT: ret void
629 %indices.new = insertelement <4 x i64> %indices, i64 %second_indice, i64 0
630 %ptrs = getelementptr inbounds i64, <4 x i64*> %baseptrs, <4 x i64> %indices.new
632 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
633 call void @use(i64* %ptr.0)
635 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
636 call void @use(i64* %ptr.1)
638 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
639 call void @use(i64* %ptr.2)
641 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
642 call void @use(i64* %ptr.3)
647 define void @first_indice_and_first_baseptr_are_known.4elts(<4 x i64*> %baseptrs, i64* %second_baseptr, <4 x i64> %indices, i64 %second_indice) {
648 ; CHECK-LABEL: @first_indice_and_first_baseptr_are_known.4elts(
649 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <4 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
650 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <4 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
651 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <4 x i64*> [[BASEPTRS_NEW]], <4 x i64> [[INDICES_NEW]]
652 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 0
653 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
654 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 1
655 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
656 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 2
657 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
658 ; CHECK-NEXT: [[PTR_3:%.*]] = extractelement <4 x i64*> [[PTRS]], i64 3
659 ; CHECK-NEXT: call void @use(i64* [[PTR_3]])
660 ; CHECK-NEXT: ret void
662 %baseptrs.new = insertelement <4 x i64*> %baseptrs, i64* %second_baseptr, i64 0
663 %indices.new = insertelement <4 x i64> %indices, i64 %second_indice, i64 0
664 %ptrs = getelementptr inbounds i64, <4 x i64*> %baseptrs.new, <4 x i64> %indices.new
666 %ptr.0 = extractelement <4 x i64*> %ptrs, i64 0
667 call void @use(i64* %ptr.0)
669 %ptr.1 = extractelement <4 x i64*> %ptrs, i64 1
670 call void @use(i64* %ptr.1)
672 %ptr.2 = extractelement <4 x i64*> %ptrs, i64 2
673 call void @use(i64* %ptr.2)
675 %ptr.3 = extractelement <4 x i64*> %ptrs, i64 3
676 call void @use(i64* %ptr.3)
681 ;-------------------------------------------------------------------------------
683 define void @first_two_baseptrs_is_knownequal.4elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices) {
684 ; CHECK-LABEL: @first_two_baseptrs_is_knownequal.4elts(
685 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
686 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[SECOND_BASEPTR]], i64 1
687 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES:%.*]]
688 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
689 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
690 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
691 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
692 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
693 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
694 ; CHECK-NEXT: ret void
696 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
697 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %second_baseptr, i64 1
698 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices
700 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
701 call void @use(i64* %ptr.0)
703 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
704 call void @use(i64* %ptr.1)
706 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
707 call void @use(i64* %ptr.2)
712 define void @first_two_indices_is_knownequal.4elts(<3 x i64*> %baseptrs, <3 x i64> %indices, i64 %second_indice) {
713 ; CHECK-LABEL: @first_two_indices_is_knownequal.4elts(
714 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
715 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[SECOND_INDICE]], i64 1
716 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS:%.*]], <3 x i64> [[INDICES_NEW]]
717 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
718 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
719 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
720 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
721 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
722 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
723 ; CHECK-NEXT: ret void
725 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
726 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %second_indice, i64 1
727 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs, <3 x i64> %indices.new
729 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
730 call void @use(i64* %ptr.0)
732 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
733 call void @use(i64* %ptr.1)
735 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
736 call void @use(i64* %ptr.2)
741 define void @first_two_indices_and_first_two_baseptrs_are_knownequal.4elts(<3 x i64*> %baseptrs, i64* %second_baseptr, <3 x i64> %indices, i64 %second_indice) {
742 ; CHECK-LABEL: @first_two_indices_and_first_two_baseptrs_are_knownequal.4elts(
743 ; CHECK-NEXT: [[BASEPTRS_NEW_TMP:%.*]] = insertelement <3 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
744 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <3 x i64*> [[BASEPTRS_NEW_TMP]], i64* [[SECOND_BASEPTR]], i64 1
745 ; CHECK-NEXT: [[INDICES_NEW_TMP:%.*]] = insertelement <3 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
746 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <3 x i64> [[INDICES_NEW_TMP]], i64 [[SECOND_INDICE]], i64 1
747 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <3 x i64*> [[BASEPTRS_NEW]], <3 x i64> [[INDICES_NEW]]
748 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 0
749 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
750 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 1
751 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
752 ; CHECK-NEXT: [[PTR_2:%.*]] = extractelement <3 x i64*> [[PTRS]], i64 2
753 ; CHECK-NEXT: call void @use(i64* [[PTR_2]])
754 ; CHECK-NEXT: ret void
756 %baseptrs.new.tmp = insertelement <3 x i64*> %baseptrs, i64* %second_baseptr, i64 0
757 %baseptrs.new = insertelement <3 x i64*> %baseptrs.new.tmp, i64* %second_baseptr, i64 1
758 %indices.new.tmp = insertelement <3 x i64> %indices, i64 %second_indice, i64 0
759 %indices.new = insertelement <3 x i64> %indices.new.tmp, i64 %second_indice, i64 1
760 %ptrs = getelementptr inbounds i64, <3 x i64*> %baseptrs.new, <3 x i64> %indices.new
762 %ptr.0 = extractelement <3 x i64*> %ptrs, i64 0
763 call void @use(i64* %ptr.0)
765 %ptr.1 = extractelement <3 x i64*> %ptrs, i64 1
766 call void @use(i64* %ptr.1)
768 %ptr.2 = extractelement <3 x i64*> %ptrs, i64 2
769 call void @use(i64* %ptr.2)
774 ;===============================================================================
776 define <2 x i64*> @first_indice_and_baseptr_need_extraction.2elts.extrause(<2 x i64*> %baseptrs, i64* %second_baseptr, <2 x i64> %indices, i64 %second_indice) {
777 ; CHECK-LABEL: @first_indice_and_baseptr_need_extraction.2elts.extrause(
778 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <2 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
779 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <2 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
780 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS_NEW]], <2 x i64> [[INDICES_NEW]]
781 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
782 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
783 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
784 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
785 ; CHECK-NEXT: ret <2 x i64*> [[PTRS]]
787 %baseptrs.new = insertelement <2 x i64*> %baseptrs, i64* %second_baseptr, i64 0
788 %indices.new = insertelement <2 x i64> %indices, i64 %second_indice, i64 0
789 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs.new, <2 x i64> %indices.new
791 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
792 call void @use(i64* %ptr.0)
794 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
795 call void @use(i64* %ptr.1)
800 define i64* @first_indice_and_baseptr_need_extraction.2elts.variable_extraction(<2 x i64*> %baseptrs, i64* %second_baseptr, <2 x i64> %indices, i64 %second_indice, i64 %variable_extract_idx) {
801 ; CHECK-LABEL: @first_indice_and_baseptr_need_extraction.2elts.variable_extraction(
802 ; CHECK-NEXT: [[BASEPTRS_NEW:%.*]] = insertelement <2 x i64*> [[BASEPTRS:%.*]], i64* [[SECOND_BASEPTR:%.*]], i64 0
803 ; CHECK-NEXT: [[INDICES_NEW:%.*]] = insertelement <2 x i64> [[INDICES:%.*]], i64 [[SECOND_INDICE:%.*]], i64 0
804 ; CHECK-NEXT: [[PTRS:%.*]] = getelementptr inbounds i64, <2 x i64*> [[BASEPTRS_NEW]], <2 x i64> [[INDICES_NEW]]
805 ; CHECK-NEXT: [[PTR_0:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 0
806 ; CHECK-NEXT: call void @use(i64* [[PTR_0]])
807 ; CHECK-NEXT: [[PTR_1:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 1
808 ; CHECK-NEXT: call void @use(i64* [[PTR_1]])
809 ; CHECK-NEXT: [[PTR_VAR:%.*]] = extractelement <2 x i64*> [[PTRS]], i64 [[VARIABLE_EXTRACT_IDX:%.*]]
810 ; CHECK-NEXT: ret i64* [[PTR_VAR]]
812 %baseptrs.new = insertelement <2 x i64*> %baseptrs, i64* %second_baseptr, i64 0
813 %indices.new = insertelement <2 x i64> %indices, i64 %second_indice, i64 0
814 %ptrs = getelementptr inbounds i64, <2 x i64*> %baseptrs.new, <2 x i64> %indices.new
816 %ptr.0 = extractelement <2 x i64*> %ptrs, i64 0
817 call void @use(i64* %ptr.0)
819 %ptr.1 = extractelement <2 x i64*> %ptrs, i64 1
820 call void @use(i64* %ptr.1)
822 %ptr.var = extractelement <2 x i64*> %ptrs, i64 %variable_extract_idx