1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s
3 ; RUN: llc < %s -global-isel -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix=GISEL
5 @x1 = external hidden global [2 x i64]
6 @x2 = external hidden global [16777216 x i64]
7 @x3 = external hidden global { [9 x i8*], [8 x i8*] }
12 ; CHECK-NEXT: adrp x8, x1+16
13 ; CHECK-NEXT: ldr x0, [x8, :lo12:x1+16]
18 ; GISEL-NEXT: adrp x8, x1+16
19 ; GISEL-NEXT: ldr x0, [x8, :lo12:x1+16]
21 %l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 2)
28 ; CHECK-NEXT: adrp x8, x1
29 ; CHECK-NEXT: add x8, x8, :lo12:x1
30 ; CHECK-NEXT: ldr x0, [x8, #24]
35 ; GISEL-NEXT: adrp x8, x1
36 ; GISEL-NEXT: add x8, x8, :lo12:x1
37 ; GISEL-NEXT: ldr x0, [x8, #24]
40 %l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 3)
47 ; CHECK-NEXT: adrp x8, x1+1
48 ; CHECK-NEXT: add x8, x8, :lo12:x1+1
49 ; CHECK-NEXT: ldr x0, [x8]
54 ; GISEL-NEXT: adrp x8, x1+1
55 ; GISEL-NEXT: add x8, x8, :lo12:x1+1
56 ; GISEL-NEXT: ldr x0, [x8]
58 %l = load i64, i64* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i64]* @x1 to i8*), i64 1) to i64*)
62 define [2 x i64] @f4() {
63 ; FIXME: GlobalISel misses the opportunity to form a LDP here.
67 ; CHECK-NEXT: adrp x8, x2+8
68 ; CHECK-NEXT: add x8, x8, :lo12:x2+8
69 ; CHECK-NEXT: ldp x0, x1, [x8]
74 ; GISEL-NEXT: adrp x9, x2+8
75 ; GISEL-NEXT: adrp x8, x2+8
76 ; GISEL-NEXT: add x9, x9, :lo12:x2+8
77 ; GISEL-NEXT: ldr x0, [x8, :lo12:x2+8]
78 ; GISEL-NEXT: ldr x1, [x9, #8]
80 %l = load [2 x i64], [2 x i64]* bitcast (i8* getelementptr (i8, i8* bitcast ([16777216 x i64]* @x2 to i8*), i64 8) to [2 x i64]*)
87 ; CHECK-NEXT: adrp x8, x2+2097144
88 ; CHECK-NEXT: ldr x0, [x8, :lo12:x2+2097144]
93 ; GISEL-NEXT: adrp x8, x2+2097144
94 ; GISEL-NEXT: ldr x0, [x8, :lo12:x2+2097144]
96 %l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262143)
103 ; CHECK-NEXT: adrp x8, x2
104 ; CHECK-NEXT: add x8, x8, :lo12:x2
105 ; CHECK-NEXT: mov w9, #2097152
106 ; CHECK-NEXT: ldr x0, [x8, x9]
111 ; GISEL-NEXT: adrp x9, x2
112 ; GISEL-NEXT: mov w8, #2097152
113 ; GISEL-NEXT: add x9, x9, :lo12:x2
114 ; GISEL-NEXT: ldr x0, [x9, x8]
116 %l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262144)
121 ; FIXME: GlobalISel doesn't handle vectors well.
124 ; CHECK: // %bb.0: // %entry
125 ; CHECK-NEXT: adrp x8, x3+108
126 ; CHECK-NEXT: ldr w0, [x8, :lo12:x3+108]
130 ; GISEL: // %bb.0: // %entry
131 ; GISEL-NEXT: adrp x8, x3+88
132 ; GISEL-NEXT: add x8, x8, :lo12:x3+88
133 ; GISEL-NEXT: mov v0.d[1], x8
134 ; GISEL-NEXT: mov d0, v0.d[1]
135 ; GISEL-NEXT: fmov x8, d0
136 ; GISEL-NEXT: ldr w0, [x8, #20]
140 %l = load i32, i32* getelementptr (i32, i32* inttoptr (i64 trunc (i128 lshr (i128 bitcast (<2 x i64> <i64 undef, i64 ptrtoint (i8** getelementptr inbounds ({ [9 x i8*], [8 x i8*] }, { [9 x i8*], [8 x i8*] }* @x3, i64 0, inrange i32 1, i64 2) to i64)> to i128), i128 64) to i64) to i32*), i64 5)