1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s
5 define i64 @test_sext_i1(i8 %a) {
6 %val = trunc i8 %a to i1
7 %r = sext i1 %val to i64
11 define i64 @test_sext_i8(i8 %val) {
12 %r = sext i8 %val to i64
16 define i64 @test_sext_i16(i16 %val) {
17 %r = sext i16 %val to i64
21 define i64 @test_sext_i32(i32 %val) {
22 %r = sext i32 %val to i64
26 define i64 @test_zext_i1(i8 %a) {
27 %val = trunc i8 %a to i1
28 %r = zext i1 %val to i64
32 define i64 @test_zext_i8(i8 %val) {
33 %r = zext i8 %val to i64
37 define i64 @test_zext_i16(i16 %val) {
38 %r = zext i16 %val to i64
42 define i64 @test_zext_i32(i32 %val) {
43 %r = zext i32 %val to i64
47 define void @test_anyext_i1(i8 %a) {
51 define void @test_anyext_i8(i8 %val) {
55 define void @test_anyext_i16(i16 %val) {
59 define void @test_anyext_i32(i32 %val) {
69 regBankSelected: false
78 ; CHECK-LABEL: name: test_sext_i1
79 ; CHECK: liveins: $edi
81 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
82 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
83 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 63
84 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ANYEXT]], [[C]](s8)
85 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY [[C]](s8)
86 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[COPY1]](s8)
87 ; CHECK-NEXT: $rax = COPY [[ASHR]](s64)
88 ; CHECK-NEXT: RET 0, implicit $rax
90 %1(s1) = G_TRUNC %0(s8)
91 %2(s64) = G_SEXT %1(s1)
100 regBankSelected: false
102 - { id: 0, class: _ }
103 - { id: 1, class: _ }
108 ; CHECK-LABEL: name: test_sext_i8
109 ; CHECK: liveins: $edi
111 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
112 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s8)
113 ; CHECK-NEXT: $rax = COPY [[SEXT]](s64)
114 ; CHECK-NEXT: RET 0, implicit $rax
116 %1(s64) = G_SEXT %0(s8)
125 regBankSelected: false
127 - { id: 0, class: _ }
128 - { id: 1, class: _ }
133 ; CHECK-LABEL: name: test_sext_i16
134 ; CHECK: liveins: $edi
136 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $di
137 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s16)
138 ; CHECK-NEXT: $rax = COPY [[SEXT]](s64)
139 ; CHECK-NEXT: RET 0, implicit $rax
141 %1(s64) = G_SEXT %0(s16)
150 regBankSelected: false
152 - { id: 0, class: _ }
153 - { id: 1, class: _ }
158 ; CHECK-LABEL: name: test_sext_i32
159 ; CHECK: liveins: $edi
161 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
162 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
163 ; CHECK-NEXT: $rax = COPY [[SEXT]](s64)
164 ; CHECK-NEXT: RET 0, implicit $rax
166 %1(s64) = G_SEXT %0(s32)
175 regBankSelected: false
177 - { id: 0, class: _ }
178 - { id: 1, class: _ }
179 - { id: 2, class: _ }
184 ; CHECK-LABEL: name: test_zext_i1
185 ; CHECK: liveins: $edi
187 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
188 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
189 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
190 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
191 ; CHECK-NEXT: $rax = COPY [[AND]](s64)
192 ; CHECK-NEXT: RET 0, implicit $rax
194 %1(s1) = G_TRUNC %0(s8)
195 %2(s64) = G_ZEXT %1(s1)
204 regBankSelected: false
206 - { id: 0, class: _ }
207 - { id: 1, class: _ }
212 ; CHECK-LABEL: name: test_zext_i8
213 ; CHECK: liveins: $edi
215 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
216 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s8)
217 ; CHECK-NEXT: $rax = COPY [[ZEXT]](s64)
218 ; CHECK-NEXT: RET 0, implicit $rax
220 %1(s64) = G_ZEXT %0(s8)
229 regBankSelected: false
231 - { id: 0, class: _ }
232 - { id: 1, class: _ }
237 ; CHECK-LABEL: name: test_zext_i16
238 ; CHECK: liveins: $edi
240 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $di
241 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s16)
242 ; CHECK-NEXT: $rax = COPY [[ZEXT]](s64)
243 ; CHECK-NEXT: RET 0, implicit $rax
245 %1(s64) = G_ZEXT %0(s16)
254 regBankSelected: false
256 - { id: 0, class: _ }
257 - { id: 1, class: _ }
262 ; CHECK-LABEL: name: test_zext_i32
263 ; CHECK: liveins: $edi
265 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
266 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
267 ; CHECK-NEXT: $rax = COPY [[ZEXT]](s64)
268 ; CHECK-NEXT: RET 0, implicit $rax
270 %1(s64) = G_ZEXT %0(s32)
279 regBankSelected: false
281 - { id: 0, class: _ }
282 - { id: 1, class: _ }
283 - { id: 2, class: _ }
288 ; CHECK-LABEL: name: test_anyext_i1
289 ; CHECK: liveins: $edi
291 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
292 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
293 ; CHECK-NEXT: $rax = COPY [[ANYEXT]](s64)
294 ; CHECK-NEXT: RET 0, implicit $rax
296 %1(s1) = G_TRUNC %0(s8)
297 %2(s64) = G_ANYEXT %1(s1)
306 regBankSelected: false
308 - { id: 0, class: _ }
309 - { id: 1, class: _ }
314 ; CHECK-LABEL: name: test_anyext_i8
315 ; CHECK: liveins: $edi
317 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
318 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
319 ; CHECK-NEXT: $rax = COPY [[ANYEXT]](s64)
320 ; CHECK-NEXT: RET 0, implicit $rax
322 %1(s64) = G_ANYEXT %0(s8)
328 name: test_anyext_i16
331 regBankSelected: false
333 - { id: 0, class: _ }
334 - { id: 1, class: _ }
339 ; CHECK-LABEL: name: test_anyext_i16
340 ; CHECK: liveins: $edi
342 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s16) = COPY $di
343 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s16)
344 ; CHECK-NEXT: $rax = COPY [[ANYEXT]](s64)
345 ; CHECK-NEXT: RET 0, implicit $rax
347 %1(s64) = G_ANYEXT %0(s16)
353 name: test_anyext_i32
356 regBankSelected: false
358 - { id: 0, class: _ }
359 - { id: 1, class: _ }
364 ; CHECK-LABEL: name: test_anyext_i32
365 ; CHECK: liveins: $edi
367 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
368 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
369 ; CHECK-NEXT: $rax = COPY [[ANYEXT]](s64)
370 ; CHECK-NEXT: RET 0, implicit $rax
372 %1(s64) = G_ANYEXT %0(s32)