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: shrq $5, %rax
22 %res = lshr i64 %arg1, 5
26 define i64 @test_lshr_i64_imm1(i64 %arg1) {
27 ; X64-LABEL: test_lshr_i64_imm1:
29 ; X64-NEXT: movq %rdi, %rax
32 %res = lshr i64 %arg1, 1
36 define i32 @test_lshr_i32(i32 %arg1, i32 %arg2) {
37 ; X64-LABEL: test_lshr_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: shrl %cl, %eax
44 %res = lshr i32 %arg1, %arg2
48 define i32 @test_lshr_i32_imm(i32 %arg1) {
49 ; X64-LABEL: test_lshr_i32_imm:
51 ; X64-NEXT: movl %edi, %eax
52 ; X64-NEXT: shrl $5, %eax
54 %res = lshr i32 %arg1, 5
58 define i32 @test_lshr_i32_imm1(i32 %arg1) {
59 ; X64-LABEL: test_lshr_i32_imm1:
61 ; X64-NEXT: movl %edi, %eax
64 %res = lshr i32 %arg1, 1
68 define i16 @test_lshr_i16(i32 %arg1, i32 %arg2) {
69 ; X64-LABEL: test_lshr_i16:
71 ; X64-NEXT: movl %edi, %eax
72 ; X64-NEXT: movl %esi, %ecx
73 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
74 ; X64-NEXT: shrw %cl, %ax
75 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
77 %a = trunc i32 %arg1 to i16
78 %a2 = trunc i32 %arg2 to i16
79 %res = lshr i16 %a, %a2
83 define i16 @test_lshr_i16_imm(i32 %arg1) {
84 ; X64-LABEL: test_lshr_i16_imm:
86 ; X64-NEXT: movl %edi, %eax
87 ; X64-NEXT: shrw $5, %ax
88 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
90 %a = trunc i32 %arg1 to i16
95 define i16 @test_lshr_i16_imm1(i32 %arg1) {
96 ; X64-LABEL: test_lshr_i16_imm1:
98 ; X64-NEXT: movl %edi, %eax
100 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
102 %a = trunc i32 %arg1 to i16
103 %res = lshr i16 %a, 1
107 define i8 @test_lshr_i8(i32 %arg1, i32 %arg2) {
108 ; X64-LABEL: test_lshr_i8:
110 ; X64-NEXT: movl %edi, %eax
111 ; X64-NEXT: movl %esi, %ecx
112 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
113 ; X64-NEXT: shrb %cl, %al
114 ; X64-NEXT: # kill: def $al killed $al killed $eax
116 %a = trunc i32 %arg1 to i8
117 %a2 = trunc i32 %arg2 to i8
118 %res = lshr i8 %a, %a2
122 define i8 @test_lshr_i8_imm(i32 %arg1) {
123 ; X64-LABEL: test_lshr_i8_imm:
125 ; X64-NEXT: movl %edi, %eax
126 ; X64-NEXT: shrb $5, %al
127 ; X64-NEXT: # kill: def $al killed $al killed $eax
129 %a = trunc i32 %arg1 to i8
134 define i8 @test_lshr_i8_imm1(i32 %arg1) {
135 ; X64-LABEL: test_lshr_i8_imm1:
137 ; X64-NEXT: movl %edi, %eax
139 ; X64-NEXT: # kill: def $al killed $al killed $eax
141 %a = trunc i32 %arg1 to i8
146 define i1 @test_lshr_i1(i32 %arg1, i32 %arg2) {
147 ; X64-LABEL: test_lshr_i1:
149 ; X64-NEXT: movl %edi, %eax
150 ; X64-NEXT: movl %esi, %ecx
151 ; X64-NEXT: andb $1, %al
152 ; X64-NEXT: andb $1, %cl
153 ; X64-NEXT: # kill: def $cl killed $cl killed $ecx
154 ; X64-NEXT: shrb %cl, %al
155 ; X64-NEXT: # kill: def $al killed $al killed $eax
157 %a = trunc i32 %arg1 to i1
158 %a2 = trunc i32 %arg2 to i1
159 %res = lshr i1 %a, %a2
163 define i1 @test_lshr_i1_imm1(i32 %arg1) {
164 ; X64-LABEL: test_lshr_i1_imm1:
166 ; X64-NEXT: movl %edi, %eax
167 ; X64-NEXT: andb $1, %al
168 ; X64-NEXT: movb $1, %cl
169 ; X64-NEXT: shrb %cl, %al
170 ; X64-NEXT: # kill: def $al killed $al killed $eax
172 %a = trunc i32 %arg1 to i1