1 ; RUN: llc -mtriple=aarch64 -code-model=tiny < %s | FileCheck %s
3 @var8 = dso_local global i8 0
4 @var16 = dso_local global i16 0
5 @var32 = dso_local global i32 0
6 @var64 = dso_local global i64 0
8 define dso_local ptr @global_addr() {
9 ; CHECK-LABEL: global_addr:
11 ; The adr calculation should end up returned directly in x0.
16 define dso_local i8 @global_i8() {
17 ; CHECK-LABEL: global_i8:
18 %val = load i8, ptr @var8
20 ; CHECK: adr x[[ADDR_REG:[0-9]+]], var8
21 ; CHECK: ldrb w0, [x[[ADDR_REG]]]
24 define dso_local i16 @global_i16() {
25 ; CHECK-LABEL: global_i16:
26 %val = load i16, ptr @var16
28 ; CHECK: adr x[[ADDR_REG:[0-9]+]], var16
29 ; CHECK: ldrh w0, [x[[ADDR_REG]]]
32 define dso_local i32 @global_i32() {
33 ; CHECK-LABEL: global_i32:
34 %val = load i32, ptr @var32
36 ; CHECK: ldr w0, var32
39 define dso_local i64 @global_i64() {
40 ; CHECK-LABEL: global_i64:
41 %val = load i64, ptr @var64
43 ; CHECK: ldr x0, var64
46 define dso_local <2 x i64> @constpool() {
47 ; CHECK-LABEL: constpool:
48 ret <2 x i64> <i64 123456789, i64 987654321100>
50 ; CHECK: adr x[[ADDR_REG:[0-9]+]], {{.LCPI[0-9]+_[0-9]+}}
51 ; CHECK: ldr q0, [x[[ADDR_REG]]]