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
76 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
77 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
78 ; CHECK-NEXT: [[AND8ri:%[0-9]+]]:gr8 = AND8ri [[COPY1]], 1, implicit-def dead $eflags
79 ; CHECK-NEXT: $al = COPY [[AND8ri]]
80 ; CHECK-NEXT: RET 0, implicit $al
81 %1:gpr(s32) = COPY $edi
82 %3:gpr(s8) = G_CONSTANT i8 1
83 %4:gpr(s8) = G_TRUNC %1(s32)
84 %2:gpr(s8) = G_AND %4, %3
94 tracksRegLiveness: true
97 - { id: 1, class: gpr }
98 - { id: 2, class: gpr }
99 - { id: 3, class: gpr }
100 - { id: 4, class: gpr }
105 ; CHECK-LABEL: name: zext_i1_to_i16
106 ; CHECK: liveins: $edi
108 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
110 ; CHECK-NEXT: [[AND16ri:%[0-9]+]]:gr16 = AND16ri [[COPY1]], 1, implicit-def dead $eflags
111 ; CHECK-NEXT: $ax = COPY [[AND16ri]]
112 ; CHECK-NEXT: RET 0, implicit $ax
113 %1:gpr(s32) = COPY $edi
114 %3:gpr(s16) = G_CONSTANT i16 1
115 %4:gpr(s16) = G_TRUNC %1(s32)
116 %2:gpr(s16) = G_AND %4, %3
125 regBankSelected: true
126 tracksRegLiveness: true
128 - { id: 0, class: _ }
129 - { id: 1, class: gpr }
130 - { id: 2, class: gpr }
131 - { id: 3, class: gpr }
132 - { id: 4, class: gpr }
137 ; CHECK-LABEL: name: zext_i1_to_i32
138 ; CHECK: liveins: $edi
140 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
141 ; CHECK-NEXT: [[AND32ri:%[0-9]+]]:gr32 = AND32ri [[COPY]], 1, implicit-def dead $eflags
142 ; CHECK-NEXT: $eax = COPY [[AND32ri]]
143 ; CHECK-NEXT: RET 0, implicit $eax
144 %1:gpr(s32) = COPY $edi
145 %3:gpr(s32) = G_CONSTANT i32 1
146 %4:gpr(s32) = COPY %1(s32)
147 %2:gpr(s32) = G_AND %4, %3
156 regBankSelected: true
157 tracksRegLiveness: true
159 - { id: 0, class: _ }
160 - { id: 1, class: gpr }
161 - { id: 2, class: gpr }
162 - { id: 3, class: gpr }
163 - { id: 4, class: gpr }
168 ; CHECK-LABEL: name: zext_i1_to_i64
169 ; CHECK: liveins: $edi
171 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
172 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
173 ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
174 ; CHECK-NEXT: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 1, implicit-def dead $eflags
175 ; CHECK-NEXT: $rax = COPY [[AND64ri32_]]
176 ; CHECK-NEXT: RET 0, implicit $rax
177 %1:gpr(s32) = COPY $edi
178 %3:gpr(s64) = G_CONSTANT i64 1
179 %4:gpr(s64) = G_ANYEXT %1(s32)
180 %2:gpr(s64) = G_AND %4, %3
189 regBankSelected: true
190 tracksRegLiveness: true
192 - { id: 0, class: _ }
193 - { id: 1, class: gpr }
194 - { id: 2, class: gpr }
195 - { id: 3, class: gpr }
196 - { id: 4, class: gpr }
201 ; CHECK-LABEL: name: zext_i8_to_i16
202 ; CHECK: liveins: $edi
204 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
205 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
206 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
207 ; CHECK-NEXT: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY2]]
208 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gr16 = COPY [[MOVZX32rr8_]].sub_16bit
209 ; CHECK-NEXT: $ax = COPY [[COPY3]]
210 ; CHECK-NEXT: RET 0, implicit $ax
211 %1:gpr(s32) = COPY $edi
212 %3:gpr(s16) = G_CONSTANT i16 255
213 %4:gpr(s16) = G_TRUNC %1(s32)
214 %2:gpr(s16) = G_AND %4, %3
223 regBankSelected: true
224 tracksRegLiveness: true
226 - { id: 0, class: _ }
227 - { id: 1, class: gpr }
228 - { id: 2, class: gpr }
229 - { id: 3, class: gpr }
230 - { id: 4, class: gpr }
235 ; CHECK-LABEL: name: zext_i8_to_i32
236 ; CHECK: liveins: $edi
238 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
239 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
240 ; CHECK-NEXT: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY1]]
241 ; CHECK-NEXT: $eax = COPY [[MOVZX32rr8_]]
242 ; CHECK-NEXT: RET 0, implicit $eax
243 %1:gpr(s32) = COPY $edi
244 %3:gpr(s32) = G_CONSTANT i32 255
245 %4:gpr(s32) = COPY %1(s32)
246 %2:gpr(s32) = G_AND %4, %3
255 regBankSelected: true
256 tracksRegLiveness: true
258 - { id: 0, class: _ }
259 - { id: 1, class: gpr }
260 - { id: 2, class: gpr }
261 - { id: 3, class: gpr }
262 - { id: 4, class: gpr }
267 ; CHECK-LABEL: name: zext_i8_to_i64
268 ; CHECK: liveins: $edi
270 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
271 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
272 ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
273 ; CHECK-NEXT: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 255, implicit-def dead $eflags
274 ; CHECK-NEXT: $rax = COPY [[AND64ri32_]]
275 ; CHECK-NEXT: RET 0, implicit $rax
276 %1:gpr(s32) = COPY $edi
277 %3:gpr(s64) = G_CONSTANT i64 255
278 %4:gpr(s64) = G_ANYEXT %1(s32)
279 %2:gpr(s64) = G_AND %4, %3
285 name: zext_i16_to_i32
288 regBankSelected: true
289 tracksRegLiveness: true
291 - { id: 0, class: _ }
292 - { id: 1, class: gpr }
293 - { id: 2, class: gpr }
294 - { id: 3, class: gpr }
295 - { id: 4, class: gpr }
300 ; CHECK-LABEL: name: zext_i16_to_i32
301 ; CHECK: liveins: $edi
303 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
304 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
305 ; CHECK-NEXT: [[MOVZX32rr16_:%[0-9]+]]:gr32 = MOVZX32rr16 [[COPY1]]
306 ; CHECK-NEXT: $eax = COPY [[MOVZX32rr16_]]
307 ; CHECK-NEXT: RET 0, implicit $eax
308 %1:gpr(s32) = COPY $edi
309 %3:gpr(s32) = G_CONSTANT i32 65535
310 %4:gpr(s32) = COPY %1(s32)
311 %2:gpr(s32) = G_AND %4, %3
317 name: zext_i16_to_i64
320 regBankSelected: true
321 tracksRegLiveness: true
323 - { id: 0, class: _ }
324 - { id: 1, class: gpr }
325 - { id: 2, class: gpr }
326 - { id: 3, class: gpr }
327 - { id: 4, class: gpr }
332 ; CHECK-LABEL: name: zext_i16_to_i64
333 ; CHECK: liveins: $edi
335 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
336 ; CHECK-NEXT: [[DEF:%[0-9]+]]:gr64 = IMPLICIT_DEF
337 ; CHECK-NEXT: [[INSERT_SUBREG:%[0-9]+]]:gr64 = INSERT_SUBREG [[DEF]], [[COPY]], %subreg.sub_32bit
338 ; CHECK-NEXT: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[INSERT_SUBREG]], 65535, implicit-def dead $eflags
339 ; CHECK-NEXT: $rax = COPY [[AND64ri32_]]
340 ; CHECK-NEXT: RET 0, implicit $rax
341 %1:gpr(s32) = COPY $edi
342 %3:gpr(s64) = G_CONSTANT i64 65535
343 %4:gpr(s64) = G_ANYEXT %1(s32)
344 %2:gpr(s64) = G_AND %4, %3
350 name: zext_i32_to_i64
353 regBankSelected: true
354 tracksRegLiveness: true
356 - { id: 0, class: gpr }
357 - { id: 1, class: gpr }
362 ; CHECK-LABEL: name: zext_i32_to_i64
363 ; CHECK: liveins: $edi
365 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
366 ; CHECK-NEXT: [[MOV32rr:%[0-9]+]]:gr32 = MOV32rr [[COPY]]
367 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[MOV32rr]], %subreg.sub_32bit
368 ; CHECK-NEXT: $rax = COPY [[SUBREG_TO_REG]]
369 ; CHECK-NEXT: RET 0, implicit $rax
370 %0:gpr(s32) = COPY $edi
371 %1:gpr(s64) = G_ZEXT %0(s32)