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_lshr_i64(i64 %arg1, i64 %arg2) {
5 ; X64-LABEL: test_lshr_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: shrq %cl, %rax
12 %res = lshr i64 %arg1, %arg2
16 define i64 @test_lshr_i64_imm(i64 %arg1) {
17 ; X64-LABEL: test_lshr_i64_imm:
19 ; X64-NEXT: movq %rdi, %rax
20 ; X64-NEXT: movq $5, %rcx
21 ; X64-NEXT: shrq %cl, %rax
23 %res = lshr i64 %arg1, 5
27 define i64 @test_lshr_i64_imm1(i64 %arg1) {
28 ; X64-LABEL: test_lshr_i64_imm1:
30 ; X64-NEXT: movq %rdi, %rax
33 %res = lshr i64 %arg1, 1
37 define i32 @test_lshr_i32(i32 %arg1, i32 %arg2) {
38 ; X64-LABEL: test_lshr_i32:
40 ; X64-NEXT: movl %edi, %eax
41 ; X64-NEXT: movl %esi, %ecx
42 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
43 ; X64-NEXT: shrl %cl, %eax
45 %res = lshr i32 %arg1, %arg2
49 define i32 @test_lshr_i32_imm(i32 %arg1) {
50 ; X64-LABEL: test_lshr_i32_imm:
52 ; X64-NEXT: movl %edi, %eax
53 ; X64-NEXT: movl $5, %ecx
54 ; X64-NEXT: shrl %cl, %eax
56 %res = lshr i32 %arg1, 5
60 define i32 @test_lshr_i32_imm1(i32 %arg1) {
61 ; X64-LABEL: test_lshr_i32_imm1:
63 ; X64-NEXT: movl %edi, %eax
66 %res = lshr i32 %arg1, 1
70 define i16 @test_lshr_i16(i32 %arg1, i32 %arg2) {
71 ; X64-LABEL: test_lshr_i16:
73 ; X64-NEXT: movl %edi, %eax
74 ; X64-NEXT: movl %esi, %ecx
75 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
76 ; X64-NEXT: shrw %cl, %ax
77 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
79 %a = trunc i32 %arg1 to i16
80 %a2 = trunc i32 %arg2 to i16
81 %res = lshr i16 %a, %a2
85 define i16 @test_lshr_i16_imm(i32 %arg1) {
86 ; X64-LABEL: test_lshr_i16_imm:
88 ; X64-NEXT: movl %edi, %eax
89 ; X64-NEXT: movw $5, %cx
90 ; X64-NEXT: shrw %cl, %ax
91 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
93 %a = trunc i32 %arg1 to i16
98 define i16 @test_lshr_i16_imm1(i32 %arg1) {
99 ; X64-LABEL: test_lshr_i16_imm1:
101 ; X64-NEXT: movl %edi, %eax
103 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
105 %a = trunc i32 %arg1 to i16
106 %res = lshr i16 %a, 1
110 define i8 @test_lshr_i8(i32 %arg1, i32 %arg2) {
111 ; X64-LABEL: test_lshr_i8:
113 ; X64-NEXT: movl %edi, %eax
114 ; X64-NEXT: movl %esi, %ecx
115 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
116 ; X64-NEXT: shrb %cl, %al
117 ; X64-NEXT: # kill: def $al killed $al killed $eax
119 %a = trunc i32 %arg1 to i8
120 %a2 = trunc i32 %arg2 to i8
121 %res = lshr i8 %a, %a2
125 define i8 @test_lshr_i8_imm(i32 %arg1) {
126 ; X64-LABEL: test_lshr_i8_imm:
128 ; X64-NEXT: movl %edi, %eax
129 ; X64-NEXT: shrb $5, %al
130 ; X64-NEXT: # kill: def $al killed $al killed $eax
132 %a = trunc i32 %arg1 to i8
137 define i8 @test_lshr_i8_imm1(i32 %arg1) {
138 ; X64-LABEL: test_lshr_i8_imm1:
140 ; X64-NEXT: movl %edi, %eax
142 ; X64-NEXT: # kill: def $al killed $al killed $eax
144 %a = trunc i32 %arg1 to i8
149 define i1 @test_lshr_i1(i32 %arg1, i32 %arg2) {
150 ; X64-LABEL: test_lshr_i1:
152 ; X64-NEXT: movl %edi, %eax
153 ; X64-NEXT: movl %esi, %ecx
154 ; X64-NEXT: andb $1, %al
155 ; X64-NEXT: andb $1, %cl
156 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
157 ; X64-NEXT: shrb %cl, %al
158 ; X64-NEXT: # kill: def $al killed $al killed $eax
160 %a = trunc i32 %arg1 to i1
161 %a2 = trunc i32 %arg2 to i1
162 %res = lshr i1 %a, %a2
166 define i1 @test_lshr_i1_imm1(i32 %arg1) {
167 ; X64-LABEL: test_lshr_i1_imm1:
169 ; X64-NEXT: movl %edi, %eax
170 ; X64-NEXT: movb $-1, %cl
171 ; X64-NEXT: andb $1, %al
172 ; X64-NEXT: andb $1, %cl
173 ; X64-NEXT: shrb %cl, %al
174 ; X64-NEXT: # kill: def $al killed $al killed $eax
176 %a = trunc i32 %arg1 to i1