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 i64 @test_shl_i64(i64 %arg1, i64 %arg2) {
5 ; X64-LABEL: test_shl_i64:
7 ; X64-NEXT: movq %rdi, %rax
8 ; X64-NEXT: movq %rsi, %rcx
9 ; X64-NEXT: # kill: def $cl killed $cl killed $rcx
10 ; X64-NEXT: shlq %cl, %rax
12 %res = shl i64 %arg1, %arg2
16 define i64 @test_shl_i64_imm(i64 %arg1) {
17 ; X64-LABEL: test_shl_i64_imm:
19 ; X64-NEXT: movq %rdi, %rax
20 ; X64-NEXT: movq $5, %rcx
21 ; X64-NEXT: shlq %cl, %rax
23 %res = shl i64 %arg1, 5
27 define i64 @test_shl_i64_imm1(i64 %arg1) {
28 ; X64-LABEL: test_shl_i64_imm1:
30 ; X64-NEXT: leaq (%rdi,%rdi), %rax
32 %res = shl i64 %arg1, 1
36 define i32 @test_shl_i32(i32 %arg1, i32 %arg2) {
37 ; X64-LABEL: test_shl_i32:
39 ; X64-NEXT: movl %edi, %eax
40 ; X64-NEXT: movl %esi, %ecx
41 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
42 ; X64-NEXT: shll %cl, %eax
44 %res = shl i32 %arg1, %arg2
48 define i32 @test_shl_i32_imm(i32 %arg1) {
49 ; X64-LABEL: test_shl_i32_imm:
51 ; X64-NEXT: movl %edi, %eax
52 ; X64-NEXT: movl $5, %ecx
53 ; X64-NEXT: shll %cl, %eax
55 %res = shl i32 %arg1, 5
59 define i32 @test_shl_i32_imm1(i32 %arg1) {
60 ; X64-LABEL: test_shl_i32_imm1:
62 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
63 ; X64-NEXT: leal (%rdi,%rdi), %eax
65 %res = shl i32 %arg1, 1
69 define i16 @test_shl_i16(i32 %arg1, i32 %arg2) {
70 ; X64-LABEL: test_shl_i16:
72 ; X64-NEXT: movl %edi, %eax
73 ; X64-NEXT: movl %esi, %ecx
74 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
75 ; X64-NEXT: shlw %cl, %ax
76 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
78 %a = trunc i32 %arg1 to i16
79 %a2 = trunc i32 %arg2 to i16
80 %res = shl i16 %a, %a2
84 define i16 @test_shl_i16_imm(i32 %arg1) {
85 ; X64-LABEL: test_shl_i16_imm:
87 ; X64-NEXT: movl %edi, %eax
88 ; X64-NEXT: movw $5, %cx
89 ; X64-NEXT: shlw %cl, %ax
90 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
92 %a = trunc i32 %arg1 to i16
97 define i16 @test_shl_i16_imm1(i32 %arg1) {
98 ; X64-LABEL: test_shl_i16_imm1:
100 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
101 ; X64-NEXT: leal (%rdi,%rdi), %eax
102 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
104 %a = trunc i32 %arg1 to i16
109 define i8 @test_shl_i8(i32 %arg1, i32 %arg2) {
110 ; X64-LABEL: test_shl_i8:
112 ; X64-NEXT: movl %edi, %eax
113 ; X64-NEXT: movl %esi, %ecx
114 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
115 ; X64-NEXT: shlb %cl, %al
116 ; X64-NEXT: # kill: def $al killed $al killed $eax
118 %a = trunc i32 %arg1 to i8
119 %a2 = trunc i32 %arg2 to i8
120 %res = shl i8 %a, %a2
124 define i8 @test_shl_i8_imm(i32 %arg1) {
125 ; X64-LABEL: test_shl_i8_imm:
127 ; X64-NEXT: movl %edi, %eax
128 ; X64-NEXT: shlb $5, %al
129 ; X64-NEXT: # kill: def $al killed $al killed $eax
131 %a = trunc i32 %arg1 to i8
136 define i8 @test_shl_i8_imm1(i32 %arg1) {
137 ; X64-LABEL: test_shl_i8_imm1:
139 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
140 ; X64-NEXT: leal (%rdi,%rdi), %eax
141 ; X64-NEXT: # kill: def $al killed $al killed $eax
143 %a = trunc i32 %arg1 to i8
148 define i1 @test_shl_i1(i32 %arg1, i32 %arg2) {
149 ; X64-LABEL: test_shl_i1:
151 ; X64-NEXT: movl %edi, %eax
152 ; X64-NEXT: movl %esi, %ecx
153 ; X64-NEXT: andb $1, %cl
154 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
155 ; X64-NEXT: shlb %cl, %al
156 ; X64-NEXT: # kill: def $al killed $al killed $eax
158 %a = trunc i32 %arg1 to i1
159 %a2 = trunc i32 %arg2 to i1
160 %res = shl i1 %a, %a2
164 define i1 @test_shl_i1_imm1(i32 %arg1) {
165 ; X64-LABEL: test_shl_i1_imm1:
167 ; X64-NEXT: movl %edi, %eax
168 ; X64-NEXT: movb $-1, %cl
169 ; X64-NEXT: andb $1, %cl
170 ; X64-NEXT: shlb %cl, %al
171 ; X64-NEXT: # kill: def $al killed $al killed $eax
173 %a = trunc i32 %arg1 to i1