1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
7 tracksRegLiveness: true
10 liveins: $x0, $x1, $x2
13 ; CHECK-LABEL: name: test_extracts_4
14 ; CHECK: liveins: $x0, $x1, $x2
16 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
17 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[COPY]](s64), 32
18 ; CHECK-NEXT: $w0 = COPY [[EXTRACT]](s32)
19 ; CHECK-NEXT: RET_ReallyLR implicit $w0
22 %2:_(s128) = G_MERGE_VALUES %0, %1
23 %3:_(s32) = G_EXTRACT %2, 32
25 RET_ReallyLR implicit $w0
29 tracksRegLiveness: true
33 ; CHECK-LABEL: name: p0_from_s128
34 ; CHECK: liveins: $x0, $q0
36 ; CHECK-NEXT: %val:_(s128) = COPY $q0
37 ; CHECK-NEXT: %extract:_(p0) = G_EXTRACT %val(s128), 0
38 ; CHECK-NEXT: $x0 = COPY %extract(p0)
39 ; CHECK-NEXT: RET_ReallyLR implicit $x0
40 %val:_(s128) = COPY $q0
41 %extract:_(p0) = G_EXTRACT %val, 0
43 RET_ReallyLR implicit $x0
47 tracksRegLiveness: true
51 ; CHECK-LABEL: name: s64_from_s128
52 ; CHECK: liveins: $x0, $q0
54 ; CHECK-NEXT: %val:_(s128) = COPY $q0
55 ; CHECK-NEXT: %extract:_(s64) = G_EXTRACT %val(s128), 0
56 ; CHECK-NEXT: $x0 = COPY %extract(s64)
57 ; CHECK-NEXT: RET_ReallyLR implicit $x0
58 %val:_(s128) = COPY $q0
59 %extract:_(s64) = G_EXTRACT %val, 0
61 RET_ReallyLR implicit $x0
65 tracksRegLiveness: true
69 ; CHECK-LABEL: name: s32_from_s128
70 ; CHECK: liveins: $w0, $q0
72 ; CHECK-NEXT: %val:_(s128) = COPY $q0
73 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT %val(s128), 0
74 ; CHECK-NEXT: $w0 = COPY %extract(s32)
75 ; CHECK-NEXT: RET_ReallyLR implicit $w0
76 %val:_(s128) = COPY $q0
77 %extract:_(s32) = G_EXTRACT %val, 0
79 RET_ReallyLR implicit $w0
83 tracksRegLiveness: true
87 ; CHECK-LABEL: name: s32_from_s64
90 ; CHECK-NEXT: %val:_(s64) = COPY $x0
91 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT %val(s64), 0
92 ; CHECK-NEXT: $w0 = COPY %extract(s32)
93 ; CHECK-NEXT: RET_ReallyLR implicit $w0
94 %val:_(s64) = COPY $x0
95 %extract:_(s32) = G_EXTRACT %val, 0
97 RET_ReallyLR implicit $w0
101 tracksRegLiveness: true
105 ; CHECK-LABEL: name: s32_from_p0
106 ; CHECK: liveins: $w0
108 ; CHECK-NEXT: %val:_(p0) = COPY $x0
109 ; CHECK-NEXT: %extract:_(s32) = G_EXTRACT %val(p0), 0
110 ; CHECK-NEXT: $w0 = COPY %extract(s32)
111 ; CHECK-NEXT: RET_ReallyLR implicit $w0
112 %val:_(p0) = COPY $x0
113 %extract:_(s32) = G_EXTRACT %val, 0
115 RET_ReallyLR implicit $w0
119 tracksRegLiveness: true
123 ; CHECK-LABEL: name: s16_from_s128
124 ; CHECK: liveins: $h0, $q0
126 ; CHECK-NEXT: %val:_(s128) = COPY $q0
127 ; CHECK-NEXT: %extract:_(s16) = G_EXTRACT %val(s128), 0
128 ; CHECK-NEXT: $h0 = COPY %extract(s16)
129 ; CHECK-NEXT: RET_ReallyLR implicit $h0
130 %val:_(s128) = COPY $q0
131 %extract:_(s16) = G_EXTRACT %val, 0
133 RET_ReallyLR implicit $h0
137 tracksRegLiveness: true
141 ; CHECK-LABEL: name: s16_from_s64
142 ; CHECK: liveins: $h0, $x0
144 ; CHECK-NEXT: %val:_(s64) = COPY $x0
145 ; CHECK-NEXT: %extract:_(s16) = G_EXTRACT %val(s64), 0
146 ; CHECK-NEXT: $h0 = COPY %extract(s16)
147 ; CHECK-NEXT: RET_ReallyLR implicit $h0
148 %val:_(s64) = COPY $x0
149 %extract:_(s16) = G_EXTRACT %val, 0
151 RET_ReallyLR implicit $h0
155 tracksRegLiveness: true
159 ; CHECK-LABEL: name: s16_from_s32
160 ; CHECK: liveins: $h0, $w0
162 ; CHECK-NEXT: %val:_(s32) = COPY $w0
163 ; CHECK-NEXT: %extract:_(s16) = G_EXTRACT %val(s32), 0
164 ; CHECK-NEXT: $h0 = COPY %extract(s16)
165 ; CHECK-NEXT: RET_ReallyLR implicit $h0
166 %val:_(s32) = COPY $w0
167 %extract:_(s16) = G_EXTRACT %val, 0
169 RET_ReallyLR implicit $h0
173 tracksRegLiveness: true
177 ; CHECK-LABEL: name: s8_from_s128
178 ; CHECK: liveins: $b0, $q0
180 ; CHECK-NEXT: %val:_(s128) = COPY $q0
181 ; CHECK-NEXT: %extract:_(s8) = G_TRUNC %val(s128)
182 ; CHECK-NEXT: $b0 = COPY %extract(s8)
183 ; CHECK-NEXT: RET_ReallyLR implicit $b0
184 %val:_(s128) = COPY $q0
185 %extract:_(s8) = G_EXTRACT %val, 0
187 RET_ReallyLR implicit $b0
191 tracksRegLiveness: true
195 ; CHECK-LABEL: name: s8_from_s64
196 ; CHECK: liveins: $b0, $x0
198 ; CHECK-NEXT: %val:_(s64) = COPY $x0
199 ; CHECK-NEXT: %extract:_(s8) = G_TRUNC %val(s64)
200 ; CHECK-NEXT: $b0 = COPY %extract(s8)
201 ; CHECK-NEXT: RET_ReallyLR implicit $b0
202 %val:_(s64) = COPY $x0
203 %extract:_(s8) = G_EXTRACT %val, 0
205 RET_ReallyLR implicit $b0
209 tracksRegLiveness: true
213 ; CHECK-LABEL: name: s8_from_s32
214 ; CHECK: liveins: $b0, $w0
216 ; CHECK-NEXT: %val:_(s32) = COPY $w0
217 ; CHECK-NEXT: %extract:_(s8) = G_TRUNC %val(s32)
218 ; CHECK-NEXT: $b0 = COPY %extract(s8)
219 ; CHECK-NEXT: RET_ReallyLR implicit $b0
220 %val:_(s32) = COPY $w0
221 %extract:_(s8) = G_EXTRACT %val, 0
223 RET_ReallyLR implicit $b0
227 tracksRegLiveness: true
231 ; CHECK-LABEL: name: s8_from_s16
232 ; CHECK: liveins: $b0, $h0
234 ; CHECK-NEXT: %val:_(s16) = COPY $h0
235 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT %val(s16)
236 ; CHECK-NEXT: %extract:_(s8) = G_TRUNC [[ANYEXT]](s32)
237 ; CHECK-NEXT: $b0 = COPY %extract(s8)
238 ; CHECK-NEXT: RET_ReallyLR implicit $b0
239 %val:_(s16) = COPY $h0
240 %extract:_(s8) = G_EXTRACT %val, 0
242 RET_ReallyLR implicit $b0
246 tracksRegLiveness: true
250 ; CHECK-LABEL: name: s1_from_s32
251 ; CHECK: liveins: $w0
253 ; CHECK-NEXT: %val:_(s32) = COPY $w0
254 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
255 ; CHECK-NEXT: %ext:_(s32) = G_AND %val, [[C]]
256 ; CHECK-NEXT: $w0 = COPY %ext(s32)
257 ; CHECK-NEXT: RET_ReallyLR implicit $w0
258 %val:_(s32) = COPY $w0
259 %extract:_(s1) = G_EXTRACT %val, 0
260 %ext:_(s32) = G_ZEXT %extract
262 RET_ReallyLR implicit $w0
266 tracksRegLiveness: true
270 ; CHECK-LABEL: name: s3_from_s32
271 ; CHECK: liveins: $w0
273 ; CHECK-NEXT: %val:_(s32) = COPY $w0
274 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
275 ; CHECK-NEXT: %ext:_(s32) = G_AND %val, [[C]]
276 ; CHECK-NEXT: $w0 = COPY %ext(s32)
277 ; CHECK-NEXT: RET_ReallyLR implicit $w0
278 %val:_(s32) = COPY $w0
279 %extract:_(s3) = G_EXTRACT %val, 0
280 %ext:_(s32) = G_ZEXT %extract
282 RET_ReallyLR implicit $w0
286 tracksRegLiveness: true
290 ; CHECK-LABEL: name: s3_from_s35
291 ; CHECK: liveins: $w0
293 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
294 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
295 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[DEF]](s64)
296 ; CHECK-NEXT: %ext:_(s32) = G_AND [[TRUNC]], [[C]]
297 ; CHECK-NEXT: $w0 = COPY %ext(s32)
298 ; CHECK-NEXT: RET_ReallyLR implicit $w0
299 %val:_(s35) = G_IMPLICIT_DEF
300 %extract:_(s3) = G_EXTRACT %val, 0
301 %ext:_(s32) = G_ZEXT %extract
303 RET_ReallyLR implicit $w0
307 tracksRegLiveness: true
311 ; CHECK-LABEL: name: s4_from_s32
312 ; CHECK: liveins: $w0
314 ; CHECK-NEXT: %val:_(s32) = COPY $w0
315 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 15
316 ; CHECK-NEXT: %ext:_(s32) = G_AND %val, [[C]]
317 ; CHECK-NEXT: $w0 = COPY %ext(s32)
318 ; CHECK-NEXT: RET_ReallyLR implicit $w0
319 %val:_(s32) = COPY $w0
320 %extract:_(s4) = G_EXTRACT %val, 0
321 %ext:_(s32) = G_ZEXT %extract
323 RET_ReallyLR implicit $w0
327 tracksRegLiveness: true
331 ; CHECK-LABEL: name: s64_from_s264
332 ; CHECK: liveins: $x0
334 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
335 ; CHECK-NEXT: %extract:_(s64) = COPY [[DEF]](s64)
336 ; CHECK-NEXT: $x0 = COPY %extract(s64)
337 ; CHECK-NEXT: RET_ReallyLR implicit $x0
338 %val:_(s264) = G_IMPLICIT_DEF
339 %extract:_(s64) = G_EXTRACT %val, 0
341 RET_ReallyLR implicit $x0
345 tracksRegLiveness: true
349 ; CHECK-LABEL: name: s16_from_s144
350 ; CHECK: liveins: $h0
352 ; CHECK-NEXT: %h0:_(s16) = COPY $h0
353 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES %h0(s16), %h0(s16), %h0(s16), %h0(s16)
354 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s16) = G_EXTRACT [[MV]](s64), 1
355 ; CHECK-NEXT: %extract:_(s16) = COPY [[EXTRACT]](s16)
356 ; CHECK-NEXT: $h0 = COPY %extract(s16)
357 ; CHECK-NEXT: RET_ReallyLR implicit $h0
358 %h0:_(s16) = COPY $h0
359 %val:_(s144) = G_MERGE_VALUES %h0, %h0, %h0, %h0, %h0, %h0, %h0, %h0, %h0
360 %extract:_(s16) = G_EXTRACT %val, 1
362 RET_ReallyLR implicit $h0
366 tracksRegLiveness: true
370 ; CHECK-LABEL: name: s32_from_s144
371 ; CHECK: liveins: $h0, $w0
373 ; CHECK-NEXT: %h0:_(s16) = COPY $h0
374 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES %h0(s16), %h0(s16), %h0(s16), %h0(s16)
375 ; CHECK-NEXT: [[EXTRACT:%[0-9]+]]:_(s32) = G_EXTRACT [[MV]](s64), 1
376 ; CHECK-NEXT: %extract:_(s32) = COPY [[EXTRACT]](s32)
377 ; CHECK-NEXT: $w0 = COPY %extract(s32)
378 ; CHECK-NEXT: RET_ReallyLR implicit $w0
379 %h0:_(s16) = COPY $h0
380 %val:_(s144) = G_MERGE_VALUES %h0, %h0, %h0, %h0, %h0, %h0, %h0, %h0, %h0
381 %extract:_(s32) = G_EXTRACT %val, 1
383 RET_ReallyLR implicit $w0