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: movq %rdi, %rax
31 ; X64-NEXT: movq $1, %rcx
32 ; X64-NEXT: shlq %cl, %rax
34 %res = shl i64 %arg1, 1
38 define i32 @test_shl_i32(i32 %arg1, i32 %arg2) {
39 ; X64-LABEL: test_shl_i32:
41 ; X64-NEXT: movl %edi, %eax
42 ; X64-NEXT: movl %esi, %ecx
43 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
44 ; X64-NEXT: shll %cl, %eax
46 %res = shl i32 %arg1, %arg2
50 define i32 @test_shl_i32_imm(i32 %arg1) {
51 ; X64-LABEL: test_shl_i32_imm:
53 ; X64-NEXT: movl %edi, %eax
54 ; X64-NEXT: movl $5, %ecx
55 ; X64-NEXT: shll %cl, %eax
57 %res = shl i32 %arg1, 5
61 define i32 @test_shl_i32_imm1(i32 %arg1) {
62 ; X64-LABEL: test_shl_i32_imm1:
64 ; X64-NEXT: movl %edi, %eax
65 ; X64-NEXT: movl $1, %ecx
66 ; X64-NEXT: shll %cl, %eax
68 %res = shl i32 %arg1, 1
72 define i16 @test_shl_i16(i32 %arg1, i32 %arg2) {
73 ; X64-LABEL: test_shl_i16:
75 ; X64-NEXT: movl %edi, %eax
76 ; X64-NEXT: movl %esi, %ecx
77 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
78 ; X64-NEXT: shlw %cl, %ax
79 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
81 %a = trunc i32 %arg1 to i16
82 %a2 = trunc i32 %arg2 to i16
83 %res = shl i16 %a, %a2
87 define i16 @test_shl_i16_imm(i32 %arg1) {
88 ; X64-LABEL: test_shl_i16_imm:
90 ; X64-NEXT: movl %edi, %eax
91 ; X64-NEXT: movw $5, %cx
92 ; X64-NEXT: shlw %cl, %ax
93 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
95 %a = trunc i32 %arg1 to i16
100 define i16 @test_shl_i16_imm1(i32 %arg1) {
101 ; X64-LABEL: test_shl_i16_imm1:
103 ; X64-NEXT: movl %edi, %eax
104 ; X64-NEXT: movw $1, %cx
105 ; X64-NEXT: shlw %cl, %ax
106 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
108 %a = trunc i32 %arg1 to i16
113 define i8 @test_shl_i8(i32 %arg1, i32 %arg2) {
114 ; X64-LABEL: test_shl_i8:
116 ; X64-NEXT: movl %edi, %eax
117 ; X64-NEXT: movl %esi, %ecx
118 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
119 ; X64-NEXT: shlb %cl, %al
120 ; X64-NEXT: # kill: def $al killed $al killed $eax
122 %a = trunc i32 %arg1 to i8
123 %a2 = trunc i32 %arg2 to i8
124 %res = shl i8 %a, %a2
128 define i8 @test_shl_i8_imm(i32 %arg1) {
129 ; X64-LABEL: test_shl_i8_imm:
131 ; X64-NEXT: movl %edi, %eax
132 ; X64-NEXT: shlb $5, %al
133 ; X64-NEXT: # kill: def $al killed $al killed $eax
135 %a = trunc i32 %arg1 to i8
140 define i8 @test_shl_i8_imm1(i32 %arg1) {
141 ; X64-LABEL: test_shl_i8_imm1:
143 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
144 ; X64-NEXT: leal (%rdi,%rdi), %eax
145 ; X64-NEXT: # kill: def $al killed $al killed $eax
147 %a = trunc i32 %arg1 to i8
152 define i1 @test_shl_i1(i32 %arg1, i32 %arg2) {
153 ; X64-LABEL: test_shl_i1:
155 ; X64-NEXT: movl %edi, %eax
156 ; X64-NEXT: movl %esi, %ecx
157 ; X64-NEXT: andb $1, %cl
158 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
159 ; X64-NEXT: shlb %cl, %al
160 ; X64-NEXT: # kill: def $al killed $al killed $eax
162 %a = trunc i32 %arg1 to i1
163 %a2 = trunc i32 %arg2 to i1
164 %res = shl i1 %a, %a2
168 define i1 @test_shl_i1_imm1(i32 %arg1) {
169 ; X64-LABEL: test_shl_i1_imm1:
171 ; X64-NEXT: movl %edi, %eax
172 ; X64-NEXT: movb $-1, %cl
173 ; X64-NEXT: andb $1, %cl
174 ; X64-NEXT: shlb %cl, %al
175 ; X64-NEXT: # kill: def $al killed $al killed $eax
177 %a = trunc i32 %arg1 to i1