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
72 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
73 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
74 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
75 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
76 ; CHECK-NEXT: $al = COPY [[AND]](s8)
77 ; CHECK-NEXT: RET 0, implicit $al
79 %0:_(s1) = G_TRUNC %1(s32)
80 %2:_(s8) = G_ZEXT %0(s1)
88 tracksRegLiveness: true
97 ; CHECK-LABEL: name: zext_i1_to_i16
98 ; CHECK: liveins: $edi
100 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
101 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
102 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
103 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
104 ; CHECK-NEXT: $ax = COPY [[AND]](s16)
105 ; CHECK-NEXT: RET 0, implicit $ax
106 %1:_(s32) = COPY $edi
107 %0:_(s1) = G_TRUNC %1(s32)
108 %2:_(s16) = G_ZEXT %0(s1)
116 tracksRegLiveness: true
118 - { id: 0, class: _ }
119 - { id: 1, class: _ }
120 - { id: 2, class: _ }
125 ; CHECK-LABEL: name: zext_i1_to_i32
126 ; CHECK: liveins: $edi
128 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
129 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
130 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
131 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
132 ; CHECK-NEXT: RET 0, implicit $eax
133 %1:_(s32) = COPY $edi
134 %0:_(s1) = G_TRUNC %1(s32)
135 %2:_(s32) = G_ZEXT %0(s1)
143 tracksRegLiveness: true
145 - { id: 0, class: _ }
146 - { id: 1, class: _ }
147 - { id: 2, class: _ }
152 ; CHECK-LABEL: name: zext_i1_to_i64
153 ; CHECK: liveins: $edi
155 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
156 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
157 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
158 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
159 ; CHECK-NEXT: $rax = COPY [[AND]](s64)
160 ; CHECK-NEXT: RET 0, implicit $rax
161 %1:_(s32) = COPY $edi
162 %0:_(s1) = G_TRUNC %1(s32)
163 %2:_(s64) = G_ZEXT %0(s1)
171 tracksRegLiveness: true
173 - { id: 0, class: _ }
174 - { id: 1, class: _ }
175 - { id: 2, class: _ }
180 ; CHECK-LABEL: name: zext_i8_to_i16
181 ; CHECK: liveins: $edi
183 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
184 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
185 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
186 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
187 ; CHECK-NEXT: $ax = COPY [[AND]](s16)
188 ; CHECK-NEXT: RET 0, implicit $ax
189 %1:_(s32) = COPY $edi
190 %0:_(s8) = G_TRUNC %1(s32)
191 %2:_(s16) = G_ZEXT %0(s8)
199 tracksRegLiveness: true
201 - { id: 0, class: _ }
202 - { id: 1, class: _ }
203 - { id: 2, class: _ }
208 ; CHECK-LABEL: name: zext_i8_to_i32
209 ; CHECK: liveins: $edi
211 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
212 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
213 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
214 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
215 ; CHECK-NEXT: RET 0, implicit $eax
216 %1:_(s32) = COPY $edi
217 %0:_(s8) = G_TRUNC %1(s32)
218 %2:_(s32) = G_ZEXT %0(s8)
226 tracksRegLiveness: true
228 - { id: 0, class: _ }
229 - { id: 1, class: _ }
230 - { id: 2, class: _ }
235 ; CHECK-LABEL: name: zext_i8_to_i64
236 ; CHECK: liveins: $edi
238 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
239 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
240 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
241 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
242 ; CHECK-NEXT: $rax = COPY [[AND]](s64)
243 ; CHECK-NEXT: RET 0, implicit $rax
244 %1:_(s32) = COPY $edi
245 %0:_(s8) = G_TRUNC %1(s32)
246 %2:_(s64) = G_ZEXT %0(s8)
252 name: zext_i16_to_i32
254 tracksRegLiveness: true
256 - { id: 0, class: _ }
257 - { id: 1, class: _ }
258 - { id: 2, class: _ }
263 ; CHECK-LABEL: name: zext_i16_to_i32
264 ; CHECK: liveins: $edi
266 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
267 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
268 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
269 ; CHECK-NEXT: $eax = COPY [[AND]](s32)
270 ; CHECK-NEXT: RET 0, implicit $eax
271 %1:_(s32) = COPY $edi
272 %0:_(s16) = G_TRUNC %1(s32)
273 %2:_(s32) = G_ZEXT %0(s16)
279 name: zext_i16_to_i64
281 tracksRegLiveness: true
283 - { id: 0, class: _ }
284 - { id: 1, class: _ }
285 - { id: 2, class: _ }
290 ; CHECK-LABEL: name: zext_i16_to_i64
291 ; CHECK: liveins: $edi
293 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
294 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
295 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
296 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
297 ; CHECK-NEXT: $rax = COPY [[AND]](s64)
298 ; CHECK-NEXT: RET 0, implicit $rax
299 %1:_(s32) = COPY $edi
300 %0:_(s16) = G_TRUNC %1(s32)
301 %2:_(s64) = G_ZEXT %0(s16)
307 name: zext_i32_to_i64
309 tracksRegLiveness: true
311 - { id: 0, class: _ }
312 - { id: 1, class: _ }
317 ; CHECK-LABEL: name: zext_i32_to_i64
318 ; CHECK: liveins: $edi
320 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
321 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
322 ; CHECK-NEXT: $rax = COPY [[ZEXT]](s64)
323 ; CHECK-NEXT: RET 0, implicit $rax
324 %0:_(s32) = COPY $edi
325 %1:_(s64) = G_ZEXT %0(s32)