1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < %s | FileCheck %s
3 ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < %s | FileCheck %s
4 ; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < %s | FileCheck %s --check-prefix=CHECK-GLOBISEL
6 ; Note fast-isel tests here will fall back to isel
8 @src = external local_unnamed_addr global [65536 x i8], align 1
9 @dst = external global [65536 x i8], align 1
10 @ptr = external local_unnamed_addr global i8*, align 8
12 define dso_local void @foo1() {
14 ; CHECK: // %bb.0: // %entry
15 ; CHECK-NEXT: ldr x8, :got:src
16 ; CHECK-NEXT: ldrb w8, [x8]
17 ; CHECK-NEXT: ldr x9, :got:dst
18 ; CHECK-NEXT: strb w8, [x9]
21 ; CHECK-GLOBISEL-LABEL: foo1:
22 ; CHECK-GLOBISEL: // %bb.0: // %entry
23 ; CHECK-GLOBISEL-NEXT: ldr x8, :got:src
24 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
25 ; CHECK-GLOBISEL-NEXT: ldr x9, :got:dst
26 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
27 ; CHECK-GLOBISEL-NEXT: ret
29 %0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @src, i64 0, i64 0), align 1
30 store i8 %0, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dst, i64 0, i64 0), align 1
34 define dso_local void @foo2() {
36 ; CHECK: // %bb.0: // %entry
37 ; CHECK-NEXT: ldr x8, :got:ptr
38 ; CHECK-NEXT: ldr x9, :got:dst
39 ; CHECK-NEXT: str x9, [x8]
42 ; CHECK-GLOBISEL-LABEL: foo2:
43 ; CHECK-GLOBISEL: // %bb.0: // %entry
44 ; CHECK-GLOBISEL-NEXT: ldr x8, :got:ptr
45 ; CHECK-GLOBISEL-NEXT: ldr x9, :got:dst
46 ; CHECK-GLOBISEL-NEXT: str x9, [x8]
47 ; CHECK-GLOBISEL-NEXT: ret
49 store i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dst, i64 0, i64 0), i8** @ptr, align 8
53 define dso_local void @foo3() {
54 ; FIXME: Needn't adr ptr
57 ; CHECK: // %bb.0: // %entry
58 ; CHECK-NEXT: ldr x8, :got:src
59 ; CHECK-NEXT: ldr x9, :got:ptr
60 ; CHECK-NEXT: ldrb w8, [x8]
61 ; CHECK-NEXT: ldr x9, [x9]
62 ; CHECK-NEXT: strb w8, [x9]
65 ; CHECK-GLOBISEL-LABEL: foo3:
66 ; CHECK-GLOBISEL: // %bb.0: // %entry
67 ; CHECK-GLOBISEL-NEXT: ldr x8, :got:src
68 ; CHECK-GLOBISEL-NEXT: ldr x9, :got:ptr
69 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
70 ; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
71 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
72 ; CHECK-GLOBISEL-NEXT: ret
74 %0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @src, i64 0, i64 0), align 1
75 %1 = load i8*, i8** @ptr, align 8
76 store i8 %0, i8* %1, align 1
80 @lsrc = internal global i8 0, align 4
81 @ldst = internal global i8 0, align 4
82 @lptr = internal global i8* null, align 8
84 define dso_local void @bar1() {
86 ; CHECK: // %bb.0: // %entry
87 ; CHECK-NEXT: adr x8, lsrc
88 ; CHECK-NEXT: adr x9, ldst
89 ; CHECK-NEXT: ldrb w8, [x8]
90 ; CHECK-NEXT: strb w8, [x9]
93 ; CHECK-GLOBISEL-LABEL: bar1:
94 ; CHECK-GLOBISEL: // %bb.0: // %entry
95 ; CHECK-GLOBISEL-NEXT: adr x8, lsrc
96 ; CHECK-GLOBISEL-NEXT: adr x9, ldst
97 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
98 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
99 ; CHECK-GLOBISEL-NEXT: ret
101 %0 = load i8, i8* @lsrc, align 4
102 store i8 %0, i8* @ldst, align 4
106 define dso_local void @bar2() {
108 ; CHECK: // %bb.0: // %entry
109 ; CHECK-NEXT: adr x8, lptr
110 ; CHECK-NEXT: adr x9, ldst
111 ; CHECK-NEXT: str x9, [x8]
114 ; CHECK-GLOBISEL-LABEL: bar2:
115 ; CHECK-GLOBISEL: // %bb.0: // %entry
116 ; CHECK-GLOBISEL-NEXT: adr x8, lptr
117 ; CHECK-GLOBISEL-NEXT: adr x9, ldst
118 ; CHECK-GLOBISEL-NEXT: str x9, [x8]
119 ; CHECK-GLOBISEL-NEXT: ret
121 store i8* @ldst, i8** @lptr, align 8
125 define dso_local void @bar3() {
126 ; FIXME: Needn't adr lptr
129 ; CHECK: // %bb.0: // %entry
130 ; CHECK-NEXT: adr x8, lsrc
131 ; CHECK-NEXT: ldr x9, lptr
132 ; CHECK-NEXT: ldrb w8, [x8]
133 ; CHECK-NEXT: strb w8, [x9]
136 ; CHECK-GLOBISEL-LABEL: bar3:
137 ; CHECK-GLOBISEL: // %bb.0: // %entry
138 ; CHECK-GLOBISEL-NEXT: adr x8, lsrc
139 ; CHECK-GLOBISEL-NEXT: adr x9, lptr
140 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
141 ; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
142 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
143 ; CHECK-GLOBISEL-NEXT: ret
145 %0 = load i8, i8* @lsrc, align 4
146 %1 = load i8*, i8** @lptr, align 8
147 store i8 %0, i8* %1, align 1
152 @lbsrc = internal global [65536 x i8] zeroinitializer, align 4
153 @lbdst = internal global [65536 x i8] zeroinitializer, align 4
155 define dso_local void @baz1() {
157 ; CHECK: // %bb.0: // %entry
158 ; CHECK-NEXT: adr x8, lbsrc
159 ; CHECK-NEXT: adr x9, lbdst
160 ; CHECK-NEXT: ldrb w8, [x8]
161 ; CHECK-NEXT: strb w8, [x9]
164 ; CHECK-GLOBISEL-LABEL: baz1:
165 ; CHECK-GLOBISEL: // %bb.0: // %entry
166 ; CHECK-GLOBISEL-NEXT: adr x8, lbsrc
167 ; CHECK-GLOBISEL-NEXT: adr x9, lbdst
168 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
169 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
170 ; CHECK-GLOBISEL-NEXT: ret
172 %0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbsrc, i64 0, i64 0), align 4
173 store i8 %0, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbdst, i64 0, i64 0), align 4
177 define dso_local void @baz2() {
179 ; CHECK: // %bb.0: // %entry
180 ; CHECK-NEXT: adr x8, lptr
181 ; CHECK-NEXT: adr x9, lbdst
182 ; CHECK-NEXT: str x9, [x8]
185 ; CHECK-GLOBISEL-LABEL: baz2:
186 ; CHECK-GLOBISEL: // %bb.0: // %entry
187 ; CHECK-GLOBISEL-NEXT: adr x8, lptr
188 ; CHECK-GLOBISEL-NEXT: adr x9, lbdst
189 ; CHECK-GLOBISEL-NEXT: str x9, [x8]
190 ; CHECK-GLOBISEL-NEXT: ret
192 store i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbdst, i64 0, i64 0), i8** @lptr, align 8
196 define dso_local void @baz3() {
197 ; FIXME: Needn't adr lptr
200 ; CHECK: // %bb.0: // %entry
201 ; CHECK-NEXT: adr x8, lbsrc
202 ; CHECK-NEXT: ldr x9, lptr
203 ; CHECK-NEXT: ldrb w8, [x8]
204 ; CHECK-NEXT: strb w8, [x9]
207 ; CHECK-GLOBISEL-LABEL: baz3:
208 ; CHECK-GLOBISEL: // %bb.0: // %entry
209 ; CHECK-GLOBISEL-NEXT: adr x8, lbsrc
210 ; CHECK-GLOBISEL-NEXT: adr x9, lptr
211 ; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
212 ; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
213 ; CHECK-GLOBISEL-NEXT: strb w8, [x9]
214 ; CHECK-GLOBISEL-NEXT: ret
216 %0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbsrc, i64 0, i64 0), align 4
217 %1 = load i8*, i8** @lptr, align 8
218 store i8 %0, i8* %1, align 1
223 declare void @func(...)
225 define dso_local i8* @externfuncaddr() {
226 ; CHECK-LABEL: externfuncaddr:
227 ; CHECK: // %bb.0: // %entry
228 ; CHECK-NEXT: ldr x0, :got:func
231 ; CHECK-GLOBISEL-LABEL: externfuncaddr:
232 ; CHECK-GLOBISEL: // %bb.0: // %entry
233 ; CHECK-GLOBISEL-NEXT: ldr x0, :got:func
234 ; CHECK-GLOBISEL-NEXT: ret
236 ret i8* bitcast (void (...)* @func to i8*)
239 define dso_local i8* @localfuncaddr() {
240 ; CHECK-LABEL: localfuncaddr:
241 ; CHECK: // %bb.0: // %entry
242 ; CHECK-NEXT: adr x0, externfuncaddr
245 ; CHECK-GLOBISEL-LABEL: localfuncaddr:
246 ; CHECK-GLOBISEL: // %bb.0: // %entry
247 ; CHECK-GLOBISEL-NEXT: adr x0, externfuncaddr
248 ; CHECK-GLOBISEL-NEXT: ret
250 ret i8* bitcast (i8* ()* @externfuncaddr to i8*)