1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_ext
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
10 ; CHECK: $w0 = COPY [[TRUNC]](s32)
11 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
12 ; CHECK: $w0 = COPY [[TRUNC1]](s32)
13 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
14 ; CHECK: $w0 = COPY [[TRUNC2]](s32)
15 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
16 ; CHECK: $w0 = COPY [[TRUNC3]](s32)
17 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
18 ; CHECK: $x0 = COPY [[COPY1]](s64)
19 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
20 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
21 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
22 ; CHECK: $x0 = COPY [[AND]](s64)
23 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
24 ; CHECK: $x0 = COPY [[COPY3]](s64)
25 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
26 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
27 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY4]], [[C1]](s64)
28 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C1]](s64)
29 ; CHECK: $x0 = COPY [[ASHR]](s64)
30 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
31 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
32 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC4]], [[C2]](s32)
33 ; CHECK: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
34 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C3]](s64)
35 ; CHECK: $w0 = COPY [[ASHR1]](s32)
36 ; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
37 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
38 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC5]], [[C4]]
39 ; CHECK: $w0 = COPY [[AND1]](s32)
40 ; CHECK: [[TRUNC6:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
41 ; CHECK: $w0 = COPY [[TRUNC6]](s32)
42 ; CHECK: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
43 ; CHECK: [[TRUNC7:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
44 ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC7]], [[C5]]
45 ; CHECK: $w0 = COPY [[AND2]](s32)
46 ; CHECK: [[TRUNC8:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
47 ; CHECK: $w0 = COPY [[TRUNC8]](s32)
48 ; CHECK: [[TRUNC9:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
49 ; CHECK: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
50 ; CHECK: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[TRUNC9]], [[C6]](s32)
51 ; CHECK: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
52 ; CHECK: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C7]](s64)
53 ; CHECK: $w0 = COPY [[ASHR2]](s32)
54 ; CHECK: [[TRUNC10:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
55 ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC10]], [[C5]]
56 ; CHECK: $w0 = COPY [[AND3]](s32)
57 ; CHECK: [[TRUNC11:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
58 ; CHECK: $w0 = COPY [[TRUNC11]](s32)
59 ; CHECK: [[TRUNC12:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
60 ; CHECK: $w0 = COPY [[TRUNC12]](s32)
61 ; CHECK: [[FPEXT:%[0-9]+]]:_(s64) = G_FPEXT [[TRUNC12]](s32)
62 ; CHECK: $x0 = COPY [[FPEXT]](s64)
63 ; CHECK: [[C8:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
64 ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY [[C8]](s32)
65 ; CHECK: $w0 = COPY [[COPY5]](s32)
66 ; CHECK: $w0 = COPY [[C8]](s32)
67 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
68 ; CHECK: $w0 = COPY [[DEF]](s32)
70 %1:_(s1) = G_TRUNC %0(s64)
71 %19:_(s32) = G_ANYEXT %1(s1)
73 %2:_(s8) = G_TRUNC %0(s64)
74 %20:_(s32) = G_ANYEXT %2(s8)
76 %3:_(s16) = G_TRUNC %0(s64)
77 %21:_(s32) = G_ANYEXT %3(s16)
79 %4:_(s32) = G_TRUNC %0(s64)
81 %5:_(s64) = G_ANYEXT %1(s1)
83 %6:_(s64) = G_ZEXT %2(s8)
85 %7:_(s64) = G_ANYEXT %3(s16)
87 %8:_(s64) = G_SEXT %4(s32)
89 %9:_(s32) = G_SEXT %1(s1)
91 %10:_(s32) = G_ZEXT %2(s8)
93 %11:_(s32) = G_ANYEXT %3(s16)
95 %12:_(s32) = G_ZEXT %1(s1)
97 %13:_(s32) = G_ANYEXT %2(s8)
99 %14:_(s32) = G_SEXT %3(s16)
101 %15:_(s8) = G_ZEXT %1(s1)
102 %22:_(s32) = G_ANYEXT %15(s8)
104 %16:_(s16) = G_ANYEXT %2(s8)
105 %23:_(s32) = G_ANYEXT %16(s16)
107 %17:_(s32) = G_TRUNC %0(s64)
109 %18:_(s64) = G_FPEXT %17(s32)
111 %24:_(s16) = G_IMPLICIT_DEF
112 %25:_(s32) = G_ZEXT %24(s16)
114 %26:_(s32) = G_SEXT %24(s16)
116 %27:_(s32) = G_ANYEXT %24(s16)
121 name: test_anyext_anyext
126 ; CHECK-LABEL: name: test_anyext_anyext
127 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
128 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
129 ; CHECK: $w0 = COPY [[COPY1]](s32)
131 %1:_(s1) = G_TRUNC %0(s32)
132 %2:_(s8) = G_ANYEXT %1(s1)
133 %3:_(s32) = G_ANYEXT %2(s8)
138 name: test_anyext_sext
143 ; CHECK-LABEL: name: test_anyext_sext
144 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
145 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
146 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
147 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
148 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
149 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C1]](s64)
150 ; CHECK: $w0 = COPY [[ASHR]](s32)
152 %1:_(s1) = G_TRUNC %0(s32)
153 %2:_(s8) = G_SEXT %1(s1)
154 %3:_(s32) = G_ANYEXT %2(s8)
159 name: test_anyext_zext
164 ; CHECK-LABEL: name: test_anyext_zext
165 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
166 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
167 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
168 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
169 ; CHECK: $w0 = COPY [[AND]](s32)
171 %1:_(s1) = G_TRUNC %0(s32)
172 %2:_(s8) = G_ZEXT %1(s1)
173 %3:_(s32) = G_ANYEXT %2(s8)
178 name: test_zext_v8s16_from_v8s8
180 tracksRegLiveness: true
181 machineFunctionInfo: {}
185 ; CHECK-LABEL: name: test_zext_v8s16_from_v8s8
186 ; CHECK: liveins: $d0
187 ; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
188 ; CHECK: [[ZEXT:%[0-9]+]]:_(<8 x s16>) = G_ZEXT [[COPY]](<8 x s8>)
189 ; CHECK: $q0 = COPY [[ZEXT]](<8 x s16>)
190 ; CHECK: RET_ReallyLR implicit $q0
191 %1:fpr(<8 x s8>) = COPY $d0
192 %2:_(<8 x s16>) = G_ZEXT %1(<8 x s8>)
193 $q0 = COPY %2(<8 x s16>)
194 RET_ReallyLR implicit $q0
198 name: test_sext_v8s16_from_v8s8
200 tracksRegLiveness: true
201 machineFunctionInfo: {}
205 ; CHECK-LABEL: name: test_sext_v8s16_from_v8s8
206 ; CHECK: liveins: $d0
207 ; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
208 ; CHECK: [[SEXT:%[0-9]+]]:_(<8 x s16>) = G_SEXT [[COPY]](<8 x s8>)
209 ; CHECK: $q0 = COPY [[SEXT]](<8 x s16>)
210 ; CHECK: RET_ReallyLR implicit $q0
211 %1:fpr(<8 x s8>) = COPY $d0
212 %2:_(<8 x s16>) = G_SEXT %1(<8 x s8>)
213 $q0 = COPY %2(<8 x s16>)
214 RET_ReallyLR implicit $q0
218 name: test_anyext_v8s16_from_v8s8
220 tracksRegLiveness: true
221 machineFunctionInfo: {}
225 ; CHECK-LABEL: name: test_anyext_v8s16_from_v8s8
226 ; CHECK: liveins: $d0
227 ; CHECK: [[COPY:%[0-9]+]]:fpr(<8 x s8>) = COPY $d0
228 ; CHECK: [[ANYEXT:%[0-9]+]]:_(<8 x s16>) = G_ANYEXT [[COPY]](<8 x s8>)
229 ; CHECK: $q0 = COPY [[ANYEXT]](<8 x s16>)
230 ; CHECK: RET_ReallyLR implicit $q0
231 %1:fpr(<8 x s8>) = COPY $d0
232 %2:_(<8 x s16>) = G_ANYEXT %1(<8 x s8>)
233 $q0 = COPY %2(<8 x s16>)
234 RET_ReallyLR implicit $q0
238 name: test_zext_v4s32_from_v4s16
240 tracksRegLiveness: true
241 machineFunctionInfo: {}
246 ; CHECK-LABEL: name: test_zext_v4s32_from_v4s16
247 ; CHECK: liveins: $d0
248 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
249 ; CHECK: [[ZEXT:%[0-9]+]]:_(<4 x s32>) = G_ZEXT [[COPY]](<4 x s16>)
250 ; CHECK: $q0 = COPY [[ZEXT]](<4 x s32>)
251 ; CHECK: RET_ReallyLR implicit $q0
252 %0:_(<4 x s16>) = COPY $d0
253 %1:_(<4 x s32>) = G_ZEXT %0(<4 x s16>)
254 $q0 = COPY %1(<4 x s32>)
255 RET_ReallyLR implicit $q0
259 name: test_sext_v4s32_from_v4s16
261 tracksRegLiveness: true
262 machineFunctionInfo: {}
267 ; CHECK-LABEL: name: test_sext_v4s32_from_v4s16
268 ; CHECK: liveins: $d0
269 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
270 ; CHECK: [[SEXT:%[0-9]+]]:_(<4 x s32>) = G_SEXT [[COPY]](<4 x s16>)
271 ; CHECK: $q0 = COPY [[SEXT]](<4 x s32>)
272 ; CHECK: RET_ReallyLR implicit $q0
273 %0:_(<4 x s16>) = COPY $d0
274 %1:_(<4 x s32>) = G_SEXT %0(<4 x s16>)
275 $q0 = COPY %1(<4 x s32>)
276 RET_ReallyLR implicit $q0
280 name: test_anyext_v4s32_from_v4s16
282 tracksRegLiveness: true
283 machineFunctionInfo: {}
288 ; CHECK-LABEL: name: test_anyext_v4s32_from_v4s16
289 ; CHECK: liveins: $d0
290 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
291 ; CHECK: [[ANYEXT:%[0-9]+]]:_(<4 x s32>) = G_ANYEXT [[COPY]](<4 x s16>)
292 ; CHECK: $q0 = COPY [[ANYEXT]](<4 x s32>)
293 ; CHECK: RET_ReallyLR implicit $q0
294 %0:_(<4 x s16>) = COPY $d0
295 %1:_(<4 x s32>) = G_ANYEXT %0(<4 x s16>)
296 $q0 = COPY %1(<4 x s32>)
297 RET_ReallyLR implicit $q0
301 name: test_zext_v2s64_from_v2s32
303 tracksRegLiveness: true
305 - { id: 0, class: _ }
306 - { id: 1, class: _ }
307 machineFunctionInfo: {}
312 ; CHECK-LABEL: name: test_zext_v2s64_from_v2s32
313 ; CHECK: liveins: $d0
314 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
315 ; CHECK: [[ZEXT:%[0-9]+]]:_(<2 x s64>) = G_ZEXT [[COPY]](<2 x s32>)
316 ; CHECK: $q0 = COPY [[ZEXT]](<2 x s64>)
317 ; CHECK: RET_ReallyLR implicit $q0
318 %0:_(<2 x s32>) = COPY $d0
319 %1:_(<2 x s64>) = G_ZEXT %0(<2 x s32>)
320 $q0 = COPY %1(<2 x s64>)
321 RET_ReallyLR implicit $q0
325 name: test_sext_v2s64_from_v2s32
327 tracksRegLiveness: true
329 - { id: 0, class: _ }
330 - { id: 1, class: _ }
331 machineFunctionInfo: {}
336 ; CHECK-LABEL: name: test_sext_v2s64_from_v2s32
337 ; CHECK: liveins: $d0
338 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
339 ; CHECK: [[SEXT:%[0-9]+]]:_(<2 x s64>) = G_SEXT [[COPY]](<2 x s32>)
340 ; CHECK: $q0 = COPY [[SEXT]](<2 x s64>)
341 ; CHECK: RET_ReallyLR implicit $q0
342 %0:_(<2 x s32>) = COPY $d0
343 %1:_(<2 x s64>) = G_SEXT %0(<2 x s32>)
344 $q0 = COPY %1(<2 x s64>)
345 RET_ReallyLR implicit $q0
349 name: test_anyext_v2s64_from_v2s32
351 tracksRegLiveness: true
353 - { id: 0, class: _ }
354 - { id: 1, class: _ }
355 machineFunctionInfo: {}
360 ; CHECK-LABEL: name: test_anyext_v2s64_from_v2s32
361 ; CHECK: liveins: $d0
362 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
363 ; CHECK: [[ANYEXT:%[0-9]+]]:_(<2 x s64>) = G_ANYEXT [[COPY]](<2 x s32>)
364 ; CHECK: $q0 = COPY [[ANYEXT]](<2 x s64>)
365 ; CHECK: RET_ReallyLR implicit $q0
366 %0:_(<2 x s32>) = COPY $d0
367 %1:_(<2 x s64>) = G_ANYEXT %0(<2 x s32>)
368 $q0 = COPY %1(<2 x s64>)
369 RET_ReallyLR implicit $q0