blob: b2855f38a6399871b9cfd84f0f8114895a69f97a [file] [log] [blame]
Tilmann Scheller2d746bc2014-05-26 09:37:19 +00001; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s
2
3; This file contains tests for the AArch64 load/store optimizer.
4
5%struct.A = type { %struct.B, %struct.C }
6%struct.B = type { i8*, i8*, i8*, i8* }
7%struct.C = type { i32, i32 }
8
9; Check the following transform:
10;
11; ldr w1, [x0, #32]
12; ...
13; add x0, x0, #32
14; ->
15; ldr w1, [x0, #32]!
Tilmann Scheller968d5992014-05-26 09:40:40 +000016
Tilmann Scheller2d746bc2014-05-26 09:37:19 +000017define void @foo(%struct.A* %ptr) nounwind {
18; CHECK-LABEL: foo
19; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, #32]!
20entry:
21 %a = getelementptr inbounds %struct.A* %ptr, i64 0, i32 1, i32 0
22 %add = load i32* %a, align 4
23 br label %bar
24bar:
25 %c = getelementptr inbounds %struct.A* %ptr, i64 0, i32 1
Tilmann Scheller968d5992014-05-26 09:40:40 +000026 tail call void @bar(%struct.C* %c, i32 %add)
Tilmann Scheller2d746bc2014-05-26 09:37:19 +000027 ret void
28}
29
30declare void @bar(%struct.C*, i32)
31