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: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
81 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
82 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s64)
83 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[ANYEXT]], [[TRUNC]](s8)
84 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s64)
85 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[TRUNC1]](s8)
86 ; CHECK: $rax = COPY [[ASHR]](s64)
87 ; CHECK: RET 0, implicit $rax
89 %1(s1) = G_TRUNC %0(s8)
90 %2(s64) = G_SEXT %1(s1)
99 regBankSelected: false
101 - { id: 0, class: _ }
102 - { id: 1, class: _ }
107 ; CHECK-LABEL: name: test_sext_i8
108 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
109 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s8)
110 ; CHECK: $rax = COPY [[SEXT]](s64)
111 ; CHECK: RET 0, implicit $rax
113 %1(s64) = G_SEXT %0(s8)
122 regBankSelected: false
124 - { id: 0, class: _ }
125 - { id: 1, class: _ }
130 ; CHECK-LABEL: name: test_sext_i16
131 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
132 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s16)
133 ; CHECK: $rax = COPY [[SEXT]](s64)
134 ; CHECK: RET 0, implicit $rax
136 %1(s64) = G_SEXT %0(s16)
145 regBankSelected: false
147 - { id: 0, class: _ }
148 - { id: 1, class: _ }
153 ; CHECK-LABEL: name: test_sext_i32
154 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
155 ; CHECK: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[COPY]](s32)
156 ; CHECK: $rax = COPY [[SEXT]](s64)
157 ; CHECK: RET 0, implicit $rax
159 %1(s64) = G_SEXT %0(s32)
168 regBankSelected: false
170 - { id: 0, class: _ }
171 - { id: 1, class: _ }
172 - { id: 2, class: _ }
177 ; CHECK-LABEL: name: test_zext_i1
178 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
179 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
180 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
181 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
182 ; CHECK: $rax = COPY [[AND]](s64)
183 ; CHECK: RET 0, implicit $rax
185 %1(s1) = G_TRUNC %0(s8)
186 %2(s64) = G_ZEXT %1(s1)
195 regBankSelected: false
197 - { id: 0, class: _ }
198 - { id: 1, class: _ }
203 ; CHECK-LABEL: name: test_zext_i8
204 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
205 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s8)
206 ; CHECK: $rax = COPY [[ZEXT]](s64)
207 ; CHECK: RET 0, implicit $rax
209 %1(s64) = G_ZEXT %0(s8)
218 regBankSelected: false
220 - { id: 0, class: _ }
221 - { id: 1, class: _ }
226 ; CHECK-LABEL: name: test_zext_i16
227 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
228 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s16)
229 ; CHECK: $rax = COPY [[ZEXT]](s64)
230 ; CHECK: RET 0, implicit $rax
232 %1(s64) = G_ZEXT %0(s16)
241 regBankSelected: false
243 - { id: 0, class: _ }
244 - { id: 1, class: _ }
249 ; CHECK-LABEL: name: test_zext_i32
250 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
251 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
252 ; CHECK: $rax = COPY [[ZEXT]](s64)
253 ; CHECK: RET 0, implicit $rax
255 %1(s64) = G_ZEXT %0(s32)
264 regBankSelected: false
266 - { id: 0, class: _ }
267 - { id: 1, class: _ }
268 - { id: 2, class: _ }
273 ; CHECK-LABEL: name: test_anyext_i1
274 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
275 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
276 ; CHECK: $rax = COPY [[ANYEXT]](s64)
277 ; CHECK: RET 0, implicit $rax
279 %1(s1) = G_TRUNC %0(s8)
280 %2(s64) = G_ANYEXT %1(s1)
289 regBankSelected: false
291 - { id: 0, class: _ }
292 - { id: 1, class: _ }
297 ; CHECK-LABEL: name: test_anyext_i8
298 ; CHECK: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
299 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s8)
300 ; CHECK: $rax = COPY [[ANYEXT]](s64)
301 ; CHECK: RET 0, implicit $rax
303 %1(s64) = G_ANYEXT %0(s8)
309 name: test_anyext_i16
312 regBankSelected: false
314 - { id: 0, class: _ }
315 - { id: 1, class: _ }
320 ; CHECK-LABEL: name: test_anyext_i16
321 ; CHECK: [[COPY:%[0-9]+]]:_(s16) = COPY $di
322 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s16)
323 ; CHECK: $rax = COPY [[ANYEXT]](s64)
324 ; CHECK: RET 0, implicit $rax
326 %1(s64) = G_ANYEXT %0(s16)
332 name: test_anyext_i32
335 regBankSelected: false
337 - { id: 0, class: _ }
338 - { id: 1, class: _ }
343 ; CHECK-LABEL: name: test_anyext_i32
344 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
345 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
346 ; CHECK: $rax = COPY [[ANYEXT]](s64)
347 ; CHECK: RET 0, implicit $rax
349 %1(s64) = G_ANYEXT %0(s32)