1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_ext
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
10 ; CHECK-NEXT: $w0 = COPY [[TRUNC]](s32)
11 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK-NEXT: $w0 = COPY [[TRUNC1]](s32)
13 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
14 ; CHECK-NEXT: $w0 = COPY [[TRUNC2]](s32)
15 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
16 ; CHECK-NEXT: $w0 = COPY [[TRUNC3]](s32)
17 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
18 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
19 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
20 ; CHECK-NEXT: $x0 = COPY [[AND]](s64)
21 ; CHECK-NEXT: $x0 = COPY [[COPY]](s64)
22 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
23 ; CHECK-NEXT: $x0 = COPY [[SEXT_INREG]](s64)
24 ; CHECK-NEXT: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
25 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC4]], 1
26 ; CHECK-NEXT: $w0 = COPY [[SEXT_INREG1]](s32)
27 ; CHECK-NEXT: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
28 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
29 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC5]], [[C1]]
30 ; CHECK-NEXT: $w0 = COPY [[AND1]](s32)
31 ; CHECK-NEXT: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
32 ; CHECK-NEXT: $w0 = COPY [[TRUNC6]](s32)
33 ; CHECK-NEXT: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
34 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
35 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC7]], [[C2]]
36 ; CHECK-NEXT: $w0 = COPY [[AND2]](s32)
37 ; CHECK-NEXT: [[TRUNC8:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
38 ; CHECK-NEXT: $w0 = COPY [[TRUNC8]](s32)
39 ; CHECK-NEXT: [[TRUNC9:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
40 ; CHECK-NEXT: [[SEXT_INREG2:%[0-9]+]]:_(s32) = G_SEXT_INREG [[TRUNC9]], 16
41 ; CHECK-NEXT: $w0 = COPY [[SEXT_INREG2]](s32)
42 ; CHECK-NEXT: [[TRUNC10:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
43 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC10]], [[C2]]
44 ; CHECK-NEXT: $w0 = COPY [[AND3]](s32)
45 ; CHECK-NEXT: [[TRUNC11:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
46 ; CHECK-NEXT: $w0 = COPY [[TRUNC11]](s32)
47 ; CHECK-NEXT: [[TRUNC12:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
48 ; CHECK-NEXT: $w0 = COPY [[TRUNC12]](s32)
49 ; CHECK-NEXT: [[FPEXT:%[0-9]+]]:_(s64) = G_FPEXT [[TRUNC12]](s32)
50 ; CHECK-NEXT: $x0 = COPY [[FPEXT]](s64)
51 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
52 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[C3]](s32)
53 ; CHECK-NEXT: $w0 = COPY [[COPY1]](s32)
54 ; CHECK-NEXT: $w0 = COPY [[C3]](s32)
55 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
56 ; CHECK-NEXT: $w0 = COPY [[DEF]](s32)
58 %1:_(s1) = G_TRUNC %0(s64)
59 %19:_(s32) = G_ANYEXT %1(s1)
61 %2:_(s8) = G_TRUNC %0(s64)
62 %20:_(s32) = G_ANYEXT %2(s8)
64 %3:_(s16) = G_TRUNC %0(s64)
65 %21:_(s32) = G_ANYEXT %3(s16)
67 %4:_(s32) = G_TRUNC %0(s64)
69 %5:_(s64) = G_ANYEXT %1(s1)
71 %6:_(s64) = G_ZEXT %2(s8)
73 %7:_(s64) = G_ANYEXT %3(s16)
75 %8:_(s64) = G_SEXT %4(s32)
77 %9:_(s32) = G_SEXT %1(s1)
79 %10:_(s32) = G_ZEXT %2(s8)
81 %11:_(s32) = G_ANYEXT %3(s16)
83 %12:_(s32) = G_ZEXT %1(s1)
85 %13:_(s32) = G_ANYEXT %2(s8)
87 %14:_(s32) = G_SEXT %3(s16)
89 %15:_(s8) = G_ZEXT %1(s1)
90 %22:_(s32) = G_ANYEXT %15(s8)
92 %16:_(s16) = G_ANYEXT %2(s8)
93 %23:_(s32) = G_ANYEXT %16(s16)
95 %17:_(s32) = G_TRUNC %0(s64)
97 %18:_(s64) = G_FPEXT %17(s32)
99 %24:_(s16) = G_IMPLICIT_DEF
100 %25:_(s32) = G_ZEXT %24(s16)
102 %26:_(s32) = G_SEXT %24(s16)
104 %27:_(s32) = G_ANYEXT %24(s16)
109 name: test_anyext_anyext
114 ; CHECK-LABEL: name: test_anyext_anyext
115 ; CHECK: liveins: $w0
117 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
118 ; CHECK-NEXT: $w0 = COPY [[COPY]](s32)
120 %1:_(s1) = G_TRUNC %0(s32)
121 %2:_(s8) = G_ANYEXT %1(s1)
122 %3:_(s32) = G_ANYEXT %2(s8)
127 name: test_anyext_sext
132 ; CHECK-LABEL: name: test_anyext_sext
133 ; CHECK: liveins: $w0
135 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
136 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 1
137 ; CHECK-NEXT: $w0 = COPY [[SEXT_INREG]](s32)
139 %1:_(s1) = G_TRUNC %0(s32)
140 %2:_(s8) = G_SEXT %1(s1)
141 %3:_(s32) = G_ANYEXT %2(s8)
146 name: test_anyext_zext
151 ; CHECK-LABEL: name: test_anyext_zext
152 ; CHECK: liveins: $w0
154 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
155 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
156 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
157 ; CHECK-NEXT: $w0 = COPY [[AND]](s32)
159 %1:_(s1) = G_TRUNC %0(s32)
160 %2:_(s8) = G_ZEXT %1(s1)
161 %3:_(s32) = G_ANYEXT %2(s8)
166 name: test_zext_v8s16_from_v8s8
168 tracksRegLiveness: true
169 machineFunctionInfo: {}
173 ; CHECK-LABEL: name: test_zext_v8s16_from_v8s8
174 ; CHECK: liveins: $d0
176 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
177 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(<8 x s16>) = G_ZEXT [[COPY]](<8 x s8>)
178 ; CHECK-NEXT: $q0 = COPY [[ZEXT]](<8 x s16>)
179 ; CHECK-NEXT: RET_ReallyLR implicit $q0
180 %1:fpr(<8 x s8>) = COPY $d0
181 %2:_(<8 x s16>) = G_ZEXT %1(<8 x s8>)
182 $q0 = COPY %2(<8 x s16>)
183 RET_ReallyLR implicit $q0
187 name: test_sext_v8s16_from_v8s8
189 tracksRegLiveness: true
190 machineFunctionInfo: {}
194 ; CHECK-LABEL: name: test_sext_v8s16_from_v8s8
195 ; CHECK: liveins: $d0
197 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
198 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(<8 x s16>) = G_SEXT [[COPY]](<8 x s8>)
199 ; CHECK-NEXT: $q0 = COPY [[SEXT]](<8 x s16>)
200 ; CHECK-NEXT: RET_ReallyLR implicit $q0
201 %1:fpr(<8 x s8>) = COPY $d0
202 %2:_(<8 x s16>) = G_SEXT %1(<8 x s8>)
203 $q0 = COPY %2(<8 x s16>)
204 RET_ReallyLR implicit $q0
208 name: test_anyext_v8s16_from_v8s8
210 tracksRegLiveness: true
211 machineFunctionInfo: {}
215 ; CHECK-LABEL: name: test_anyext_v8s16_from_v8s8
216 ; CHECK: liveins: $d0
218 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
219 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<8 x s16>) = G_ANYEXT [[COPY]](<8 x s8>)
220 ; CHECK-NEXT: $q0 = COPY [[ANYEXT]](<8 x s16>)
221 ; CHECK-NEXT: RET_ReallyLR implicit $q0
222 %1:fpr(<8 x s8>) = COPY $d0
223 %2:_(<8 x s16>) = G_ANYEXT %1(<8 x s8>)
224 $q0 = COPY %2(<8 x s16>)
225 RET_ReallyLR implicit $q0
229 name: test_zext_v4s32_from_v4s16
231 tracksRegLiveness: true
232 machineFunctionInfo: {}
237 ; CHECK-LABEL: name: test_zext_v4s32_from_v4s16
238 ; CHECK: liveins: $d0
240 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
241 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(<4 x s32>) = G_ZEXT [[COPY]](<4 x s16>)
242 ; CHECK-NEXT: $q0 = COPY [[ZEXT]](<4 x s32>)
243 ; CHECK-NEXT: RET_ReallyLR implicit $q0
244 %0:_(<4 x s16>) = COPY $d0
245 %1:_(<4 x s32>) = G_ZEXT %0(<4 x s16>)
246 $q0 = COPY %1(<4 x s32>)
247 RET_ReallyLR implicit $q0
251 name: test_sext_v4s32_from_v4s16
253 tracksRegLiveness: true
254 machineFunctionInfo: {}
259 ; CHECK-LABEL: name: test_sext_v4s32_from_v4s16
260 ; CHECK: liveins: $d0
262 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
263 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(<4 x s32>) = G_SEXT [[COPY]](<4 x s16>)
264 ; CHECK-NEXT: $q0 = COPY [[SEXT]](<4 x s32>)
265 ; CHECK-NEXT: RET_ReallyLR implicit $q0
266 %0:_(<4 x s16>) = COPY $d0
267 %1:_(<4 x s32>) = G_SEXT %0(<4 x s16>)
268 $q0 = COPY %1(<4 x s32>)
269 RET_ReallyLR implicit $q0
273 name: test_anyext_v4s32_from_v4s16
275 tracksRegLiveness: true
276 machineFunctionInfo: {}
281 ; CHECK-LABEL: name: test_anyext_v4s32_from_v4s16
282 ; CHECK: liveins: $d0
284 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
285 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<4 x s32>) = G_ANYEXT [[COPY]](<4 x s16>)
286 ; CHECK-NEXT: $q0 = COPY [[ANYEXT]](<4 x s32>)
287 ; CHECK-NEXT: RET_ReallyLR implicit $q0
288 %0:_(<4 x s16>) = COPY $d0
289 %1:_(<4 x s32>) = G_ANYEXT %0(<4 x s16>)
290 $q0 = COPY %1(<4 x s32>)
291 RET_ReallyLR implicit $q0
295 name: test_zext_v2s64_from_v2s32
297 tracksRegLiveness: true
299 - { id: 0, class: _ }
300 - { id: 1, class: _ }
301 machineFunctionInfo: {}
306 ; CHECK-LABEL: name: test_zext_v2s64_from_v2s32
307 ; CHECK: liveins: $d0
309 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
310 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(<2 x s64>) = G_ZEXT [[COPY]](<2 x s32>)
311 ; CHECK-NEXT: $q0 = COPY [[ZEXT]](<2 x s64>)
312 ; CHECK-NEXT: RET_ReallyLR implicit $q0
313 %0:_(<2 x s32>) = COPY $d0
314 %1:_(<2 x s64>) = G_ZEXT %0(<2 x s32>)
315 $q0 = COPY %1(<2 x s64>)
316 RET_ReallyLR implicit $q0
320 name: test_sext_v2s64_from_v2s32
322 tracksRegLiveness: true
324 - { id: 0, class: _ }
325 - { id: 1, class: _ }
326 machineFunctionInfo: {}
331 ; CHECK-LABEL: name: test_sext_v2s64_from_v2s32
332 ; CHECK: liveins: $d0
334 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
335 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(<2 x s64>) = G_SEXT [[COPY]](<2 x s32>)
336 ; CHECK-NEXT: $q0 = COPY [[SEXT]](<2 x s64>)
337 ; CHECK-NEXT: RET_ReallyLR implicit $q0
338 %0:_(<2 x s32>) = COPY $d0
339 %1:_(<2 x s64>) = G_SEXT %0(<2 x s32>)
340 $q0 = COPY %1(<2 x s64>)
341 RET_ReallyLR implicit $q0
345 name: test_anyext_v2s64_from_v2s32
347 tracksRegLiveness: true
349 - { id: 0, class: _ }
350 - { id: 1, class: _ }
351 machineFunctionInfo: {}
356 ; CHECK-LABEL: name: test_anyext_v2s64_from_v2s32
357 ; CHECK: liveins: $d0
359 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
360 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(<2 x s64>) = G_ANYEXT [[COPY]](<2 x s32>)
361 ; CHECK-NEXT: $q0 = COPY [[ANYEXT]](<2 x s64>)
362 ; CHECK-NEXT: RET_ReallyLR implicit $q0
363 %0:_(<2 x s32>) = COPY $d0
364 %1:_(<2 x s64>) = G_ANYEXT %0(<2 x s32>)
365 $q0 = COPY %1(<2 x s64>)
366 RET_ReallyLR implicit $q0