1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=aarch64-linux-gnu -code-model=large -o - %s | FileCheck %s --check-prefix=STATIC
3 ; RUN: llc -mtriple=aarch64-linux-gnu -code-model=large -relocation-model=pic -o - %s | FileCheck %s --check-prefix=PIC
5 @var8 = dso_local global i8 0
6 @var16 = dso_local global i16 0
7 @var32 = dso_local global i32 0
8 @var64 = dso_local global i64 0
10 define dso_local ptr @global_addr() {
12 ; STATIC-LABEL: global_addr:
14 ; STATIC-NEXT: movz x0, #:abs_g0_nc:var8
15 ; STATIC-NEXT: movk x0, #:abs_g1_nc:var8
16 ; STATIC-NEXT: movk x0, #:abs_g2_nc:var8
17 ; STATIC-NEXT: movk x0, #:abs_g3:var8
20 ; PIC-LABEL: global_addr:
21 ; PIC: .Lglobal_addr$local:
22 ; PIC-NEXT: .type .Lglobal_addr$local,@function
23 ; PIC-NEXT: .cfi_startproc
25 ; PIC-NEXT: adrp x0, .Lvar8$local
26 ; PIC-NEXT: add x0, x0, :lo12:.Lvar8$local
29 ; The movz/movk calculation should end up returned directly in x0.
32 define dso_local i8 @global_i8() {
34 ; STATIC-LABEL: global_i8:
36 ; STATIC-NEXT: movz x8, #:abs_g0_nc:var8
37 ; STATIC-NEXT: movk x8, #:abs_g1_nc:var8
38 ; STATIC-NEXT: movk x8, #:abs_g2_nc:var8
39 ; STATIC-NEXT: movk x8, #:abs_g3:var8
40 ; STATIC-NEXT: ldrb w0, [x8]
43 ; PIC-LABEL: global_i8:
44 ; PIC: .Lglobal_i8$local:
45 ; PIC-NEXT: .type .Lglobal_i8$local,@function
46 ; PIC-NEXT: .cfi_startproc
48 ; PIC-NEXT: adrp x8, .Lvar8$local
49 ; PIC-NEXT: ldrb w0, [x8, :lo12:.Lvar8$local]
51 %val = load i8, ptr @var8
55 define dso_local i16 @global_i16() {
57 ; STATIC-LABEL: global_i16:
59 ; STATIC-NEXT: movz x8, #:abs_g0_nc:var16
60 ; STATIC-NEXT: movk x8, #:abs_g1_nc:var16
61 ; STATIC-NEXT: movk x8, #:abs_g2_nc:var16
62 ; STATIC-NEXT: movk x8, #:abs_g3:var16
63 ; STATIC-NEXT: ldrh w0, [x8]
66 ; PIC-LABEL: global_i16:
67 ; PIC: .Lglobal_i16$local:
68 ; PIC-NEXT: .type .Lglobal_i16$local,@function
69 ; PIC-NEXT: .cfi_startproc
71 ; PIC-NEXT: adrp x8, .Lvar16$local
72 ; PIC-NEXT: ldrh w0, [x8, :lo12:.Lvar16$local]
74 %val = load i16, ptr @var16
78 define dso_local i32 @global_i32() {
80 ; STATIC-LABEL: global_i32:
82 ; STATIC-NEXT: movz x8, #:abs_g0_nc:var32
83 ; STATIC-NEXT: movk x8, #:abs_g1_nc:var32
84 ; STATIC-NEXT: movk x8, #:abs_g2_nc:var32
85 ; STATIC-NEXT: movk x8, #:abs_g3:var32
86 ; STATIC-NEXT: ldr w0, [x8]
89 ; PIC-LABEL: global_i32:
90 ; PIC: .Lglobal_i32$local:
91 ; PIC-NEXT: .type .Lglobal_i32$local,@function
92 ; PIC-NEXT: .cfi_startproc
94 ; PIC-NEXT: adrp x8, .Lvar32$local
95 ; PIC-NEXT: ldr w0, [x8, :lo12:.Lvar32$local]
97 %val = load i32, ptr @var32
101 define dso_local i64 @global_i64() {
103 ; STATIC-LABEL: global_i64:
105 ; STATIC-NEXT: movz x8, #:abs_g0_nc:var64
106 ; STATIC-NEXT: movk x8, #:abs_g1_nc:var64
107 ; STATIC-NEXT: movk x8, #:abs_g2_nc:var64
108 ; STATIC-NEXT: movk x8, #:abs_g3:var64
109 ; STATIC-NEXT: ldr x0, [x8]
112 ; PIC-LABEL: global_i64:
113 ; PIC: .Lglobal_i64$local:
114 ; PIC-NEXT: .type .Lglobal_i64$local,@function
115 ; PIC-NEXT: .cfi_startproc
116 ; PIC-NEXT: // %bb.0:
117 ; PIC-NEXT: adrp x8, .Lvar64$local
118 ; PIC-NEXT: ldr x0, [x8, :lo12:.Lvar64$local]
120 %val = load i64, ptr @var64
124 define dso_local <2 x i64> @constpool() {
126 ; STATIC-LABEL: constpool:
128 ; STATIC-NEXT: movz x8, #:abs_g0_nc:.LCPI5_0
129 ; STATIC-NEXT: movk x8, #:abs_g1_nc:.LCPI5_0
130 ; STATIC-NEXT: movk x8, #:abs_g2_nc:.LCPI5_0
131 ; STATIC-NEXT: movk x8, #:abs_g3:.LCPI5_0
132 ; STATIC-NEXT: ldr q0, [x8]
135 ; PIC-LABEL: constpool:
136 ; PIC: .Lconstpool$local:
137 ; PIC-NEXT: .type .Lconstpool$local,@function
138 ; PIC-NEXT: .cfi_startproc
139 ; PIC-NEXT: // %bb.0:
140 ; PIC-NEXT: adrp x8, .LCPI5_0
141 ; PIC-NEXT: ldr q0, [x8, :lo12:.LCPI5_0]
143 ret <2 x i64> <i64 123456789, i64 987654321100>