1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
3 # RUN: llc -debugify-and-strip-all-safe -mtriple=aarch64-- -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
6 tracksRegLiveness: true
11 ; CHECK-LABEL: name: test_memcpy
12 ; CHECK: liveins: $w2, $x0, $x1
13 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
14 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
15 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
16 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
17 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
18 ; CHECK: $x0 = COPY [[COPY]](p0)
19 ; CHECK: $x1 = COPY [[COPY1]](p0)
20 ; CHECK: $x2 = COPY [[ZEXT]](s64)
21 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
22 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
27 %3:_(s64) = G_ZEXT %2(s32)
28 G_MEMCPY %0(p0), %1(p0), %3(s64), 0 :: (store unknown-size), (load unknown-size)
33 name: test_memcpy_tail
34 tracksRegLiveness: true
37 liveins: $w2, $x0, $x1
39 ; CHECK-LABEL: name: test_memcpy_tail
40 ; CHECK: liveins: $w2, $x0, $x1
41 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
42 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
43 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
44 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
45 ; CHECK: $x0 = COPY [[COPY]](p0)
46 ; CHECK: $x1 = COPY [[COPY1]](p0)
47 ; CHECK: $x2 = COPY [[ZEXT]](s64)
48 ; CHECK: TCRETURNdi &memcpy, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2
52 %3:_(s64) = G_ZEXT %2(s32)
53 G_MEMCPY %0(p0), %1(p0), %3(s64), 1 :: (store unknown-size), (load unknown-size)
59 tracksRegLiveness: true
62 liveins: $w2, $x0, $x1
64 ; CHECK-LABEL: name: test_memmove
65 ; CHECK: liveins: $w2, $x0, $x1
66 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
67 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
68 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
69 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
70 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
71 ; CHECK: $x0 = COPY [[COPY]](p0)
72 ; CHECK: $x1 = COPY [[COPY1]](p0)
73 ; CHECK: $x2 = COPY [[ZEXT]](s64)
74 ; CHECK: BL &memmove, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
75 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
80 %3:_(s64) = G_ZEXT %2(s32)
81 G_MEMMOVE %0(p0), %1(p0), %3(s64), 0 :: (store unknown-size), (load unknown-size)
87 tracksRegLiveness: true
90 liveins: $w1, $w2, $x0
92 ; CHECK-LABEL: name: test_memset
93 ; CHECK: liveins: $w1, $w2, $x0
94 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
95 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
96 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
97 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
98 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
99 ; CHECK: $x0 = COPY [[COPY]](p0)
100 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
101 ; CHECK: $w1 = COPY [[COPY3]](s32)
102 ; CHECK: $x2 = COPY [[ZEXT]](s64)
103 ; CHECK: BL &memset, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit $x2
104 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
105 ; CHECK: RET_ReallyLR
109 %3:_(s8) = G_TRUNC %1(s32)
110 %4:_(s64) = G_ZEXT %2(s32)
111 G_MEMSET %0(p0), %3(s8), %4(s64), 0 :: (store unknown-size)
117 tracksRegLiveness: true
120 liveins: $w2, $x0, $x1
122 ; CHECK-LABEL: name: no_tail_call
123 ; CHECK: liveins: $w2, $x0, $x1
124 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x1
125 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
126 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
127 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
128 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
129 ; CHECK: $x0 = COPY [[COPY]](p0)
130 ; CHECK: $x1 = COPY [[COPY1]](p0)
131 ; CHECK: $x2 = COPY [[ZEXT]](s64)
132 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
133 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
134 ; CHECK: $x0 = COPY [[ZEXT]](s64)
135 ; CHECK: RET_ReallyLR implicit $x0
139 %3:_(s64) = G_ZEXT %2(s32)
140 G_MEMCPY %0(p0), %1(p0), %3(s64), 1 :: (store unknown-size), (load unknown-size)
142 RET_ReallyLR implicit $x0
147 tracksRegLiveness: true
150 liveins: $w2, $x0, $x1
151 ; CHECK-LABEL: name: dont_tc_twice
152 ; CHECK: liveins: $w2, $x0, $x1
153 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
154 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
155 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
156 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY2]](s32)
157 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
158 ; CHECK: $x0 = COPY [[COPY]](p0)
159 ; CHECK: $x1 = COPY [[COPY1]](p0)
160 ; CHECK: $x2 = COPY [[ZEXT]](s64)
161 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
162 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
163 ; CHECK: TCRETURNdi &memset, 0, csr_aarch64_aapcs, implicit $sp
167 %4:_(s1) = G_CONSTANT i1 false
168 %3:_(s64) = G_ZEXT %2(s32)
169 G_MEMCPY %0(p0), %1(p0), %3(s64), 1 :: (store unknown-size), (load unknown-size)
170 TCRETURNdi &memset, 0, csr_aarch64_aapcs, implicit $sp
174 name: tail_with_copy_ret
176 tracksRegLiveness: true
178 - { id: 0, class: _ }
179 - { id: 1, class: _ }
180 - { id: 2, class: _ }
187 machineFunctionInfo: {}
190 liveins: $x0, $x1, $x2
192 ; CHECK-LABEL: name: tail_with_copy_ret
193 ; CHECK: liveins: $x0, $x1, $x2
194 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
195 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
196 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
197 ; CHECK: $x0 = COPY [[COPY]](p0)
198 ; CHECK: $x1 = COPY [[COPY1]](p0)
199 ; CHECK: $x2 = COPY [[COPY2]](s64)
200 ; CHECK: TCRETURNdi &memcpy, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $x1, implicit $x2
204 G_MEMCPY %0(p0), %1(p0), %2(s64), 1 :: (store (s8)), (load (s8))
206 RET_ReallyLR implicit $x0
210 name: dont_tc_mismatched_copies
212 tracksRegLiveness: true
214 - { id: 0, class: _ }
215 - { id: 1, class: _ }
216 - { id: 2, class: _ }
223 machineFunctionInfo: {}
226 liveins: $x0, $x1, $x2
228 ; CHECK-LABEL: name: dont_tc_mismatched_copies
229 ; CHECK: liveins: $x0, $x1, $x2
230 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
231 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
232 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
233 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
234 ; CHECK: $x0 = COPY [[COPY]](p0)
235 ; CHECK: $x1 = COPY [[COPY1]](p0)
236 ; CHECK: $x2 = COPY [[COPY2]](s64)
237 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
238 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
239 ; CHECK: $x1 = COPY [[COPY]](p0)
240 ; CHECK: RET_ReallyLR implicit $x0
244 G_MEMCPY %0(p0), %1(p0), %2(s64), 1 :: (store (s8)), (load (s8))
246 RET_ReallyLR implicit $x0
250 name: dont_tc_extra_copy
252 tracksRegLiveness: true
254 - { id: 0, class: _ }
255 - { id: 1, class: _ }
256 - { id: 2, class: _ }
263 machineFunctionInfo: {}
266 liveins: $x0, $x1, $x2
268 ; CHECK-LABEL: name: dont_tc_extra_copy
269 ; CHECK: liveins: $x0, $x1, $x2
270 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
271 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
272 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
273 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
274 ; CHECK: $x0 = COPY [[COPY]](p0)
275 ; CHECK: $x1 = COPY [[COPY1]](p0)
276 ; CHECK: $x2 = COPY [[COPY2]](s64)
277 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
278 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
279 ; CHECK: $x0 = COPY [[COPY]](p0)
280 ; CHECK: $x0 = COPY [[COPY]](p0)
281 ; CHECK: RET_ReallyLR implicit $x0
285 G_MEMCPY %0(p0), %1(p0), %2(s64), 1 :: (store (s8)), (load (s8))
288 RET_ReallyLR implicit $x0
292 name: dont_tc_mismatched_ret
294 tracksRegLiveness: true
296 - { id: 0, class: _ }
297 - { id: 1, class: _ }
298 - { id: 2, class: _ }
305 machineFunctionInfo: {}
308 liveins: $x0, $x1, $x2
310 ; CHECK-LABEL: name: dont_tc_mismatched_ret
311 ; CHECK: liveins: $x0, $x1, $x2
312 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x1
313 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
314 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
315 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
316 ; CHECK: $x0 = COPY [[COPY]](p0)
317 ; CHECK: $x1 = COPY [[COPY1]](p0)
318 ; CHECK: $x2 = COPY [[COPY2]](s64)
319 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
320 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
321 ; CHECK: $x1 = COPY [[COPY]](p0)
322 ; CHECK: RET_ReallyLR implicit $x0
326 G_MEMCPY %0(p0), %1(p0), %2(s64), 1 :: (store (s8)), (load (s8))
328 RET_ReallyLR implicit $x0
332 name: dont_tc_ret_void_copy
334 tracksRegLiveness: true
336 - { id: 0, class: _ }
337 - { id: 1, class: _ }
338 - { id: 2, class: _ }
345 machineFunctionInfo: {}
348 liveins: $x0, $x1, $x2
350 ; CHECK-LABEL: name: dont_tc_ret_void_copy
351 ; CHECK: liveins: $x0, $x1, $x2
352 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
353 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
354 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
355 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
356 ; CHECK: $x0 = COPY [[COPY]](p0)
357 ; CHECK: $x1 = COPY [[COPY1]](p0)
358 ; CHECK: $x2 = COPY [[COPY2]](s64)
359 ; CHECK: BL &memcpy, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $x1, implicit $x2
360 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
361 ; CHECK: $x0 = COPY [[COPY]](p0)
362 ; CHECK: RET_ReallyLR
366 G_MEMCPY %0(p0), %1(p0), %2(s64), 1 :: (store (s8)), (load (s8))