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
96 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
97 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr64_with_sub_8bit = COPY $rsi
98 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
99 ; ALL-NEXT: $cl = COPY [[COPY2]]
100 ; ALL-NEXT: [[SHL64rCL:%[0-9]+]]:gr64 = SHL64rCL [[COPY]], implicit-def dead $eflags, implicit $cl
101 ; ALL-NEXT: $rax = COPY [[SHL64rCL]]
102 ; ALL-NEXT: RET 0, implicit $rax
106 %3(s64) = G_SHL %0, %2
112 name: test_shl_i64_imm
115 regBankSelected: true
116 tracksRegLiveness: true
118 - { id: 0, class: gpr, preferred-register: '' }
119 - { id: 1, class: gpr, preferred-register: '' }
120 - { id: 2, class: gpr, preferred-register: '' }
129 ; ALL-LABEL: name: test_shl_i64_imm
132 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
133 ; ALL-NEXT: [[SHL64ri:%[0-9]+]]:gr64 = SHL64ri [[COPY]], 5, implicit-def dead $eflags
134 ; ALL-NEXT: $rax = COPY [[SHL64ri]]
135 ; ALL-NEXT: RET 0, implicit $rax
137 %1(s8) = G_CONSTANT i8 5
138 %2(s64) = G_SHL %0, %1
144 name: test_shl_i64_imm1
147 regBankSelected: true
148 tracksRegLiveness: true
150 - { id: 0, class: gpr, preferred-register: '' }
151 - { id: 1, class: gpr, preferred-register: '' }
152 - { id: 2, class: gpr, preferred-register: '' }
161 ; ALL-LABEL: name: test_shl_i64_imm1
164 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
165 ; ALL-NEXT: [[ADD64rr:%[0-9]+]]:gr64 = ADD64rr [[COPY]], [[COPY]], implicit-def dead $eflags
166 ; ALL-NEXT: $rax = COPY [[ADD64rr]]
167 ; ALL-NEXT: RET 0, implicit $rax
169 %1(s8) = G_CONSTANT i8 1
170 %2(s64) = G_SHL %0, %1
179 regBankSelected: true
180 tracksRegLiveness: true
182 - { id: 0, class: gpr, preferred-register: '' }
183 - { id: 1, class: gpr, preferred-register: '' }
184 - { id: 2, class: gpr, preferred-register: '' }
185 - { id: 3, class: gpr, preferred-register: '' }
194 ; ALL-LABEL: name: test_shl_i32
195 ; ALL: liveins: $edi, $esi
197 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
198 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
199 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
200 ; ALL-NEXT: $cl = COPY [[COPY2]]
201 ; ALL-NEXT: [[SHL32rCL:%[0-9]+]]:gr32 = SHL32rCL [[COPY]], implicit-def dead $eflags, implicit $cl
202 ; ALL-NEXT: $eax = COPY [[SHL32rCL]]
203 ; ALL-NEXT: RET 0, implicit $eax
207 %3(s32) = G_SHL %0, %2
213 name: test_shl_i32_imm
216 regBankSelected: true
217 tracksRegLiveness: true
219 - { id: 0, class: gpr, preferred-register: '' }
220 - { id: 1, class: gpr, preferred-register: '' }
221 - { id: 2, class: gpr, preferred-register: '' }
230 ; ALL-LABEL: name: test_shl_i32_imm
233 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
234 ; ALL-NEXT: [[SHL32ri:%[0-9]+]]:gr32 = SHL32ri [[COPY]], 5, implicit-def dead $eflags
235 ; ALL-NEXT: $eax = COPY [[SHL32ri]]
236 ; ALL-NEXT: RET 0, implicit $eax
238 %1(s8) = G_CONSTANT i8 5
239 %2(s32) = G_SHL %0, %1
245 name: test_shl_i32_imm1
248 regBankSelected: true
249 tracksRegLiveness: true
251 - { id: 0, class: gpr, preferred-register: '' }
252 - { id: 1, class: gpr, preferred-register: '' }
253 - { id: 2, class: gpr, preferred-register: '' }
262 ; ALL-LABEL: name: test_shl_i32_imm1
265 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
266 ; ALL-NEXT: [[ADD32rr:%[0-9]+]]:gr32 = ADD32rr [[COPY]], [[COPY]], implicit-def dead $eflags
267 ; ALL-NEXT: $eax = COPY [[ADD32rr]]
268 ; ALL-NEXT: RET 0, implicit $eax
270 %1(s8) = G_CONSTANT i8 1
271 %2(s32) = G_SHL %0, %1
280 regBankSelected: true
281 tracksRegLiveness: true
283 - { id: 0, class: gpr, preferred-register: '' }
284 - { id: 1, class: gpr, preferred-register: '' }
285 - { id: 2, class: gpr, preferred-register: '' }
286 - { id: 3, class: gpr, preferred-register: '' }
287 - { id: 4, class: gpr, preferred-register: '' }
296 ; ALL-LABEL: name: test_shl_i16
297 ; ALL: liveins: $edi, $esi
299 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
300 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
301 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
302 ; ALL-NEXT: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
303 ; ALL-NEXT: $cl = COPY [[COPY3]]
304 ; ALL-NEXT: [[SHL16rCL:%[0-9]+]]:gr16 = SHL16rCL [[COPY2]], implicit-def dead $eflags, implicit $cl
305 ; ALL-NEXT: $ax = COPY [[SHL16rCL]]
306 ; ALL-NEXT: RET 0, implicit $ax
309 %2(s16) = G_TRUNC %0(s32)
310 %3(s8) = G_TRUNC %1(s32)
311 %4(s16) = G_SHL %2, %3
317 name: test_shl_i16_imm
320 regBankSelected: true
321 tracksRegLiveness: true
323 - { id: 0, class: gpr, preferred-register: '' }
324 - { id: 1, class: gpr, preferred-register: '' }
325 - { id: 2, class: gpr, preferred-register: '' }
326 - { id: 3, class: gpr, preferred-register: '' }
335 ; ALL-LABEL: name: test_shl_i16_imm
338 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
339 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
340 ; ALL-NEXT: [[SHL16ri:%[0-9]+]]:gr16 = SHL16ri [[COPY1]], 5, implicit-def dead $eflags
341 ; ALL-NEXT: $ax = COPY [[SHL16ri]]
342 ; ALL-NEXT: RET 0, implicit $ax
344 %2(s8) = G_CONSTANT i8 5
345 %1(s16) = G_TRUNC %0(s32)
346 %3(s16) = G_SHL %1, %2
352 name: test_shl_i16_imm1
355 regBankSelected: true
356 tracksRegLiveness: true
358 - { id: 0, class: gpr, preferred-register: '' }
359 - { id: 1, class: gpr, preferred-register: '' }
360 - { id: 2, class: gpr, preferred-register: '' }
361 - { id: 3, class: gpr, preferred-register: '' }
370 ; ALL-LABEL: name: test_shl_i16_imm1
373 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
374 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
375 ; ALL-NEXT: [[ADD16rr:%[0-9]+]]:gr16 = ADD16rr [[COPY1]], [[COPY1]], implicit-def dead $eflags
376 ; ALL-NEXT: $ax = COPY [[ADD16rr]]
377 ; ALL-NEXT: RET 0, implicit $ax
379 %2(s8) = G_CONSTANT i8 1
380 %1(s16) = G_TRUNC %0(s32)
381 %3(s16) = G_SHL %1, %2
390 regBankSelected: true
391 tracksRegLiveness: true
393 - { id: 0, class: gpr, preferred-register: '' }
394 - { id: 1, class: gpr, preferred-register: '' }
395 - { id: 2, class: gpr, preferred-register: '' }
396 - { id: 3, class: gpr, preferred-register: '' }
397 - { id: 4, class: gpr, preferred-register: '' }
406 ; ALL-LABEL: name: test_shl_i8
407 ; ALL: liveins: $edi, $esi
409 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
410 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
411 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
412 ; ALL-NEXT: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
413 ; ALL-NEXT: $cl = COPY [[COPY3]]
414 ; ALL-NEXT: [[SHL8rCL:%[0-9]+]]:gr8 = SHL8rCL [[COPY2]], implicit-def dead $eflags, implicit $cl
415 ; ALL-NEXT: $al = COPY [[SHL8rCL]]
416 ; ALL-NEXT: RET 0, implicit $al
419 %2(s8) = G_TRUNC %0(s32)
420 %3(s8) = G_TRUNC %1(s32)
421 %4(s8) = G_SHL %2, %3
427 name: test_shl_i8_imm
430 regBankSelected: true
431 tracksRegLiveness: true
433 - { id: 0, class: gpr, preferred-register: '' }
434 - { id: 1, class: gpr, preferred-register: '' }
435 - { id: 2, class: gpr, preferred-register: '' }
436 - { id: 3, class: gpr, preferred-register: '' }
445 ; ALL-LABEL: name: test_shl_i8_imm
448 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
449 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
450 ; ALL-NEXT: [[SHL8ri:%[0-9]+]]:gr8 = SHL8ri [[COPY1]], 5, implicit-def dead $eflags
451 ; ALL-NEXT: $al = COPY [[SHL8ri]]
452 ; ALL-NEXT: RET 0, implicit $al
454 %2(s8) = G_CONSTANT i8 5
455 %1(s8) = G_TRUNC %0(s32)
456 %3(s8) = G_SHL %1, %2
462 name: test_shl_i8_imm1
465 regBankSelected: true
466 tracksRegLiveness: true
468 - { id: 0, class: gpr, preferred-register: '' }
469 - { id: 1, class: gpr, preferred-register: '' }
470 - { id: 2, class: gpr, preferred-register: '' }
471 - { id: 3, class: gpr, preferred-register: '' }
480 ; ALL-LABEL: name: test_shl_i8_imm1
483 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
484 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
485 ; ALL-NEXT: [[ADD8rr:%[0-9]+]]:gr8 = ADD8rr [[COPY1]], [[COPY1]], implicit-def dead $eflags
486 ; ALL-NEXT: $al = COPY [[ADD8rr]]
487 ; ALL-NEXT: RET 0, implicit $al
489 %2(s8) = G_CONSTANT i8 1
490 %1(s8) = G_TRUNC %0(s32)
491 %3(s8) = G_SHL %1, %2