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: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
80 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
81 ; CHECK: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 63
82 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ANYEXT]], [[C]](s8)
83 ; CHECK: [[COPY1:%[0-9]+]]:_(s8) = COPY [[C]](s8)
84 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[COPY1]](s8)
85 ; CHECK: $rax = COPY [[ASHR]](s64)
86 ; CHECK: RET 0, implicit $rax
88 %1(s1) = G_TRUNC %0(s8)
89 %2(s64) = G_SEXT %1(s1)
98 regBankSelected: false
100 - { id: 0, class: _ }
101 - { id: 1, class: _ }
106 ; CHECK-LABEL: name: test_sext_i8
107 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
108 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s8)
109 ; CHECK: $rax = COPY [[SEXT]](s64)
110 ; CHECK: RET 0, implicit $rax
112 %1(s64) = G_SEXT %0(s8)
121 regBankSelected: false
123 - { id: 0, class: _ }
124 - { id: 1, class: _ }
129 ; CHECK-LABEL: name: test_sext_i16
130 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
131 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s16)
132 ; CHECK: $rax = COPY [[SEXT]](s64)
133 ; CHECK: RET 0, implicit $rax
135 %1(s64) = G_SEXT %0(s16)
144 regBankSelected: false
146 - { id: 0, class: _ }
147 - { id: 1, class: _ }
152 ; CHECK-LABEL: name: test_sext_i32
153 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
154 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
155 ; CHECK: $rax = COPY [[SEXT]](s64)
156 ; CHECK: RET 0, implicit $rax
158 %1(s64) = G_SEXT %0(s32)
167 regBankSelected: false
169 - { id: 0, class: _ }
170 - { id: 1, class: _ }
171 - { id: 2, class: _ }
176 ; CHECK-LABEL: name: test_zext_i1
177 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
178 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
179 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
180 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
181 ; CHECK: $rax = COPY [[AND]](s64)
182 ; CHECK: RET 0, implicit $rax
184 %1(s1) = G_TRUNC %0(s8)
185 %2(s64) = G_ZEXT %1(s1)
194 regBankSelected: false
196 - { id: 0, class: _ }
197 - { id: 1, class: _ }
202 ; CHECK-LABEL: name: test_zext_i8
203 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
204 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s8)
205 ; CHECK: $rax = COPY [[ZEXT]](s64)
206 ; CHECK: RET 0, implicit $rax
208 %1(s64) = G_ZEXT %0(s8)
217 regBankSelected: false
219 - { id: 0, class: _ }
220 - { id: 1, class: _ }
225 ; CHECK-LABEL: name: test_zext_i16
226 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
227 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s16)
228 ; CHECK: $rax = COPY [[ZEXT]](s64)
229 ; CHECK: RET 0, implicit $rax
231 %1(s64) = G_ZEXT %0(s16)
240 regBankSelected: false
242 - { id: 0, class: _ }
243 - { id: 1, class: _ }
248 ; CHECK-LABEL: name: test_zext_i32
249 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
250 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
251 ; CHECK: $rax = COPY [[ZEXT]](s64)
252 ; CHECK: RET 0, implicit $rax
254 %1(s64) = G_ZEXT %0(s32)
263 regBankSelected: false
265 - { id: 0, class: _ }
266 - { id: 1, class: _ }
267 - { id: 2, class: _ }
272 ; CHECK-LABEL: name: test_anyext_i1
273 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
274 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
275 ; CHECK: $rax = COPY [[ANYEXT]](s64)
276 ; CHECK: RET 0, implicit $rax
278 %1(s1) = G_TRUNC %0(s8)
279 %2(s64) = G_ANYEXT %1(s1)
288 regBankSelected: false
290 - { id: 0, class: _ }
291 - { id: 1, class: _ }
296 ; CHECK-LABEL: name: test_anyext_i8
297 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
298 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
299 ; CHECK: $rax = COPY [[ANYEXT]](s64)
300 ; CHECK: RET 0, implicit $rax
302 %1(s64) = G_ANYEXT %0(s8)
308 name: test_anyext_i16
311 regBankSelected: false
313 - { id: 0, class: _ }
314 - { id: 1, class: _ }
319 ; CHECK-LABEL: name: test_anyext_i16
320 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
321 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s16)
322 ; CHECK: $rax = COPY [[ANYEXT]](s64)
323 ; CHECK: RET 0, implicit $rax
325 %1(s64) = G_ANYEXT %0(s16)
331 name: test_anyext_i32
334 regBankSelected: false
336 - { id: 0, class: _ }
337 - { id: 1, class: _ }
342 ; CHECK-LABEL: name: test_anyext_i32
343 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
344 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
345 ; CHECK: $rax = COPY [[ANYEXT]](s64)
346 ; CHECK: RET 0, implicit $rax
348 %1(s64) = G_ANYEXT %0(s32)