1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer -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
60 tracksRegLiveness: true
69 ; CHECK-LABEL: name: zext_i1_to_i8
70 ; CHECK: liveins: $edi
71 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
72 ; CHECK: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
73 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
74 ; CHECK: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
75 ; CHECK: $al = COPY [[AND]](s8)
76 ; CHECK: RET 0, implicit $al
78 %0:_(s1) = G_TRUNC %1(s32)
79 %2:_(s8) = G_ZEXT %0(s1)
87 tracksRegLiveness: true
96 ; CHECK-LABEL: name: zext_i1_to_i16
97 ; CHECK: liveins: $edi
98 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
99 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
100 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
101 ; CHECK: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
102 ; CHECK: $ax = COPY [[AND]](s16)
103 ; CHECK: RET 0, implicit $ax
104 %1:_(s32) = COPY $edi
105 %0:_(s1) = G_TRUNC %1(s32)
106 %2:_(s16) = G_ZEXT %0(s1)
114 tracksRegLiveness: true
116 - { id: 0, class: _ }
117 - { id: 1, class: _ }
118 - { id: 2, class: _ }
123 ; CHECK-LABEL: name: zext_i1_to_i32
124 ; CHECK: liveins: $edi
125 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
126 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
127 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
128 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
129 ; CHECK: $eax = COPY [[AND]](s32)
130 ; CHECK: RET 0, implicit $eax
131 %1:_(s32) = COPY $edi
132 %0:_(s1) = G_TRUNC %1(s32)
133 %2:_(s32) = G_ZEXT %0(s1)
141 tracksRegLiveness: true
143 - { id: 0, class: _ }
144 - { id: 1, class: _ }
145 - { id: 2, class: _ }
150 ; CHECK-LABEL: name: zext_i1_to_i64
151 ; CHECK: liveins: $edi
152 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
153 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
154 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
155 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
156 ; CHECK: $rax = COPY [[AND]](s64)
157 ; CHECK: RET 0, implicit $rax
158 %1:_(s32) = COPY $edi
159 %0:_(s1) = G_TRUNC %1(s32)
160 %2:_(s64) = G_ZEXT %0(s1)
168 tracksRegLiveness: true
170 - { id: 0, class: _ }
171 - { id: 1, class: _ }
172 - { id: 2, class: _ }
177 ; CHECK-LABEL: name: zext_i8_to_i16
178 ; CHECK: liveins: $edi
179 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
180 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
181 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
182 ; CHECK: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
183 ; CHECK: $ax = COPY [[AND]](s16)
184 ; CHECK: RET 0, implicit $ax
185 %1:_(s32) = COPY $edi
186 %0:_(s8) = G_TRUNC %1(s32)
187 %2:_(s16) = G_ZEXT %0(s8)
195 tracksRegLiveness: true
197 - { id: 0, class: _ }
198 - { id: 1, class: _ }
199 - { id: 2, class: _ }
204 ; CHECK-LABEL: name: zext_i8_to_i32
205 ; CHECK: liveins: $edi
206 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
207 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
208 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
209 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
210 ; CHECK: $eax = COPY [[AND]](s32)
211 ; CHECK: RET 0, implicit $eax
212 %1:_(s32) = COPY $edi
213 %0:_(s8) = G_TRUNC %1(s32)
214 %2:_(s32) = G_ZEXT %0(s8)
222 tracksRegLiveness: true
224 - { id: 0, class: _ }
225 - { id: 1, class: _ }
226 - { id: 2, class: _ }
231 ; CHECK-LABEL: name: zext_i8_to_i64
232 ; CHECK: liveins: $edi
233 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
234 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
235 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
236 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
237 ; CHECK: $rax = COPY [[AND]](s64)
238 ; CHECK: RET 0, implicit $rax
239 %1:_(s32) = COPY $edi
240 %0:_(s8) = G_TRUNC %1(s32)
241 %2:_(s64) = G_ZEXT %0(s8)
247 name: zext_i16_to_i32
249 tracksRegLiveness: true
251 - { id: 0, class: _ }
252 - { id: 1, class: _ }
253 - { id: 2, class: _ }
258 ; CHECK-LABEL: name: zext_i16_to_i32
259 ; CHECK: liveins: $edi
260 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
261 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
262 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
263 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
264 ; CHECK: $eax = COPY [[AND]](s32)
265 ; CHECK: RET 0, implicit $eax
266 %1:_(s32) = COPY $edi
267 %0:_(s16) = G_TRUNC %1(s32)
268 %2:_(s32) = G_ZEXT %0(s16)
274 name: zext_i16_to_i64
276 tracksRegLiveness: true
278 - { id: 0, class: _ }
279 - { id: 1, class: _ }
280 - { id: 2, class: _ }
285 ; CHECK-LABEL: name: zext_i16_to_i64
286 ; CHECK: liveins: $edi
287 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
288 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
289 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
290 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
291 ; CHECK: $rax = COPY [[AND]](s64)
292 ; CHECK: RET 0, implicit $rax
293 %1:_(s32) = COPY $edi
294 %0:_(s16) = G_TRUNC %1(s32)
295 %2:_(s64) = G_ZEXT %0(s16)
301 name: zext_i32_to_i64
303 tracksRegLiveness: true
305 - { id: 0, class: _ }
306 - { id: 1, class: _ }
311 ; CHECK-LABEL: name: zext_i32_to_i64
312 ; CHECK: liveins: $edi
313 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
314 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
315 ; CHECK: $rax = COPY [[ZEXT]](s64)
316 ; CHECK: RET 0, implicit $rax
317 %0:_(s32) = COPY $edi
318 %1:_(s64) = G_ZEXT %0(s32)