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: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
128 ; CHECK: $eax = COPY [[AND]](s32)
129 ; CHECK: RET 0, implicit $eax
130 %1:_(s32) = COPY $edi
131 %0:_(s1) = G_TRUNC %1(s32)
132 %2:_(s32) = G_ZEXT %0(s1)
140 tracksRegLiveness: true
142 - { id: 0, class: _ }
143 - { id: 1, class: _ }
144 - { id: 2, class: _ }
149 ; CHECK-LABEL: name: zext_i1_to_i64
150 ; CHECK: liveins: $edi
151 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
152 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
153 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
154 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
155 ; CHECK: $rax = COPY [[AND]](s64)
156 ; CHECK: RET 0, implicit $rax
157 %1:_(s32) = COPY $edi
158 %0:_(s1) = G_TRUNC %1(s32)
159 %2:_(s64) = G_ZEXT %0(s1)
167 tracksRegLiveness: true
169 - { id: 0, class: _ }
170 - { id: 1, class: _ }
171 - { id: 2, class: _ }
176 ; CHECK-LABEL: name: zext_i8_to_i16
177 ; CHECK: liveins: $edi
178 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
179 ; CHECK: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 255
180 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
181 ; CHECK: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
182 ; CHECK: $ax = COPY [[AND]](s16)
183 ; CHECK: RET 0, implicit $ax
184 %1:_(s32) = COPY $edi
185 %0:_(s8) = G_TRUNC %1(s32)
186 %2:_(s16) = G_ZEXT %0(s8)
194 tracksRegLiveness: true
196 - { id: 0, class: _ }
197 - { id: 1, class: _ }
198 - { id: 2, class: _ }
203 ; CHECK-LABEL: name: zext_i8_to_i32
204 ; CHECK: liveins: $edi
205 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
206 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
207 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
208 ; CHECK: $eax = COPY [[AND]](s32)
209 ; CHECK: RET 0, implicit $eax
210 %1:_(s32) = COPY $edi
211 %0:_(s8) = G_TRUNC %1(s32)
212 %2:_(s32) = G_ZEXT %0(s8)
220 tracksRegLiveness: true
222 - { id: 0, class: _ }
223 - { id: 1, class: _ }
224 - { id: 2, class: _ }
229 ; CHECK-LABEL: name: zext_i8_to_i64
230 ; CHECK: liveins: $edi
231 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
232 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
233 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
234 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
235 ; CHECK: $rax = COPY [[AND]](s64)
236 ; CHECK: RET 0, implicit $rax
237 %1:_(s32) = COPY $edi
238 %0:_(s8) = G_TRUNC %1(s32)
239 %2:_(s64) = G_ZEXT %0(s8)
245 name: zext_i16_to_i32
247 tracksRegLiveness: true
249 - { id: 0, class: _ }
250 - { id: 1, class: _ }
251 - { id: 2, class: _ }
256 ; CHECK-LABEL: name: zext_i16_to_i32
257 ; CHECK: liveins: $edi
258 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
259 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
260 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
261 ; CHECK: $eax = COPY [[AND]](s32)
262 ; CHECK: RET 0, implicit $eax
263 %1:_(s32) = COPY $edi
264 %0:_(s16) = G_TRUNC %1(s32)
265 %2:_(s32) = G_ZEXT %0(s16)
271 name: zext_i16_to_i64
273 tracksRegLiveness: true
275 - { id: 0, class: _ }
276 - { id: 1, class: _ }
277 - { id: 2, class: _ }
282 ; CHECK-LABEL: name: zext_i16_to_i64
283 ; CHECK: liveins: $edi
284 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
285 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
286 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[COPY]](s32)
287 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
288 ; CHECK: $rax = COPY [[AND]](s64)
289 ; CHECK: RET 0, implicit $rax
290 %1:_(s32) = COPY $edi
291 %0:_(s16) = G_TRUNC %1(s32)
292 %2:_(s64) = G_ZEXT %0(s16)
298 name: zext_i32_to_i64
300 tracksRegLiveness: true
302 - { id: 0, class: _ }
303 - { id: 1, class: _ }
308 ; CHECK-LABEL: name: zext_i32_to_i64
309 ; CHECK: liveins: $edi
310 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
311 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY]](s32)
312 ; CHECK: $rax = COPY [[ZEXT]](s64)
313 ; CHECK: RET 0, implicit $rax
314 %0:_(s32) = COPY $edi
315 %1:_(s64) = G_ZEXT %0(s32)