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: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32bit
169 ; CHECK: [[AND64ri8_:%[0-9]+]]:gr64 = AND64ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
170 ; CHECK: $rax = COPY [[AND64ri8_]]
171 ; CHECK: RET 0, implicit $rax
172 %1:gpr(s32) = COPY $edi
173 %3:gpr(s64) = G_CONSTANT i64 1
174 %4:gpr(s64) = G_ANYEXT %1(s32)
175 %2:gpr(s64) = G_AND %4, %3
184 regBankSelected: true
185 tracksRegLiveness: true
187 - { id: 0, class: _ }
188 - { id: 1, class: gpr }
189 - { id: 2, class: gpr }
190 - { id: 3, class: gpr }
191 - { id: 4, class: gpr }
196 ; CHECK-LABEL: name: zext_i8_to_i16
197 ; CHECK: liveins: $edi
198 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
199 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
200 ; CHECK: [[AND16ri:%[0-9]+]]:gr16 = AND16ri [[COPY1]], 255, implicit-def $eflags
201 ; CHECK: $ax = COPY [[AND16ri]]
202 ; CHECK: RET 0, implicit $ax
203 %1:gpr(s32) = COPY $edi
204 %3:gpr(s16) = G_CONSTANT i16 255
205 %4:gpr(s16) = G_TRUNC %1(s32)
206 %2:gpr(s16) = G_AND %4, %3
215 regBankSelected: true
216 tracksRegLiveness: true
218 - { id: 0, class: _ }
219 - { id: 1, class: gpr }
220 - { id: 2, class: gpr }
221 - { id: 3, class: gpr }
222 - { id: 4, class: gpr }
227 ; CHECK-LABEL: name: zext_i8_to_i32
228 ; CHECK: liveins: $edi
229 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
230 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
231 ; CHECK: [[MOVZX32rr8_:%[0-9]+]]:gr32 = MOVZX32rr8 [[COPY1]]
232 ; CHECK: $eax = COPY [[MOVZX32rr8_]]
233 ; CHECK: RET 0, implicit $eax
234 %1:gpr(s32) = COPY $edi
235 %3:gpr(s32) = G_CONSTANT i32 255
236 %4:gpr(s32) = COPY %1(s32)
237 %2:gpr(s32) = G_AND %4, %3
246 regBankSelected: true
247 tracksRegLiveness: true
249 - { id: 0, class: _ }
250 - { id: 1, class: gpr }
251 - { id: 2, class: gpr }
252 - { id: 3, class: gpr }
253 - { id: 4, class: gpr }
258 ; CHECK-LABEL: name: zext_i8_to_i64
259 ; CHECK: liveins: $edi
260 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
261 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32bit
262 ; CHECK: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[SUBREG_TO_REG]], 255, implicit-def $eflags
263 ; CHECK: $rax = COPY [[AND64ri32_]]
264 ; CHECK: RET 0, implicit $rax
265 %1:gpr(s32) = COPY $edi
266 %3:gpr(s64) = G_CONSTANT i64 255
267 %4:gpr(s64) = G_ANYEXT %1(s32)
268 %2:gpr(s64) = G_AND %4, %3
274 name: zext_i16_to_i32
277 regBankSelected: true
278 tracksRegLiveness: true
280 - { id: 0, class: _ }
281 - { id: 1, class: gpr }
282 - { id: 2, class: gpr }
283 - { id: 3, class: gpr }
284 - { id: 4, class: gpr }
289 ; CHECK-LABEL: name: zext_i16_to_i32
290 ; CHECK: liveins: $edi
291 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
292 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
293 ; CHECK: [[MOVZX32rr16_:%[0-9]+]]:gr32 = MOVZX32rr16 [[COPY1]]
294 ; CHECK: $eax = COPY [[MOVZX32rr16_]]
295 ; CHECK: RET 0, implicit $eax
296 %1:gpr(s32) = COPY $edi
297 %3:gpr(s32) = G_CONSTANT i32 65535
298 %4:gpr(s32) = COPY %1(s32)
299 %2:gpr(s32) = G_AND %4, %3
305 name: zext_i16_to_i64
308 regBankSelected: true
309 tracksRegLiveness: true
311 - { id: 0, class: _ }
312 - { id: 1, class: gpr }
313 - { id: 2, class: gpr }
314 - { id: 3, class: gpr }
315 - { id: 4, class: gpr }
320 ; CHECK-LABEL: name: zext_i16_to_i64
321 ; CHECK: liveins: $edi
322 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
323 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32bit
324 ; CHECK: [[AND64ri32_:%[0-9]+]]:gr64 = AND64ri32 [[SUBREG_TO_REG]], 65535, implicit-def $eflags
325 ; CHECK: $rax = COPY [[AND64ri32_]]
326 ; CHECK: RET 0, implicit $rax
327 %1:gpr(s32) = COPY $edi
328 %3:gpr(s64) = G_CONSTANT i64 65535
329 %4:gpr(s64) = G_ANYEXT %1(s32)
330 %2:gpr(s64) = G_AND %4, %3
336 name: zext_i32_to_i64
339 regBankSelected: true
340 tracksRegLiveness: true
342 - { id: 0, class: gpr }
343 - { id: 1, class: gpr }
348 ; CHECK-LABEL: name: zext_i32_to_i64
349 ; CHECK: liveins: $edi
350 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
351 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32bit
352 ; CHECK: $rax = COPY [[SUBREG_TO_REG]]
353 ; CHECK: RET 0, implicit $rax
354 %0:gpr(s32) = COPY $edi
355 %1:gpr(s64) = G_ZEXT %0(s32)