1; RUN: llc < %s -march=arm64 -enable-misched=false -verify-machineinstrs | FileCheck %s
2
3; The next set of tests makes sure we can combine the second instruction into
4; the first.
5
6; CHECK-LABEL: ldp_int_aa
7; CHECK: ldp w8, w9, [x1]
8; CHECK: str w0, [x1, #8]
9; CHECK: ret
10define i32 @ldp_int_aa(i32 %a, i32* %p) nounwind {
11  %tmp = load i32, i32* %p, align 4
12  %str.ptr = getelementptr inbounds i32, i32* %p, i64 2
13  store i32 %a, i32* %str.ptr, align 4
14  %add.ptr = getelementptr inbounds i32, i32* %p, i64 1
15  %tmp1 = load i32, i32* %add.ptr, align 4
16  %add = add nsw i32 %tmp1, %tmp
17  ret i32 %add
18}
19
20; CHECK-LABEL: ldp_long_aa
21; CHECK: ldp x8, x9, [x1]
22; CHECK: str x0, [x1, #16]
23; CHECK: ret
24define i64 @ldp_long_aa(i64 %a, i64* %p) nounwind {
25  %tmp = load i64, i64* %p, align 8
26  %str.ptr = getelementptr inbounds i64, i64* %p, i64 2
27  store i64 %a, i64* %str.ptr, align 4
28  %add.ptr = getelementptr inbounds i64, i64* %p, i64 1
29  %tmp1 = load i64, i64* %add.ptr, align 8
30  %add = add nsw i64 %tmp1, %tmp
31  ret i64 %add
32}
33
34; CHECK-LABEL: ldp_float_aa
35; CHECK: str s0, [x0, #8]
36; CHECK: ldp s1, s0, [x0]
37; CHECK: ret
38define float @ldp_float_aa(float %a, float* %p) nounwind {
39  %tmp = load float, float* %p, align 4
40  %str.ptr = getelementptr inbounds float, float* %p, i64 2
41  store float %a, float* %str.ptr, align 4
42  %add.ptr = getelementptr inbounds float, float* %p, i64 1
43  %tmp1 = load float, float* %add.ptr, align 4
44  %add = fadd float %tmp, %tmp1
45  ret float %add
46}
47
48; CHECK-LABEL: ldp_double_aa
49; CHECK: str d0, [x0, #16]
50; CHECK: ldp d1, d0, [x0]
51; CHECK: ret
52define double @ldp_double_aa(double %a, double* %p) nounwind {
53  %tmp = load double, double* %p, align 8
54  %str.ptr = getelementptr inbounds double, double* %p, i64 2
55  store double %a, double* %str.ptr, align 4
56  %add.ptr = getelementptr inbounds double, double* %p, i64 1
57  %tmp1 = load double, double* %add.ptr, align 8
58  %add = fadd double %tmp, %tmp1
59  ret double %add
60}
61