1 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s
3 @x1 = external hidden global [2 x i64]
4 @x2 = external hidden global [16777216 x i64]
5 @x3 = external hidden global { [9 x i8*], [8 x i8*] }
9 ; CHECK: adrp x8, x1+16
10 ; CHECK: ldr x0, [x8, :lo12:x1+16]
11 %l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 2)
18 ; CHECK: add x8, x8, :lo12:x1
19 ; CHECK: ldr x0, [x8, #24]
20 %l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 3)
26 ; CHECK: adrp x8, x1+1
27 ; CHECK: add x8, x8, :lo12:x1+1
29 %l = load i64, i64* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i64]* @x1 to i8*), i64 1) to i64*)
33 define [2 x i64] @f4() {
35 ; CHECK: adrp x8, x2+8
36 ; CHECK: add x8, x8, :lo12:x2+8
37 ; CHECK: ldp x0, x1, [x8]
38 %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]*)
44 ; CHECK: adrp x8, x2+2097144
45 ; CHECK: ldr x0, [x8, :lo12:x2+2097144]
47 %l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262143)
54 ; CHECK: add x8, x8, :lo12:x2
55 ; CHECK: mov w9, #2097152
56 ; CHECK: ldr x0, [x8, x9]
58 %l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262144)
65 ; CHECK: adrp x8, x3+108
66 ; CHECK: ldr w0, [x8, :lo12:x3+108]
67 %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)