• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=aarch64-none-eabi -code-model=tiny < %s | FileCheck %s
2
3@var8 = global i8 0
4@var16 = global i16 0
5@var32 = global i32 0
6@var64 = global i64 0
7
8define i8* @global_addr() {
9; CHECK-LABEL: global_addr:
10  ret i8* @var8
11  ; The adr calculation should end up returned directly in x0.
12; CHECK: adr x0, var8
13; CHECK-NEXT: ret
14}
15
16define i8 @global_i8() {
17; CHECK-LABEL: global_i8:
18  %val = load i8, i8* @var8
19  ret i8 %val
20; CHECK: adr x[[ADDR_REG:[0-9]+]], var8
21; CHECK: ldrb w0, [x[[ADDR_REG]]]
22}
23
24define i16 @global_i16() {
25; CHECK-LABEL: global_i16:
26  %val = load i16, i16* @var16
27  ret i16 %val
28; CHECK: adr x[[ADDR_REG:[0-9]+]], var16
29; CHECK: ldrh w0, [x[[ADDR_REG]]]
30}
31
32define i32 @global_i32() {
33; CHECK-LABEL: global_i32:
34  %val = load i32, i32* @var32
35  ret i32 %val
36; CHECK: ldr w0, var32
37}
38
39define i64 @global_i64() {
40; CHECK-LABEL: global_i64:
41  %val = load i64, i64* @var64
42  ret i64 %val
43; CHECK: ldr x0, var64
44}
45
46define <2 x i64> @constpool() {
47; CHECK-LABEL: constpool:
48  ret <2 x i64> <i64 123456789, i64 987654321100>
49
50; CHECK: adr x[[ADDR_REG:[0-9]+]], {{.LCPI[0-9]+_[0-9]+}}
51; CHECK: ldr q0, [x[[ADDR_REG]]]
52}
53