1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
6 define i8 @zext_i1_to_i8(i1 %val) {
7 %res = zext i1 %val to i8
11 define i16 @zext_i1_to_i16(i1 %val) {
12 %res = zext i1 %val to i16
16 define i32 @zext_i1_to_i32(i1 %val) {
17 %res = zext i1 %val to i32
21 define i64 @zext_i1_to_i64(i1 %val) {
22 %res = zext i1 %val to i64
26 define i16 @zext_i8_to_i16(i8 %val) {
27 %res = zext i8 %val to i16
31 define i32 @zext_i8_to_i32(i8 %val) {
32 %res = zext i8 %val to i32
36 define i64 @zext_i8_to_i64(i8 %val) {
37 %res = zext i8 %val to i64
41 define i32 @zext_i16_to_i32(i16 %val) {
42 %res = zext i16 %val to i32
46 define i64 @zext_i16_to_i64(i16 %val) {
47 %res = zext i16 %val to i64
51 define i64 @zext_i32_to_i64(i32 %val) {
52 %res = zext i32 %val to i64
62 tracksRegLiveness: true
65 - { id: 1, class: gpr }
66 - { id: 2, class: gpr }
67 - { id: 3, class: gpr }
68 - { id: 4, class: gpr }
73 ; CHECK-LABEL: name: zext_i1_to_i8
74 ; CHECK: liveins: $edi
75 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
76 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
77 ; CHECK: [[AND8ri:%[0-9]+]]:gr8 = AND8ri [[COPY1]], 1, implicit-def $eflags
78 ; CHECK: $al = COPY [[AND8ri]]
79 ; CHECK: RET 0, implicit $al
80 %1:gpr(s32) = COPY $edi
81 %3:gpr(s8) = G_CONSTANT i8 1
82 %4:gpr(s8) = G_TRUNC %1(s32)
83 %2:gpr(s8) = G_AND %4, %3
93 tracksRegLiveness: true
96 - { id: 1, class: gpr }
97 - { id: 2, class: gpr }
98 - { id: 3, class: gpr }
99 - { id: 4, class: gpr }
104 ; CHECK-LABEL: name: zext_i1_to_i16
105 ; CHECK: liveins: $edi
106 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
107 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
108 ; CHECK: [[AND16ri8_:%[0-9]+]]:gr16 = AND16ri8 [[COPY1]], 1, implicit-def $eflags
109 ; CHECK: $ax = COPY [[AND16ri8_]]
110 ; CHECK: RET 0, implicit $ax
111 %1:gpr(s32) = COPY $edi
112 %3:gpr(s16) = G_CONSTANT i16 1
113 %4:gpr(s16) = G_TRUNC %1(s32)
114 %2:gpr(s16) = G_AND %4, %3
123 regBankSelected: true
124 tracksRegLiveness: true
126 - { id: 0, class: _ }
127 - { id: 1, class: gpr }
128 - { id: 2, class: gpr }
129 - { id: 3, class: gpr }
130 - { id: 4, class: gpr }
135 ; CHECK-LABEL: name: zext_i1_to_i32
136 ; CHECK: liveins: $edi
137 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
138 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[COPY]], 1, implicit-def $eflags
139 ; CHECK: $eax = COPY [[AND32ri8_]]
140 ; CHECK: RET 0, implicit $eax
141 %1:gpr(s32) = COPY $edi
142 %3:gpr(s32) = G_CONSTANT i32 1
143 %4:gpr(s32) = COPY %1(s32)
144 %2:gpr(s32) = G_AND %4, %3
153 regBankSelected: true
154 tracksRegLiveness: true
156 - { id: 0, class: _ }
157 - { id: 1, class: gpr }
158 - { id: 2, class: gpr }
159 - { id: 3, class: gpr }
160 - { id: 4, class: gpr }
165 ; CHECK-LABEL: name: zext_i1_to_i64
166 ; CHECK: liveins: $edi
167 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
168 ; CHECK: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
169 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
170 ; CHECK: [[AND64ri8_:%[0-9]+]]:gr64 = AND64ri8 [[INSERT_SUBREG]], 1, implicit-def $eflags
171 ; CHECK: $rax = COPY [[AND64ri8_]]
172 ; CHECK: RET 0, implicit $rax
173 %1:gpr(s32) = COPY $edi
174 %3:gpr(s64) = G_CONSTANT i64 1
175 %4:gpr(s64) = G_ANYEXT %1(s32)
176 %2:gpr(s64) = G_AND %4, %3
185 regBankSelected: true
186 tracksRegLiveness: true
188 - { id: 0, class: _ }
189 - { id: 1, class: gpr }
190 - { id: 2, class: gpr }
191 - { id: 3, class: gpr }
192 - { id: 4, class: gpr }
197 ; CHECK-LABEL: name: zext_i8_to_i16
198 ; CHECK: liveins: $edi
199 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
200 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
201 ; CHECK: [[AND16ri:%[0-9]+]]:gr16 = AND16ri [[COPY1]], 255, implicit-def $eflags
202 ; CHECK: $ax = COPY [[AND16ri]]
203 ; CHECK: RET 0, implicit $ax
204 %1:gpr(s32) = COPY $edi
205 %3:gpr(s16) = G_CONSTANT i16 255
206 %4:gpr(s16) = G_TRUNC %1(s32)
207 %2:gpr(s16) = G_AND %4, %3
216 regBankSelected: true
217 tracksRegLiveness: true
219 - { id: 0, class: _ }
220 - { id: 1, class: gpr }
221 - { id: 2, class: gpr }
222 - { id: 3, class: gpr }
223 - { id: 4, class: gpr }
228 ; CHECK-LABEL: name: zext_i8_to_i32
229 ; CHECK: liveins: $edi
230 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
231 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
232 ; CHECK: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY1]]
233 ; CHECK: $eax = COPY [[MOVZX32rr8_]]
234 ; CHECK: RET 0, implicit $eax
235 %1:gpr(s32) = COPY $edi
236 %3:gpr(s32) = G_CONSTANT i32 255
237 %4:gpr(s32) = COPY %1(s32)
238 %2:gpr(s32) = G_AND %4, %3
247 regBankSelected: true
248 tracksRegLiveness: true
250 - { id: 0, class: _ }
251 - { id: 1, class: gpr }
252 - { id: 2, class: gpr }
253 - { id: 3, class: gpr }
254 - { id: 4, class: gpr }
259 ; CHECK-LABEL: name: zext_i8_to_i64
260 ; CHECK: liveins: $edi
261 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
262 ; CHECK: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
263 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
264 ; CHECK: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 255, implicit-def $eflags
265 ; CHECK: $rax = COPY [[AND64ri32_]]
266 ; CHECK: RET 0, implicit $rax
267 %1:gpr(s32) = COPY $edi
268 %3:gpr(s64) = G_CONSTANT i64 255
269 %4:gpr(s64) = G_ANYEXT %1(s32)
270 %2:gpr(s64) = G_AND %4, %3
276 name: zext_i16_to_i32
279 regBankSelected: true
280 tracksRegLiveness: true
282 - { id: 0, class: _ }
283 - { id: 1, class: gpr }
284 - { id: 2, class: gpr }
285 - { id: 3, class: gpr }
286 - { id: 4, class: gpr }
291 ; CHECK-LABEL: name: zext_i16_to_i32
292 ; CHECK: liveins: $edi
293 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
294 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
295 ; CHECK: [[MOVZX32rr16_:%[0-9]+]]:gr32 = MOVZX32rr16 [[COPY1]]
296 ; CHECK: $eax = COPY [[MOVZX32rr16_]]
297 ; CHECK: RET 0, implicit $eax
298 %1:gpr(s32) = COPY $edi
299 %3:gpr(s32) = G_CONSTANT i32 65535
300 %4:gpr(s32) = COPY %1(s32)
301 %2:gpr(s32) = G_AND %4, %3
307 name: zext_i16_to_i64
310 regBankSelected: true
311 tracksRegLiveness: true
313 - { id: 0, class: _ }
314 - { id: 1, class: gpr }
315 - { id: 2, class: gpr }
316 - { id: 3, class: gpr }
317 - { id: 4, class: gpr }
322 ; CHECK-LABEL: name: zext_i16_to_i64
323 ; CHECK: liveins: $edi
324 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
325 ; CHECK: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
326 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
327 ; CHECK: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 65535, implicit-def $eflags
328 ; CHECK: $rax = COPY [[AND64ri32_]]
329 ; CHECK: RET 0, implicit $rax
330 %1:gpr(s32) = COPY $edi
331 %3:gpr(s64) = G_CONSTANT i64 65535
332 %4:gpr(s64) = G_ANYEXT %1(s32)
333 %2:gpr(s64) = G_AND %4, %3
339 name: zext_i32_to_i64
342 regBankSelected: true
343 tracksRegLiveness: true
345 - { id: 0, class: gpr }
346 - { id: 1, class: gpr }
351 ; CHECK-LABEL: name: zext_i32_to_i64
352 ; CHECK: liveins: $edi
353 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
354 ; CHECK: [[MOV32rr:%[0-9]+]]:gr32 = MOV32rr [[COPY]]
355 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOV32rr]], %subreg.sub_32bit
356 ; CHECK: $rax = COPY [[SUBREG_TO_REG]]
357 ; CHECK: RET 0, implicit $rax
358 %0:gpr(s32) = COPY $edi
359 %1:gpr(s64) = G_ZEXT %0(s32)