1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=X64
4 define i16 @test_shl_i4(i16 %v, i16 %a, i16 %b) {
5 ; Let's say the arguments are the following unsigned
6 ; integers in two’s complement representation:
8 ; %v: 77 (0000 0000 0100 1101)
9 ; %a: 74 (0000 0000 0100 1010)
10 ; %b: 72 (0000 0000 0100 1000)
11 ; X64-LABEL: test_shl_i4:
13 ; X64-NEXT: movl %edi, %eax
14 ; X64-NEXT: # kill: def $esi killed $esi def $rsi
15 ; X64-NEXT: # kill: def $edx killed $edx def $rdx
16 ; X64-NEXT: leal (%rdx,%rsi), %ecx
17 ; X64-NEXT: andb $15, %cl
18 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
19 ; X64-NEXT: shlb %cl, %al
20 ; X64-NEXT: andw $15, %ax
21 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
23 %v.t = trunc i16 %v to i4 ; %v.t: 13 (1101)
24 %a.t = trunc i16 %a to i4 ; %a.t: 10 (1010)
25 %b.t = trunc i16 %b to i4 ; %b.t: 8 (1000)
26 %n.t = add i4 %a.t, %b.t ; %n.t: 2 (0010)
27 %r.t = shl i4 %v.t, %n.t ; %r.t: 4 (0100)
28 %r = zext i4 %r.t to i16
29 ; %r: 4 (0000 0000 0000 0100)
32 ; %di: 77 (0000 0000 0100 1101)
33 ; %si: 74 (0000 0000 0100 1010)
34 ; %dx: 72 (0000 0000 0100 1000)
35 ; %dx: 146 (0000 0000 1001 0010)
36 ; %dx: 2 (0000 0000 0000 0010)
37 ; %cx: 2 (0000 0000 0000 0010)
38 ; %di: 52 (0000 0000 0011 0100)
39 ; %di: 4 (0000 0000 0000 0100)
40 ; %ax: 4 (0000 0000 0000 0100)
41 ; Let's pretend that legalizing G_SHL by widening its second
42 ; source operand is done via G_ANYEXT rather than G_ZEXT and
45 ; %dx: 146 (0000 0000 1001 0010)
47 ; %cx: 146 (0000 0000 1001 0010)
49 ; %di: 0 (0000 0000 0000 0000)
51 ; %di: 0 (0000 0000 0000 0000)
53 ; %ax: 0 (0000 0000 0000 0000)