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 --check-prefix=ALL
5 define i64 @test_shl_i64(i64 %arg1, i64 %arg2) {
6 %res = shl i64 %arg1, %arg2
10 define i64 @test_shl_i64_imm(i64 %arg1) {
11 %res = shl i64 %arg1, 5
15 define i64 @test_shl_i64_imm1(i64 %arg1) {
16 %res = shl i64 %arg1, 1
20 define i32 @test_shl_i32(i32 %arg1, i32 %arg2) {
21 %res = shl i32 %arg1, %arg2
25 define i32 @test_shl_i32_imm(i32 %arg1) {
26 %res = shl i32 %arg1, 5
30 define i32 @test_shl_i32_imm1(i32 %arg1) {
31 %res = shl i32 %arg1, 1
35 define i16 @test_shl_i16(i32 %arg1, i32 %arg2) {
36 %a = trunc i32 %arg1 to i16
37 %a2 = trunc i32 %arg2 to i16
38 %res = shl i16 %a, %a2
42 define i16 @test_shl_i16_imm(i32 %arg1) {
43 %a = trunc i32 %arg1 to i16
48 define i16 @test_shl_i16_imm1(i32 %arg1) {
49 %a = trunc i32 %arg1 to i16
54 define i8 @test_shl_i8(i32 %arg1, i32 %arg2) {
55 %a = trunc i32 %arg1 to i8
56 %a2 = trunc i32 %arg2 to i8
61 define i8 @test_shl_i8_imm(i32 %arg1) {
62 %a = trunc i32 %arg1 to i8
67 define i8 @test_shl_i8_imm1(i32 %arg1) {
68 %a = trunc i32 %arg1 to i8
79 tracksRegLiveness: true
81 - { id: 0, class: gpr, preferred-register: '' }
82 - { id: 1, class: gpr, preferred-register: '' }
83 - { id: 2, class: gpr, preferred-register: '' }
84 - { id: 3, class: gpr, preferred-register: '' }
93 ; ALL-LABEL: name: test_shl_i64
94 ; ALL: liveins: $rdi, $rsi
95 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
96 ; ALL: [[COPY1:%[0-9]+]]:gr64_with_sub_8bit = COPY $rsi
97 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
98 ; ALL: $cl = COPY [[COPY2]]
99 ; ALL: [[SHL64rCL:%[0-9]+]]:gr64 = SHL64rCL [[COPY]], implicit-def $eflags, implicit $cl
100 ; ALL: $rax = COPY [[SHL64rCL]]
101 ; ALL: RET 0, implicit $rax
105 %3(s64) = G_SHL %0, %2
111 name: test_shl_i64_imm
114 regBankSelected: true
115 tracksRegLiveness: true
117 - { id: 0, class: gpr, preferred-register: '' }
118 - { id: 1, class: gpr, preferred-register: '' }
119 - { id: 2, class: gpr, preferred-register: '' }
128 ; ALL-LABEL: name: test_shl_i64_imm
130 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
131 ; ALL: [[SHL64ri:%[0-9]+]]:gr64 = SHL64ri [[COPY]], 5, implicit-def $eflags
132 ; ALL: $rax = COPY [[SHL64ri]]
133 ; ALL: RET 0, implicit $rax
135 %1(s8) = G_CONSTANT i8 5
136 %2(s64) = G_SHL %0, %1
142 name: test_shl_i64_imm1
145 regBankSelected: true
146 tracksRegLiveness: true
148 - { id: 0, class: gpr, preferred-register: '' }
149 - { id: 1, class: gpr, preferred-register: '' }
150 - { id: 2, class: gpr, preferred-register: '' }
159 ; ALL-LABEL: name: test_shl_i64_imm1
161 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
162 ; ALL: [[ADD64rr:%[0-9]+]]:gr64 = ADD64rr [[COPY]], [[COPY]], implicit-def $eflags
163 ; ALL: $rax = COPY [[ADD64rr]]
164 ; ALL: RET 0, implicit $rax
166 %1(s8) = G_CONSTANT i8 1
167 %2(s64) = G_SHL %0, %1
176 regBankSelected: true
177 tracksRegLiveness: true
179 - { id: 0, class: gpr, preferred-register: '' }
180 - { id: 1, class: gpr, preferred-register: '' }
181 - { id: 2, class: gpr, preferred-register: '' }
182 - { id: 3, class: gpr, preferred-register: '' }
191 ; ALL-LABEL: name: test_shl_i32
192 ; ALL: liveins: $edi, $esi
193 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
194 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
195 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
196 ; ALL: $cl = COPY [[COPY2]]
197 ; ALL: [[SHL32rCL:%[0-9]+]]:gr32 = SHL32rCL [[COPY]], implicit-def $eflags, implicit $cl
198 ; ALL: $eax = COPY [[SHL32rCL]]
199 ; ALL: RET 0, implicit $eax
203 %3(s32) = G_SHL %0, %2
209 name: test_shl_i32_imm
212 regBankSelected: true
213 tracksRegLiveness: true
215 - { id: 0, class: gpr, preferred-register: '' }
216 - { id: 1, class: gpr, preferred-register: '' }
217 - { id: 2, class: gpr, preferred-register: '' }
226 ; ALL-LABEL: name: test_shl_i32_imm
228 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
229 ; ALL: [[SHL32ri:%[0-9]+]]:gr32 = SHL32ri [[COPY]], 5, implicit-def $eflags
230 ; ALL: $eax = COPY [[SHL32ri]]
231 ; ALL: RET 0, implicit $eax
233 %1(s8) = G_CONSTANT i8 5
234 %2(s32) = G_SHL %0, %1
240 name: test_shl_i32_imm1
243 regBankSelected: true
244 tracksRegLiveness: true
246 - { id: 0, class: gpr, preferred-register: '' }
247 - { id: 1, class: gpr, preferred-register: '' }
248 - { id: 2, class: gpr, preferred-register: '' }
257 ; ALL-LABEL: name: test_shl_i32_imm1
259 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
260 ; ALL: [[ADD32rr:%[0-9]+]]:gr32 = ADD32rr [[COPY]], [[COPY]], implicit-def $eflags
261 ; ALL: $eax = COPY [[ADD32rr]]
262 ; ALL: RET 0, implicit $eax
264 %1(s8) = G_CONSTANT i8 1
265 %2(s32) = G_SHL %0, %1
274 regBankSelected: true
275 tracksRegLiveness: true
277 - { id: 0, class: gpr, preferred-register: '' }
278 - { id: 1, class: gpr, preferred-register: '' }
279 - { id: 2, class: gpr, preferred-register: '' }
280 - { id: 3, class: gpr, preferred-register: '' }
281 - { id: 4, class: gpr, preferred-register: '' }
290 ; ALL-LABEL: name: test_shl_i16
291 ; ALL: liveins: $edi, $esi
292 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
293 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
294 ; ALL: [[COPY2:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
295 ; ALL: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
296 ; ALL: $cl = COPY [[COPY3]]
297 ; ALL: [[SHL16rCL:%[0-9]+]]:gr16 = SHL16rCL [[COPY2]], implicit-def $eflags, implicit $cl
298 ; ALL: $ax = COPY [[SHL16rCL]]
299 ; ALL: RET 0, implicit $ax
302 %2(s16) = G_TRUNC %0(s32)
303 %3(s8) = G_TRUNC %1(s32)
304 %4(s16) = G_SHL %2, %3
310 name: test_shl_i16_imm
313 regBankSelected: true
314 tracksRegLiveness: true
316 - { id: 0, class: gpr, preferred-register: '' }
317 - { id: 1, class: gpr, preferred-register: '' }
318 - { id: 2, class: gpr, preferred-register: '' }
319 - { id: 3, class: gpr, preferred-register: '' }
328 ; ALL-LABEL: name: test_shl_i16_imm
330 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
331 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
332 ; ALL: [[SHL16ri:%[0-9]+]]:gr16 = SHL16ri [[COPY1]], 5, implicit-def $eflags
333 ; ALL: $ax = COPY [[SHL16ri]]
334 ; ALL: RET 0, implicit $ax
336 %2(s8) = G_CONSTANT i8 5
337 %1(s16) = G_TRUNC %0(s32)
338 %3(s16) = G_SHL %1, %2
344 name: test_shl_i16_imm1
347 regBankSelected: true
348 tracksRegLiveness: true
350 - { id: 0, class: gpr, preferred-register: '' }
351 - { id: 1, class: gpr, preferred-register: '' }
352 - { id: 2, class: gpr, preferred-register: '' }
353 - { id: 3, class: gpr, preferred-register: '' }
362 ; ALL-LABEL: name: test_shl_i16_imm1
364 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
365 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
366 ; ALL: [[ADD16rr:%[0-9]+]]:gr16 = ADD16rr [[COPY1]], [[COPY1]], implicit-def $eflags
367 ; ALL: $ax = COPY [[ADD16rr]]
368 ; ALL: RET 0, implicit $ax
370 %2(s8) = G_CONSTANT i8 1
371 %1(s16) = G_TRUNC %0(s32)
372 %3(s16) = G_SHL %1, %2
381 regBankSelected: true
382 tracksRegLiveness: true
384 - { id: 0, class: gpr, preferred-register: '' }
385 - { id: 1, class: gpr, preferred-register: '' }
386 - { id: 2, class: gpr, preferred-register: '' }
387 - { id: 3, class: gpr, preferred-register: '' }
388 - { id: 4, class: gpr, preferred-register: '' }
397 ; ALL-LABEL: name: test_shl_i8
398 ; ALL: liveins: $edi, $esi
399 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
400 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
401 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
402 ; ALL: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
403 ; ALL: $cl = COPY [[COPY3]]
404 ; ALL: [[SHL8rCL:%[0-9]+]]:gr8 = SHL8rCL [[COPY2]], implicit-def $eflags, implicit $cl
405 ; ALL: $al = COPY [[SHL8rCL]]
406 ; ALL: RET 0, implicit $al
409 %2(s8) = G_TRUNC %0(s32)
410 %3(s8) = G_TRUNC %1(s32)
411 %4(s8) = G_SHL %2, %3
417 name: test_shl_i8_imm
420 regBankSelected: true
421 tracksRegLiveness: true
423 - { id: 0, class: gpr, preferred-register: '' }
424 - { id: 1, class: gpr, preferred-register: '' }
425 - { id: 2, class: gpr, preferred-register: '' }
426 - { id: 3, class: gpr, preferred-register: '' }
435 ; ALL-LABEL: name: test_shl_i8_imm
437 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
438 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
439 ; ALL: [[SHL8ri:%[0-9]+]]:gr8 = SHL8ri [[COPY1]], 5, implicit-def $eflags
440 ; ALL: $al = COPY [[SHL8ri]]
441 ; ALL: RET 0, implicit $al
443 %2(s8) = G_CONSTANT i8 5
444 %1(s8) = G_TRUNC %0(s32)
445 %3(s8) = G_SHL %1, %2
451 name: test_shl_i8_imm1
454 regBankSelected: true
455 tracksRegLiveness: true
457 - { id: 0, class: gpr, preferred-register: '' }
458 - { id: 1, class: gpr, preferred-register: '' }
459 - { id: 2, class: gpr, preferred-register: '' }
460 - { id: 3, class: gpr, preferred-register: '' }
469 ; ALL-LABEL: name: test_shl_i8_imm1
471 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
472 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
473 ; ALL: [[ADD8rr:%[0-9]+]]:gr8 = ADD8rr [[COPY1]], [[COPY1]], implicit-def $eflags
474 ; ALL: $al = COPY [[ADD8rr]]
475 ; ALL: RET 0, implicit $al
477 %2(s8) = G_CONSTANT i8 1
478 %1(s8) = G_TRUNC %0(s32)
479 %3(s8) = G_SHL %1, %2