1 ; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-atomic-cfg-tidy=0 -verify-machineinstrs -o - %s | FileCheck %s
3 ; This file contains tests for the AArch64 load/store optimizer.
5 %padding = type { i8*, i8*, i8*, i8* }
6 %s.byte = type { i8, i8 }
7 %s.halfword = type { i16, i16 }
8 %s.word = type { i32, i32 }
9 %s.doubleword = type { i64, i32 }
10 %s.quadword = type { fp128, i32 }
11 %s.float = type { float, i32 }
12 %s.double = type { double, i32 }
13 %struct.byte = type { %padding, %s.byte }
14 %struct.halfword = type { %padding, %s.halfword }
15 %struct.word = type { %padding, %s.word }
16 %struct.doubleword = type { %padding, %s.doubleword }
17 %struct.quadword = type { %padding, %s.quadword }
18 %struct.float = type { %padding, %s.float }
19 %struct.double = type { %padding, %s.double }
21 ; Check the following transform:
23 ; (ldr|str) X, [x0, #32]
27 ; (ldr|str) X, [x0, #32]!
29 ; with X being either w1, x1, s0, d0 or q0.
31 declare void @bar_byte(%s.byte*, i8)
33 define void @load-pre-indexed-byte(%struct.byte* %ptr) nounwind {
34 ; CHECK-LABEL: load-pre-indexed-byte
35 ; CHECK: ldrb w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
37 %a = getelementptr inbounds %struct.byte, %struct.byte* %ptr, i64 0, i32 1, i32 0
38 %add = load i8, i8* %a, align 4
41 %c = getelementptr inbounds %struct.byte, %struct.byte* %ptr, i64 0, i32 1
42 tail call void @bar_byte(%s.byte* %c, i8 %add)
46 define void @store-pre-indexed-byte(%struct.byte* %ptr, i8 %val) nounwind {
47 ; CHECK-LABEL: store-pre-indexed-byte
48 ; CHECK: strb w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
50 %a = getelementptr inbounds %struct.byte, %struct.byte* %ptr, i64 0, i32 1, i32 0
51 store i8 %val, i8* %a, align 4
54 %c = getelementptr inbounds %struct.byte, %struct.byte* %ptr, i64 0, i32 1
55 tail call void @bar_byte(%s.byte* %c, i8 %val)
59 declare void @bar_halfword(%s.halfword*, i16)
61 define void @load-pre-indexed-halfword(%struct.halfword* %ptr) nounwind {
62 ; CHECK-LABEL: load-pre-indexed-halfword
63 ; CHECK: ldrh w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
65 %a = getelementptr inbounds %struct.halfword, %struct.halfword* %ptr, i64 0, i32 1, i32 0
66 %add = load i16, i16* %a, align 4
69 %c = getelementptr inbounds %struct.halfword, %struct.halfword* %ptr, i64 0, i32 1
70 tail call void @bar_halfword(%s.halfword* %c, i16 %add)
74 define void @store-pre-indexed-halfword(%struct.halfword* %ptr, i16 %val) nounwind {
75 ; CHECK-LABEL: store-pre-indexed-halfword
76 ; CHECK: strh w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
78 %a = getelementptr inbounds %struct.halfword, %struct.halfword* %ptr, i64 0, i32 1, i32 0
79 store i16 %val, i16* %a, align 4
82 %c = getelementptr inbounds %struct.halfword, %struct.halfword* %ptr, i64 0, i32 1
83 tail call void @bar_halfword(%s.halfword* %c, i16 %val)
87 declare void @bar_word(%s.word*, i32)
89 define void @load-pre-indexed-word(%struct.word* %ptr) nounwind {
90 ; CHECK-LABEL: load-pre-indexed-word
91 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
93 %a = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 0
94 %add = load i32, i32* %a, align 4
97 %c = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1
98 tail call void @bar_word(%s.word* %c, i32 %add)
102 define void @store-pre-indexed-word(%struct.word* %ptr, i32 %val) nounwind {
103 ; CHECK-LABEL: store-pre-indexed-word
104 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
106 %a = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 0
107 store i32 %val, i32* %a, align 4
110 %c = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1
111 tail call void @bar_word(%s.word* %c, i32 %val)
115 declare void @bar_doubleword(%s.doubleword*, i64)
117 define void @load-pre-indexed-doubleword(%struct.doubleword* %ptr) nounwind {
118 ; CHECK-LABEL: load-pre-indexed-doubleword
119 ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}, #32]!
121 %a = getelementptr inbounds %struct.doubleword, %struct.doubleword* %ptr, i64 0, i32 1, i32 0
122 %add = load i64, i64* %a, align 4
125 %c = getelementptr inbounds %struct.doubleword, %struct.doubleword* %ptr, i64 0, i32 1
126 tail call void @bar_doubleword(%s.doubleword* %c, i64 %add)
130 define void @store-pre-indexed-doubleword(%struct.doubleword* %ptr, i64 %val) nounwind {
131 ; CHECK-LABEL: store-pre-indexed-doubleword
132 ; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}, #32]!
134 %a = getelementptr inbounds %struct.doubleword, %struct.doubleword* %ptr, i64 0, i32 1, i32 0
135 store i64 %val, i64* %a, align 4
138 %c = getelementptr inbounds %struct.doubleword, %struct.doubleword* %ptr, i64 0, i32 1
139 tail call void @bar_doubleword(%s.doubleword* %c, i64 %val)
143 declare void @bar_quadword(%s.quadword*, fp128)
145 define void @load-pre-indexed-quadword(%struct.quadword* %ptr) nounwind {
146 ; CHECK-LABEL: load-pre-indexed-quadword
147 ; CHECK: ldr q{{[0-9]+}}, [x{{[0-9]+}}, #32]!
149 %a = getelementptr inbounds %struct.quadword, %struct.quadword* %ptr, i64 0, i32 1, i32 0
150 %add = load fp128, fp128* %a, align 4
153 %c = getelementptr inbounds %struct.quadword, %struct.quadword* %ptr, i64 0, i32 1
154 tail call void @bar_quadword(%s.quadword* %c, fp128 %add)
158 define void @store-pre-indexed-quadword(%struct.quadword* %ptr, fp128 %val) nounwind {
159 ; CHECK-LABEL: store-pre-indexed-quadword
160 ; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}, #32]!
162 %a = getelementptr inbounds %struct.quadword, %struct.quadword* %ptr, i64 0, i32 1, i32 0
163 store fp128 %val, fp128* %a, align 4
166 %c = getelementptr inbounds %struct.quadword, %struct.quadword* %ptr, i64 0, i32 1
167 tail call void @bar_quadword(%s.quadword* %c, fp128 %val)
171 declare void @bar_float(%s.float*, float)
173 define void @load-pre-indexed-float(%struct.float* %ptr) nounwind {
174 ; CHECK-LABEL: load-pre-indexed-float
175 ; CHECK: ldr s{{[0-9]+}}, [x{{[0-9]+}}, #32]!
177 %a = getelementptr inbounds %struct.float, %struct.float* %ptr, i64 0, i32 1, i32 0
178 %add = load float, float* %a, align 4
181 %c = getelementptr inbounds %struct.float, %struct.float* %ptr, i64 0, i32 1
182 tail call void @bar_float(%s.float* %c, float %add)
186 define void @store-pre-indexed-float(%struct.float* %ptr, float %val) nounwind {
187 ; CHECK-LABEL: store-pre-indexed-float
188 ; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}, #32]!
190 %a = getelementptr inbounds %struct.float, %struct.float* %ptr, i64 0, i32 1, i32 0
191 store float %val, float* %a, align 4
194 %c = getelementptr inbounds %struct.float, %struct.float* %ptr, i64 0, i32 1
195 tail call void @bar_float(%s.float* %c, float %val)
199 declare void @bar_double(%s.double*, double)
201 define void @load-pre-indexed-double(%struct.double* %ptr) nounwind {
202 ; CHECK-LABEL: load-pre-indexed-double
203 ; CHECK: ldr d{{[0-9]+}}, [x{{[0-9]+}}, #32]!
205 %a = getelementptr inbounds %struct.double, %struct.double* %ptr, i64 0, i32 1, i32 0
206 %add = load double, double* %a, align 4
209 %c = getelementptr inbounds %struct.double, %struct.double* %ptr, i64 0, i32 1
210 tail call void @bar_double(%s.double* %c, double %add)
214 define void @store-pre-indexed-double(%struct.double* %ptr, double %val) nounwind {
215 ; CHECK-LABEL: store-pre-indexed-double
216 ; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}, #32]!
218 %a = getelementptr inbounds %struct.double, %struct.double* %ptr, i64 0, i32 1, i32 0
219 store double %val, double* %a, align 4
222 %c = getelementptr inbounds %struct.double, %struct.double* %ptr, i64 0, i32 1
223 tail call void @bar_double(%s.double* %c, double %val)
227 ; Check the following transform:
229 ; (ldp|stp) w1, w2 [x0, #32]
233 ; (ldp|stp) w1, w2, [x0, #32]!
236 define void @load-pair-pre-indexed-word(%struct.word* %ptr) nounwind {
237 ; CHECK-LABEL: load-pair-pre-indexed-word
238 ; CHECK: ldp w{{[0-9]+}}, w{{[0-9]+}}, [x0, #32]!
239 ; CHECK-NOT: add x0, x0, #32
241 %a = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 0
242 %a1 = load i32, i32* %a, align 4
243 %b = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 1
244 %b1 = load i32, i32* %b, align 4
245 %add = add i32 %a1, %b1
248 %c = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1
249 tail call void @bar_word(%s.word* %c, i32 %add)
253 define void @store-pair-pre-indexed-word(%struct.word* %ptr, i32 %val) nounwind {
254 ; CHECK-LABEL: store-pair-pre-indexed-word
255 ; CHECK: stp w{{[0-9]+}}, w{{[0-9]+}}, [x0, #32]!
256 ; CHECK-NOT: add x0, x0, #32
258 %a = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 0
259 store i32 %val, i32* %a, align 4
260 %b = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1, i32 1
261 store i32 %val, i32* %b, align 4
264 %c = getelementptr inbounds %struct.word, %struct.word* %ptr, i64 0, i32 1
265 tail call void @bar_word(%s.word* %c, i32 %val)
269 ; Check the following transform:
277 ; with X being either w0, x0, s0, d0 or q0.
279 %pre.struct.i32 = type { i32, i32, i32, i32, i32}
280 %pre.struct.i64 = type { i32, i64, i64, i64, i64}
281 %pre.struct.i128 = type { i32, <2 x i64>, <2 x i64>, <2 x i64>}
282 %pre.struct.float = type { i32, float, float, float}
283 %pre.struct.double = type { i32, double, double, double}
285 define i32 @load-pre-indexed-word2(%pre.struct.i32** %this, i1 %cond,
286 %pre.struct.i32* %load2) nounwind {
287 ; CHECK-LABEL: load-pre-indexed-word2
288 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, #4]!
289 br i1 %cond, label %if.then, label %if.end
291 %load1 = load %pre.struct.i32*, %pre.struct.i32** %this
292 %gep1 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load1, i64 0, i32 1
295 %gep2 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load2, i64 0, i32 2
298 %retptr = phi i32* [ %gep1, %if.then ], [ %gep2, %if.end ]
299 %ret = load i32, i32* %retptr
303 define i64 @load-pre-indexed-doubleword2(%pre.struct.i64** %this, i1 %cond,
304 %pre.struct.i64* %load2) nounwind {
305 ; CHECK-LABEL: load-pre-indexed-doubleword2
306 ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}, #8]!
307 br i1 %cond, label %if.then, label %if.end
309 %load1 = load %pre.struct.i64*, %pre.struct.i64** %this
310 %gep1 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load1, i64 0, i32 1
313 %gep2 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load2, i64 0, i32 2
316 %retptr = phi i64* [ %gep1, %if.then ], [ %gep2, %if.end ]
317 %ret = load i64, i64* %retptr
321 define <2 x i64> @load-pre-indexed-quadword2(%pre.struct.i128** %this, i1 %cond,
322 %pre.struct.i128* %load2) nounwind {
323 ; CHECK-LABEL: load-pre-indexed-quadword2
324 ; CHECK: ldr q{{[0-9]+}}, [x{{[0-9]+}}, #16]!
325 br i1 %cond, label %if.then, label %if.end
327 %load1 = load %pre.struct.i128*, %pre.struct.i128** %this
328 %gep1 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load1, i64 0, i32 1
331 %gep2 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load2, i64 0, i32 2
334 %retptr = phi <2 x i64>* [ %gep1, %if.then ], [ %gep2, %if.end ]
335 %ret = load <2 x i64>, <2 x i64>* %retptr
339 define float @load-pre-indexed-float2(%pre.struct.float** %this, i1 %cond,
340 %pre.struct.float* %load2) nounwind {
341 ; CHECK-LABEL: load-pre-indexed-float2
342 ; CHECK: ldr s{{[0-9]+}}, [x{{[0-9]+}}, #4]!
343 br i1 %cond, label %if.then, label %if.end
345 %load1 = load %pre.struct.float*, %pre.struct.float** %this
346 %gep1 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load1, i64 0, i32 1
349 %gep2 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load2, i64 0, i32 2
352 %retptr = phi float* [ %gep1, %if.then ], [ %gep2, %if.end ]
353 %ret = load float, float* %retptr
357 define double @load-pre-indexed-double2(%pre.struct.double** %this, i1 %cond,
358 %pre.struct.double* %load2) nounwind {
359 ; CHECK-LABEL: load-pre-indexed-double2
360 ; CHECK: ldr d{{[0-9]+}}, [x{{[0-9]+}}, #8]!
361 br i1 %cond, label %if.then, label %if.end
363 %load1 = load %pre.struct.double*, %pre.struct.double** %this
364 %gep1 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load1, i64 0, i32 1
367 %gep2 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load2, i64 0, i32 2
370 %retptr = phi double* [ %gep1, %if.then ], [ %gep2, %if.end ]
371 %ret = load double, double* %retptr
375 define i32 @load-pre-indexed-word3(%pre.struct.i32** %this, i1 %cond,
376 %pre.struct.i32* %load2) nounwind {
377 ; CHECK-LABEL: load-pre-indexed-word3
378 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, #12]!
379 br i1 %cond, label %if.then, label %if.end
381 %load1 = load %pre.struct.i32*, %pre.struct.i32** %this
382 %gep1 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load1, i64 0, i32 3
385 %gep2 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load2, i64 0, i32 4
388 %retptr = phi i32* [ %gep1, %if.then ], [ %gep2, %if.end ]
389 %ret = load i32, i32* %retptr
393 define i64 @load-pre-indexed-doubleword3(%pre.struct.i64** %this, i1 %cond,
394 %pre.struct.i64* %load2) nounwind {
395 ; CHECK-LABEL: load-pre-indexed-doubleword3
396 ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}, #16]!
397 br i1 %cond, label %if.then, label %if.end
399 %load1 = load %pre.struct.i64*, %pre.struct.i64** %this
400 %gep1 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load1, i64 0, i32 2
403 %gep2 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load2, i64 0, i32 3
406 %retptr = phi i64* [ %gep1, %if.then ], [ %gep2, %if.end ]
407 %ret = load i64, i64* %retptr
411 define <2 x i64> @load-pre-indexed-quadword3(%pre.struct.i128** %this, i1 %cond,
412 %pre.struct.i128* %load2) nounwind {
413 ; CHECK-LABEL: load-pre-indexed-quadword3
414 ; CHECK: ldr q{{[0-9]+}}, [x{{[0-9]+}}, #32]!
415 br i1 %cond, label %if.then, label %if.end
417 %load1 = load %pre.struct.i128*, %pre.struct.i128** %this
418 %gep1 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load1, i64 0, i32 2
421 %gep2 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load2, i64 0, i32 3
424 %retptr = phi <2 x i64>* [ %gep1, %if.then ], [ %gep2, %if.end ]
425 %ret = load <2 x i64>, <2 x i64>* %retptr
429 define float @load-pre-indexed-float3(%pre.struct.float** %this, i1 %cond,
430 %pre.struct.float* %load2) nounwind {
431 ; CHECK-LABEL: load-pre-indexed-float3
432 ; CHECK: ldr s{{[0-9]+}}, [x{{[0-9]+}}, #8]!
433 br i1 %cond, label %if.then, label %if.end
435 %load1 = load %pre.struct.float*, %pre.struct.float** %this
436 %gep1 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load1, i64 0, i32 2
439 %gep2 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load2, i64 0, i32 3
442 %retptr = phi float* [ %gep1, %if.then ], [ %gep2, %if.end ]
443 %ret = load float, float* %retptr
447 define double @load-pre-indexed-double3(%pre.struct.double** %this, i1 %cond,
448 %pre.struct.double* %load2) nounwind {
449 ; CHECK-LABEL: load-pre-indexed-double3
450 ; CHECK: ldr d{{[0-9]+}}, [x{{[0-9]+}}, #16]!
451 br i1 %cond, label %if.then, label %if.end
453 %load1 = load %pre.struct.double*, %pre.struct.double** %this
454 %gep1 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load1, i64 0, i32 2
457 %gep2 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load2, i64 0, i32 3
460 %retptr = phi double* [ %gep1, %if.then ], [ %gep2, %if.end ]
461 %ret = load double, double* %retptr
465 ; Check the following transform:
473 ; with X being either w0, x0, s0, d0 or q0.
475 define void @store-pre-indexed-word2(%pre.struct.i32** %this, i1 %cond,
476 %pre.struct.i32* %load2,
478 ; CHECK-LABEL: store-pre-indexed-word2
479 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #4]!
480 br i1 %cond, label %if.then, label %if.end
482 %load1 = load %pre.struct.i32*, %pre.struct.i32** %this
483 %gep1 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load1, i64 0, i32 1
486 %gep2 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load2, i64 0, i32 2
489 %retptr = phi i32* [ %gep1, %if.then ], [ %gep2, %if.end ]
490 store i32 %val, i32* %retptr
494 define void @store-pre-indexed-doubleword2(%pre.struct.i64** %this, i1 %cond,
495 %pre.struct.i64* %load2,
497 ; CHECK-LABEL: store-pre-indexed-doubleword2
498 ; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}, #8]!
499 br i1 %cond, label %if.then, label %if.end
501 %load1 = load %pre.struct.i64*, %pre.struct.i64** %this
502 %gep1 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load1, i64 0, i32 1
505 %gep2 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load2, i64 0, i32 2
508 %retptr = phi i64* [ %gep1, %if.then ], [ %gep2, %if.end ]
509 store i64 %val, i64* %retptr
513 define void @store-pre-indexed-quadword2(%pre.struct.i128** %this, i1 %cond,
514 %pre.struct.i128* %load2,
515 <2 x i64> %val) nounwind {
516 ; CHECK-LABEL: store-pre-indexed-quadword2
517 ; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}, #16]!
518 br i1 %cond, label %if.then, label %if.end
520 %load1 = load %pre.struct.i128*, %pre.struct.i128** %this
521 %gep1 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load1, i64 0, i32 1
524 %gep2 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load2, i64 0, i32 2
527 %retptr = phi <2 x i64>* [ %gep1, %if.then ], [ %gep2, %if.end ]
528 store <2 x i64> %val, <2 x i64>* %retptr
532 define void @store-pre-indexed-float2(%pre.struct.float** %this, i1 %cond,
533 %pre.struct.float* %load2,
534 float %val) nounwind {
535 ; CHECK-LABEL: store-pre-indexed-float2
536 ; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}, #4]!
537 br i1 %cond, label %if.then, label %if.end
539 %load1 = load %pre.struct.float*, %pre.struct.float** %this
540 %gep1 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load1, i64 0, i32 1
543 %gep2 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load2, i64 0, i32 2
546 %retptr = phi float* [ %gep1, %if.then ], [ %gep2, %if.end ]
547 store float %val, float* %retptr
551 define void @store-pre-indexed-double2(%pre.struct.double** %this, i1 %cond,
552 %pre.struct.double* %load2,
553 double %val) nounwind {
554 ; CHECK-LABEL: store-pre-indexed-double2
555 ; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}, #8]!
556 br i1 %cond, label %if.then, label %if.end
558 %load1 = load %pre.struct.double*, %pre.struct.double** %this
559 %gep1 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load1, i64 0, i32 1
562 %gep2 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load2, i64 0, i32 2
565 %retptr = phi double* [ %gep1, %if.then ], [ %gep2, %if.end ]
566 store double %val, double* %retptr
570 define void @store-pre-indexed-word3(%pre.struct.i32** %this, i1 %cond,
571 %pre.struct.i32* %load2,
573 ; CHECK-LABEL: store-pre-indexed-word3
574 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}, #12]!
575 br i1 %cond, label %if.then, label %if.end
577 %load1 = load %pre.struct.i32*, %pre.struct.i32** %this
578 %gep1 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load1, i64 0, i32 3
581 %gep2 = getelementptr inbounds %pre.struct.i32, %pre.struct.i32* %load2, i64 0, i32 4
584 %retptr = phi i32* [ %gep1, %if.then ], [ %gep2, %if.end ]
585 store i32 %val, i32* %retptr
589 define void @store-pre-indexed-doubleword3(%pre.struct.i64** %this, i1 %cond,
590 %pre.struct.i64* %load2,
592 ; CHECK-LABEL: store-pre-indexed-doubleword3
593 ; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}, #24]!
594 br i1 %cond, label %if.then, label %if.end
596 %load1 = load %pre.struct.i64*, %pre.struct.i64** %this
597 %gep1 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load1, i64 0, i32 3
600 %gep2 = getelementptr inbounds %pre.struct.i64, %pre.struct.i64* %load2, i64 0, i32 4
603 %retptr = phi i64* [ %gep1, %if.then ], [ %gep2, %if.end ]
604 store i64 %val, i64* %retptr
608 define void @store-pre-indexed-quadword3(%pre.struct.i128** %this, i1 %cond,
609 %pre.struct.i128* %load2,
610 <2 x i64> %val) nounwind {
611 ; CHECK-LABEL: store-pre-indexed-quadword3
612 ; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}, #32]!
613 br i1 %cond, label %if.then, label %if.end
615 %load1 = load %pre.struct.i128*, %pre.struct.i128** %this
616 %gep1 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load1, i64 0, i32 2
619 %gep2 = getelementptr inbounds %pre.struct.i128, %pre.struct.i128* %load2, i64 0, i32 3
622 %retptr = phi <2 x i64>* [ %gep1, %if.then ], [ %gep2, %if.end ]
623 store <2 x i64> %val, <2 x i64>* %retptr
627 define void @store-pre-indexed-float3(%pre.struct.float** %this, i1 %cond,
628 %pre.struct.float* %load2,
629 float %val) nounwind {
630 ; CHECK-LABEL: store-pre-indexed-float3
631 ; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}, #8]!
632 br i1 %cond, label %if.then, label %if.end
634 %load1 = load %pre.struct.float*, %pre.struct.float** %this
635 %gep1 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load1, i64 0, i32 2
638 %gep2 = getelementptr inbounds %pre.struct.float, %pre.struct.float* %load2, i64 0, i32 3
641 %retptr = phi float* [ %gep1, %if.then ], [ %gep2, %if.end ]
642 store float %val, float* %retptr
646 define void @store-pre-indexed-double3(%pre.struct.double** %this, i1 %cond,
647 %pre.struct.double* %load2,
648 double %val) nounwind {
649 ; CHECK-LABEL: store-pre-indexed-double3
650 ; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}, #16]!
651 br i1 %cond, label %if.then, label %if.end
653 %load1 = load %pre.struct.double*, %pre.struct.double** %this
654 %gep1 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load1, i64 0, i32 2
657 %gep2 = getelementptr inbounds %pre.struct.double, %pre.struct.double* %load2, i64 0, i32 3
660 %retptr = phi double* [ %gep1, %if.then ], [ %gep2, %if.end ]
661 store double %val, double* %retptr
665 ; Check the following transform:
673 ; with X being either w0, x0, s0, d0 or q0.
675 define void @load-post-indexed-byte(i8* %array, i64 %count) nounwind {
676 ; CHECK-LABEL: load-post-indexed-byte
677 ; CHECK: ldrb w{{[0-9]+}}, [x{{[0-9]+}}], #4
679 %gep1 = getelementptr i8, i8* %array, i64 2
683 %iv2 = phi i8* [ %gep3, %body ], [ %gep1, %entry ]
684 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
685 %gep2 = getelementptr i8, i8* %iv2, i64 -1
686 %load = load i8, i8* %gep2
687 call void @use-byte(i8 %load)
688 %load2 = load i8, i8* %iv2
689 call void @use-byte(i8 %load2)
690 %iv.next = add i64 %iv, -4
691 %gep3 = getelementptr i8, i8* %iv2, i64 4
692 %cond = icmp eq i64 %iv.next, 0
693 br i1 %cond, label %exit, label %body
699 define void @load-post-indexed-halfword(i16* %array, i64 %count) nounwind {
700 ; CHECK-LABEL: load-post-indexed-halfword
701 ; CHECK: ldrh w{{[0-9]+}}, [x{{[0-9]+}}], #8
703 %gep1 = getelementptr i16, i16* %array, i64 2
707 %iv2 = phi i16* [ %gep3, %body ], [ %gep1, %entry ]
708 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
709 %gep2 = getelementptr i16, i16* %iv2, i64 -1
710 %load = load i16, i16* %gep2
711 call void @use-halfword(i16 %load)
712 %load2 = load i16, i16* %iv2
713 call void @use-halfword(i16 %load2)
714 %iv.next = add i64 %iv, -4
715 %gep3 = getelementptr i16, i16* %iv2, i64 4
716 %cond = icmp eq i64 %iv.next, 0
717 br i1 %cond, label %exit, label %body
723 define void @load-post-indexed-word(i32* %array, i64 %count) nounwind {
724 ; CHECK-LABEL: load-post-indexed-word
725 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}], #16
727 %gep1 = getelementptr i32, i32* %array, i64 2
731 %iv2 = phi i32* [ %gep3, %body ], [ %gep1, %entry ]
732 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
733 %gep2 = getelementptr i32, i32* %iv2, i64 -1
734 %load = load i32, i32* %gep2
735 call void @use-word(i32 %load)
736 %load2 = load i32, i32* %iv2
737 call void @use-word(i32 %load2)
738 %iv.next = add i64 %iv, -4
739 %gep3 = getelementptr i32, i32* %iv2, i64 4
740 %cond = icmp eq i64 %iv.next, 0
741 br i1 %cond, label %exit, label %body
747 define void @load-post-indexed-doubleword(i64* %array, i64 %count) nounwind {
748 ; CHECK-LABEL: load-post-indexed-doubleword
749 ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}], #32
751 %gep1 = getelementptr i64, i64* %array, i64 2
755 %iv2 = phi i64* [ %gep3, %body ], [ %gep1, %entry ]
756 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
757 %gep2 = getelementptr i64, i64* %iv2, i64 -1
758 %load = load i64, i64* %gep2
759 call void @use-doubleword(i64 %load)
760 %load2 = load i64, i64* %iv2
761 call void @use-doubleword(i64 %load2)
762 %iv.next = add i64 %iv, -4
763 %gep3 = getelementptr i64, i64* %iv2, i64 4
764 %cond = icmp eq i64 %iv.next, 0
765 br i1 %cond, label %exit, label %body
771 define void @load-post-indexed-quadword(<2 x i64>* %array, i64 %count) nounwind {
772 ; CHECK-LABEL: load-post-indexed-quadword
773 ; CHECK: ldr q{{[0-9]+}}, [x{{[0-9]+}}], #64
775 %gep1 = getelementptr <2 x i64>, <2 x i64>* %array, i64 2
779 %iv2 = phi <2 x i64>* [ %gep3, %body ], [ %gep1, %entry ]
780 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
781 %gep2 = getelementptr <2 x i64>, <2 x i64>* %iv2, i64 -1
782 %load = load <2 x i64>, <2 x i64>* %gep2
783 call void @use-quadword(<2 x i64> %load)
784 %load2 = load <2 x i64>, <2 x i64>* %iv2
785 call void @use-quadword(<2 x i64> %load2)
786 %iv.next = add i64 %iv, -4
787 %gep3 = getelementptr <2 x i64>, <2 x i64>* %iv2, i64 4
788 %cond = icmp eq i64 %iv.next, 0
789 br i1 %cond, label %exit, label %body
795 define void @load-post-indexed-float(float* %array, i64 %count) nounwind {
796 ; CHECK-LABEL: load-post-indexed-float
797 ; CHECK: ldr s{{[0-9]+}}, [x{{[0-9]+}}], #16
799 %gep1 = getelementptr float, float* %array, i64 2
803 %iv2 = phi float* [ %gep3, %body ], [ %gep1, %entry ]
804 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
805 %gep2 = getelementptr float, float* %iv2, i64 -1
806 %load = load float, float* %gep2
807 call void @use-float(float %load)
808 %load2 = load float, float* %iv2
809 call void @use-float(float %load2)
810 %iv.next = add i64 %iv, -4
811 %gep3 = getelementptr float, float* %iv2, i64 4
812 %cond = icmp eq i64 %iv.next, 0
813 br i1 %cond, label %exit, label %body
819 define void @load-post-indexed-double(double* %array, i64 %count) nounwind {
820 ; CHECK-LABEL: load-post-indexed-double
821 ; CHECK: ldr d{{[0-9]+}}, [x{{[0-9]+}}], #32
823 %gep1 = getelementptr double, double* %array, i64 2
827 %iv2 = phi double* [ %gep3, %body ], [ %gep1, %entry ]
828 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
829 %gep2 = getelementptr double, double* %iv2, i64 -1
830 %load = load double, double* %gep2
831 call void @use-double(double %load)
832 %load2 = load double, double* %iv2
833 call void @use-double(double %load2)
834 %iv.next = add i64 %iv, -4
835 %gep3 = getelementptr double, double* %iv2, i64 4
836 %cond = icmp eq i64 %iv.next, 0
837 br i1 %cond, label %exit, label %body
843 ; Check the following transform:
851 ; with X being either w0, x0, s0, d0 or q0.
853 define void @store-post-indexed-byte(i8* %array, i64 %count, i8 %val) nounwind {
854 ; CHECK-LABEL: store-post-indexed-byte
855 ; CHECK: strb w{{[0-9]+}}, [x{{[0-9]+}}], #4
857 %gep1 = getelementptr i8, i8* %array, i64 2
861 %iv2 = phi i8* [ %gep3, %body ], [ %gep1, %entry ]
862 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
863 %gep2 = getelementptr i8, i8* %iv2, i64 -1
864 %load = load i8, i8* %gep2
865 call void @use-byte(i8 %load)
866 store i8 %val, i8* %iv2
867 %iv.next = add i64 %iv, -4
868 %gep3 = getelementptr i8, i8* %iv2, i64 4
869 %cond = icmp eq i64 %iv.next, 0
870 br i1 %cond, label %exit, label %body
876 define void @store-post-indexed-halfword(i16* %array, i64 %count, i16 %val) nounwind {
877 ; CHECK-LABEL: store-post-indexed-halfword
878 ; CHECK: strh w{{[0-9]+}}, [x{{[0-9]+}}], #8
880 %gep1 = getelementptr i16, i16* %array, i64 2
884 %iv2 = phi i16* [ %gep3, %body ], [ %gep1, %entry ]
885 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
886 %gep2 = getelementptr i16, i16* %iv2, i64 -1
887 %load = load i16, i16* %gep2
888 call void @use-halfword(i16 %load)
889 store i16 %val, i16* %iv2
890 %iv.next = add i64 %iv, -4
891 %gep3 = getelementptr i16, i16* %iv2, i64 4
892 %cond = icmp eq i64 %iv.next, 0
893 br i1 %cond, label %exit, label %body
899 define void @store-post-indexed-word(i32* %array, i64 %count, i32 %val) nounwind {
900 ; CHECK-LABEL: store-post-indexed-word
901 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}], #16
903 %gep1 = getelementptr i32, i32* %array, i64 2
907 %iv2 = phi i32* [ %gep3, %body ], [ %gep1, %entry ]
908 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
909 %gep2 = getelementptr i32, i32* %iv2, i64 -1
910 %load = load i32, i32* %gep2
911 call void @use-word(i32 %load)
912 store i32 %val, i32* %iv2
913 %iv.next = add i64 %iv, -4
914 %gep3 = getelementptr i32, i32* %iv2, i64 4
915 %cond = icmp eq i64 %iv.next, 0
916 br i1 %cond, label %exit, label %body
922 define void @store-post-indexed-doubleword(i64* %array, i64 %count, i64 %val) nounwind {
923 ; CHECK-LABEL: store-post-indexed-doubleword
924 ; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}], #32
926 %gep1 = getelementptr i64, i64* %array, i64 2
930 %iv2 = phi i64* [ %gep3, %body ], [ %gep1, %entry ]
931 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
932 %gep2 = getelementptr i64, i64* %iv2, i64 -1
933 %load = load i64, i64* %gep2
934 call void @use-doubleword(i64 %load)
935 store i64 %val, i64* %iv2
936 %iv.next = add i64 %iv, -4
937 %gep3 = getelementptr i64, i64* %iv2, i64 4
938 %cond = icmp eq i64 %iv.next, 0
939 br i1 %cond, label %exit, label %body
945 define void @store-post-indexed-quadword(<2 x i64>* %array, i64 %count, <2 x i64> %val) nounwind {
946 ; CHECK-LABEL: store-post-indexed-quadword
947 ; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}], #64
949 %gep1 = getelementptr <2 x i64>, <2 x i64>* %array, i64 2
953 %iv2 = phi <2 x i64>* [ %gep3, %body ], [ %gep1, %entry ]
954 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
955 %gep2 = getelementptr <2 x i64>, <2 x i64>* %iv2, i64 -1
956 %load = load <2 x i64>, <2 x i64>* %gep2
957 call void @use-quadword(<2 x i64> %load)
958 store <2 x i64> %val, <2 x i64>* %iv2
959 %iv.next = add i64 %iv, -4
960 %gep3 = getelementptr <2 x i64>, <2 x i64>* %iv2, i64 4
961 %cond = icmp eq i64 %iv.next, 0
962 br i1 %cond, label %exit, label %body
968 define void @store-post-indexed-float(float* %array, i64 %count, float %val) nounwind {
969 ; CHECK-LABEL: store-post-indexed-float
970 ; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}], #16
972 %gep1 = getelementptr float, float* %array, i64 2
976 %iv2 = phi float* [ %gep3, %body ], [ %gep1, %entry ]
977 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
978 %gep2 = getelementptr float, float* %iv2, i64 -1
979 %load = load float, float* %gep2
980 call void @use-float(float %load)
981 store float %val, float* %iv2
982 %iv.next = add i64 %iv, -4
983 %gep3 = getelementptr float, float* %iv2, i64 4
984 %cond = icmp eq i64 %iv.next, 0
985 br i1 %cond, label %exit, label %body
991 define void @store-post-indexed-double(double* %array, i64 %count, double %val) nounwind {
992 ; CHECK-LABEL: store-post-indexed-double
993 ; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}], #32
995 %gep1 = getelementptr double, double* %array, i64 2
999 %iv2 = phi double* [ %gep3, %body ], [ %gep1, %entry ]
1000 %iv = phi i64 [ %iv.next, %body ], [ %count, %entry ]
1001 %gep2 = getelementptr double, double* %iv2, i64 -1
1002 %load = load double, double* %gep2
1003 call void @use-double(double %load)
1004 store double %val, double* %iv2
1005 %iv.next = add i64 %iv, -4
1006 %gep3 = getelementptr double, double* %iv2, i64 4
1007 %cond = icmp eq i64 %iv.next, 0
1008 br i1 %cond, label %exit, label %body
1014 declare void @use-byte(i8)
1015 declare void @use-halfword(i16)
1016 declare void @use-word(i32)
1017 declare void @use-doubleword(i64)
1018 declare void @use-quadword(<2 x i64>)
1019 declare void @use-float(float)
1020 declare void @use-double(double)
1022 ; Check the following transform:
1028 ; stp w0, [x20], #32
1030 define void @store-pair-post-indexed-word() nounwind {
1031 ; CHECK-LABEL: store-pair-post-indexed-word
1032 ; CHECK: stp w{{[0-9]+}}, w{{[0-9]+}}, [sp], #16
1034 %src = alloca { i32, i32 }, align 8
1035 %dst = alloca { i32, i32 }, align 8
1037 %src.realp = getelementptr inbounds { i32, i32 }, { i32, i32 }* %src, i32 0, i32 0
1038 %src.real = load i32, i32* %src.realp
1039 %src.imagp = getelementptr inbounds { i32, i32 }, { i32, i32 }* %src, i32 0, i32 1
1040 %src.imag = load i32, i32* %src.imagp
1042 %dst.realp = getelementptr inbounds { i32, i32 }, { i32, i32 }* %dst, i32 0, i32 0
1043 %dst.imagp = getelementptr inbounds { i32, i32 }, { i32, i32 }* %dst, i32 0, i32 1
1044 store i32 %src.real, i32* %dst.realp
1045 store i32 %src.imag, i32* %dst.imagp
1049 define void @store-pair-post-indexed-doubleword() nounwind {
1050 ; CHECK-LABEL: store-pair-post-indexed-doubleword
1051 ; CHECK: stp x{{[0-9]+}}, x{{[0-9]+}}, [sp], #32
1053 %src = alloca { i64, i64 }, align 8
1054 %dst = alloca { i64, i64 }, align 8
1056 %src.realp = getelementptr inbounds { i64, i64 }, { i64, i64 }* %src, i32 0, i32 0
1057 %src.real = load i64, i64* %src.realp
1058 %src.imagp = getelementptr inbounds { i64, i64 }, { i64, i64 }* %src, i32 0, i32 1
1059 %src.imag = load i64, i64* %src.imagp
1061 %dst.realp = getelementptr inbounds { i64, i64 }, { i64, i64 }* %dst, i32 0, i32 0
1062 %dst.imagp = getelementptr inbounds { i64, i64 }, { i64, i64 }* %dst, i32 0, i32 1
1063 store i64 %src.real, i64* %dst.realp
1064 store i64 %src.imag, i64* %dst.imagp
1068 define void @store-pair-post-indexed-float() nounwind {
1069 ; CHECK-LABEL: store-pair-post-indexed-float
1070 ; CHECK: stp s{{[0-9]+}}, s{{[0-9]+}}, [sp], #16
1072 %src = alloca { float, float }, align 8
1073 %dst = alloca { float, float }, align 8
1075 %src.realp = getelementptr inbounds { float, float }, { float, float }* %src, i32 0, i32 0
1076 %src.real = load float, float* %src.realp
1077 %src.imagp = getelementptr inbounds { float, float }, { float, float }* %src, i32 0, i32 1
1078 %src.imag = load float, float* %src.imagp
1080 %dst.realp = getelementptr inbounds { float, float }, { float, float }* %dst, i32 0, i32 0
1081 %dst.imagp = getelementptr inbounds { float, float }, { float, float }* %dst, i32 0, i32 1
1082 store float %src.real, float* %dst.realp
1083 store float %src.imag, float* %dst.imagp
1087 define void @store-pair-post-indexed-double() nounwind {
1088 ; CHECK-LABEL: store-pair-post-indexed-double
1089 ; CHECK: stp d{{[0-9]+}}, d{{[0-9]+}}, [sp], #32
1091 %src = alloca { double, double }, align 8
1092 %dst = alloca { double, double }, align 8
1094 %src.realp = getelementptr inbounds { double, double }, { double, double }* %src, i32 0, i32 0
1095 %src.real = load double, double* %src.realp
1096 %src.imagp = getelementptr inbounds { double, double }, { double, double }* %src, i32 0, i32 1
1097 %src.imag = load double, double* %src.imagp
1099 %dst.realp = getelementptr inbounds { double, double }, { double, double }* %dst, i32 0, i32 0
1100 %dst.imagp = getelementptr inbounds { double, double }, { double, double }* %dst, i32 0, i32 1
1101 store double %src.real, double* %dst.realp
1102 store double %src.imag, double* %dst.imagp
1106 ; Check the following transform:
1108 ; (ldr|str) X, [x20]
1112 ; (ldr|str) X, [x20], #-16
1114 ; with X being either w0, x0, s0, d0 or q0.
1116 define void @post-indexed-sub-word(i32* %a, i32* %b, i64 %count) nounwind {
1117 ; CHECK-LABEL: post-indexed-sub-word
1118 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}], #-8
1119 ; CHECK: str w{{[0-9]+}}, [x{{[0-9]+}}], #-8
1122 %phi1 = phi i32* [ %gep4, %for.body ], [ %b, %0 ]
1123 %phi2 = phi i32* [ %gep3, %for.body ], [ %a, %0 ]
1124 %i = phi i64 [ %dec.i, %for.body], [ %count, %0 ]
1125 %gep1 = getelementptr i32, i32* %phi1, i64 -1
1126 %load1 = load i32, i32* %gep1
1127 %gep2 = getelementptr i32, i32* %phi2, i64 -1
1128 store i32 %load1, i32* %gep2
1129 %load2 = load i32, i32* %phi1
1130 store i32 %load2, i32* %phi2
1131 %dec.i = add nsw i64 %i, -1
1132 %gep3 = getelementptr i32, i32* %phi2, i64 -2
1133 %gep4 = getelementptr i32, i32* %phi1, i64 -2
1134 %cond = icmp sgt i64 %dec.i, 0
1135 br i1 %cond, label %for.body, label %end
1140 define void @post-indexed-sub-doubleword(i64* %a, i64* %b, i64 %count) nounwind {
1141 ; CHECK-LABEL: post-indexed-sub-doubleword
1142 ; CHECK: ldr x{{[0-9]+}}, [x{{[0-9]+}}], #-16
1143 ; CHECK: str x{{[0-9]+}}, [x{{[0-9]+}}], #-16
1146 %phi1 = phi i64* [ %gep4, %for.body ], [ %b, %0 ]
1147 %phi2 = phi i64* [ %gep3, %for.body ], [ %a, %0 ]
1148 %i = phi i64 [ %dec.i, %for.body], [ %count, %0 ]
1149 %gep1 = getelementptr i64, i64* %phi1, i64 -1
1150 %load1 = load i64, i64* %gep1
1151 %gep2 = getelementptr i64, i64* %phi2, i64 -1
1152 store i64 %load1, i64* %gep2
1153 %load2 = load i64, i64* %phi1
1154 store i64 %load2, i64* %phi2
1155 %dec.i = add nsw i64 %i, -1
1156 %gep3 = getelementptr i64, i64* %phi2, i64 -2
1157 %gep4 = getelementptr i64, i64* %phi1, i64 -2
1158 %cond = icmp sgt i64 %dec.i, 0
1159 br i1 %cond, label %for.body, label %end
1164 define void @post-indexed-sub-quadword(<2 x i64>* %a, <2 x i64>* %b, i64 %count) nounwind {
1165 ; CHECK-LABEL: post-indexed-sub-quadword
1166 ; CHECK: ldr q{{[0-9]+}}, [x{{[0-9]+}}], #-32
1167 ; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}], #-32
1170 %phi1 = phi <2 x i64>* [ %gep4, %for.body ], [ %b, %0 ]
1171 %phi2 = phi <2 x i64>* [ %gep3, %for.body ], [ %a, %0 ]
1172 %i = phi i64 [ %dec.i, %for.body], [ %count, %0 ]
1173 %gep1 = getelementptr <2 x i64>, <2 x i64>* %phi1, i64 -1
1174 %load1 = load <2 x i64>, <2 x i64>* %gep1
1175 %gep2 = getelementptr <2 x i64>, <2 x i64>* %phi2, i64 -1
1176 store <2 x i64> %load1, <2 x i64>* %gep2
1177 %load2 = load <2 x i64>, <2 x i64>* %phi1
1178 store <2 x i64> %load2, <2 x i64>* %phi2
1179 %dec.i = add nsw i64 %i, -1
1180 %gep3 = getelementptr <2 x i64>, <2 x i64>* %phi2, i64 -2
1181 %gep4 = getelementptr <2 x i64>, <2 x i64>* %phi1, i64 -2
1182 %cond = icmp sgt i64 %dec.i, 0
1183 br i1 %cond, label %for.body, label %end
1188 define void @post-indexed-sub-float(float* %a, float* %b, i64 %count) nounwind {
1189 ; CHECK-LABEL: post-indexed-sub-float
1190 ; CHECK: ldr s{{[0-9]+}}, [x{{[0-9]+}}], #-8
1191 ; CHECK: str s{{[0-9]+}}, [x{{[0-9]+}}], #-8
1194 %phi1 = phi float* [ %gep4, %for.body ], [ %b, %0 ]
1195 %phi2 = phi float* [ %gep3, %for.body ], [ %a, %0 ]
1196 %i = phi i64 [ %dec.i, %for.body], [ %count, %0 ]
1197 %gep1 = getelementptr float, float* %phi1, i64 -1
1198 %load1 = load float, float* %gep1
1199 %gep2 = getelementptr float, float* %phi2, i64 -1
1200 store float %load1, float* %gep2
1201 %load2 = load float, float* %phi1
1202 store float %load2, float* %phi2
1203 %dec.i = add nsw i64 %i, -1
1204 %gep3 = getelementptr float, float* %phi2, i64 -2
1205 %gep4 = getelementptr float, float* %phi1, i64 -2
1206 %cond = icmp sgt i64 %dec.i, 0
1207 br i1 %cond, label %for.body, label %end
1212 define void @post-indexed-sub-double(double* %a, double* %b, i64 %count) nounwind {
1213 ; CHECK-LABEL: post-indexed-sub-double
1214 ; CHECK: ldr d{{[0-9]+}}, [x{{[0-9]+}}], #-16
1215 ; CHECK: str d{{[0-9]+}}, [x{{[0-9]+}}], #-16
1218 %phi1 = phi double* [ %gep4, %for.body ], [ %b, %0 ]
1219 %phi2 = phi double* [ %gep3, %for.body ], [ %a, %0 ]
1220 %i = phi i64 [ %dec.i, %for.body], [ %count, %0 ]
1221 %gep1 = getelementptr double, double* %phi1, i64 -1
1222 %load1 = load double, double* %gep1
1223 %gep2 = getelementptr double, double* %phi2, i64 -1
1224 store double %load1, double* %gep2
1225 %load2 = load double, double* %phi1
1226 store double %load2, double* %phi2
1227 %dec.i = add nsw i64 %i, -1
1228 %gep3 = getelementptr double, double* %phi2, i64 -2
1229 %gep4 = getelementptr double, double* %phi1, i64 -2
1230 %cond = icmp sgt i64 %dec.i, 0
1231 br i1 %cond, label %for.body, label %end