1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL
5 define i64 @test_lshr_i64(i64 %arg1, i64 %arg2) {
6 %res = lshr i64 %arg1, %arg2
10 define i64 @test_lshr_i64_imm(i64 %arg1) {
11 %res = lshr i64 %arg1, 5
15 define i32 @test_lshr_i32(i32 %arg1, i32 %arg2) {
16 %res = lshr i32 %arg1, %arg2
20 define i32 @test_lshr_i32_imm(i32 %arg1) {
21 %res = lshr i32 %arg1, 5
25 define i16 @test_lshr_i16(i32 %arg1, i32 %arg2) {
26 %a = trunc i32 %arg1 to i16
27 %a2 = trunc i32 %arg2 to i16
28 %res = lshr i16 %a, %a2
32 define i16 @test_lshr_i16_imm(i32 %arg1) {
33 %a = trunc i32 %arg1 to i16
38 define i8 @test_lshr_i8(i32 %arg1, i32 %arg2) {
39 %a = trunc i32 %arg1 to i8
40 %a2 = trunc i32 %arg2 to i8
41 %res = lshr i8 %a, %a2
45 define i8 @test_lshr_i8_imm(i32 %arg1) {
46 %a = trunc i32 %arg1 to i8
57 tracksRegLiveness: true
59 - { id: 0, class: gpr, preferred-register: '' }
60 - { id: 1, class: gpr, preferred-register: '' }
61 - { id: 2, class: gpr, preferred-register: '' }
62 - { id: 3, class: gpr, preferred-register: '' }
71 ; ALL-LABEL: name: test_lshr_i64
72 ; ALL: liveins: $rdi, $rsi
74 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
75 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr64_with_sub_8bit = COPY $rsi
76 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
77 ; ALL-NEXT: $cl = COPY [[COPY2]]
78 ; ALL-NEXT: [[SHR64rCL:%[0-9]+]]:gr64 = SHR64rCL [[COPY]], implicit-def dead $eflags, implicit $cl
79 ; ALL-NEXT: $rax = COPY [[SHR64rCL]]
80 ; ALL-NEXT: RET 0, implicit $rax
84 %3(s64) = G_LSHR %0, %2
90 name: test_lshr_i64_imm
94 tracksRegLiveness: true
96 - { id: 0, class: gpr, preferred-register: '' }
97 - { id: 1, class: gpr, preferred-register: '' }
98 - { id: 2, class: gpr, preferred-register: '' }
107 ; ALL-LABEL: name: test_lshr_i64_imm
110 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
111 ; ALL-NEXT: [[SHR64ri:%[0-9]+]]:gr64 = SHR64ri [[COPY]], 5, implicit-def dead $eflags
112 ; ALL-NEXT: $rax = COPY [[SHR64ri]]
113 ; ALL-NEXT: RET 0, implicit $rax
115 %1(s8) = G_CONSTANT i8 5
116 %2(s64) = G_LSHR %0, %1
125 regBankSelected: true
126 tracksRegLiveness: true
128 - { id: 0, class: gpr, preferred-register: '' }
129 - { id: 1, class: gpr, preferred-register: '' }
130 - { id: 2, class: gpr, preferred-register: '' }
131 - { id: 3, class: gpr, preferred-register: '' }
140 ; ALL-LABEL: name: test_lshr_i32
141 ; ALL: liveins: $edi, $esi
143 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
144 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
145 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
146 ; ALL-NEXT: $cl = COPY [[COPY2]]
147 ; ALL-NEXT: [[SHR32rCL:%[0-9]+]]:gr32 = SHR32rCL [[COPY]], implicit-def dead $eflags, implicit $cl
148 ; ALL-NEXT: $eax = COPY [[SHR32rCL]]
149 ; ALL-NEXT: RET 0, implicit $eax
153 %3(s32) = G_LSHR %0, %2
159 name: test_lshr_i32_imm
162 regBankSelected: true
163 tracksRegLiveness: true
165 - { id: 0, class: gpr, preferred-register: '' }
166 - { id: 1, class: gpr, preferred-register: '' }
167 - { id: 2, class: gpr, preferred-register: '' }
176 ; ALL-LABEL: name: test_lshr_i32_imm
179 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
180 ; ALL-NEXT: [[SHR32ri:%[0-9]+]]:gr32 = SHR32ri [[COPY]], 5, implicit-def dead $eflags
181 ; ALL-NEXT: $eax = COPY [[SHR32ri]]
182 ; ALL-NEXT: RET 0, implicit $eax
184 %1(s8) = G_CONSTANT i8 5
185 %2(s32) = G_LSHR %0, %1
194 regBankSelected: true
195 tracksRegLiveness: true
197 - { id: 0, class: gpr, preferred-register: '' }
198 - { id: 1, class: gpr, preferred-register: '' }
199 - { id: 2, class: gpr, preferred-register: '' }
200 - { id: 3, class: gpr, preferred-register: '' }
201 - { id: 4, class: gpr, preferred-register: '' }
210 ; ALL-LABEL: name: test_lshr_i16
211 ; ALL: liveins: $edi, $esi
213 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
214 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
215 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
216 ; ALL-NEXT: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
217 ; ALL-NEXT: $cl = COPY [[COPY3]]
218 ; ALL-NEXT: [[SHR16rCL:%[0-9]+]]:gr16 = SHR16rCL [[COPY2]], implicit-def dead $eflags, implicit $cl
219 ; ALL-NEXT: $ax = COPY [[SHR16rCL]]
220 ; ALL-NEXT: RET 0, implicit $ax
223 %2(s16) = G_TRUNC %0(s32)
224 %3(s8) = G_TRUNC %1(s32)
225 %4(s16) = G_LSHR %2, %3
231 name: test_lshr_i16_imm
234 regBankSelected: true
235 tracksRegLiveness: true
237 - { id: 0, class: gpr, preferred-register: '' }
238 - { id: 1, class: gpr, preferred-register: '' }
239 - { id: 2, class: gpr, preferred-register: '' }
240 - { id: 3, class: gpr, preferred-register: '' }
249 ; ALL-LABEL: name: test_lshr_i16_imm
252 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
253 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
254 ; ALL-NEXT: [[SHR16ri:%[0-9]+]]:gr16 = SHR16ri [[COPY1]], 5, implicit-def dead $eflags
255 ; ALL-NEXT: $ax = COPY [[SHR16ri]]
256 ; ALL-NEXT: RET 0, implicit $ax
258 %2(s8) = G_CONSTANT i8 5
259 %1(s16) = G_TRUNC %0(s32)
260 %3(s16) = G_LSHR %1, %2
269 regBankSelected: true
270 tracksRegLiveness: true
272 - { id: 0, class: gpr, preferred-register: '' }
273 - { id: 1, class: gpr, preferred-register: '' }
274 - { id: 2, class: gpr, preferred-register: '' }
275 - { id: 3, class: gpr, preferred-register: '' }
276 - { id: 4, class: gpr, preferred-register: '' }
285 ; ALL-LABEL: name: test_lshr_i8
286 ; ALL: liveins: $edi, $esi
288 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
289 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
290 ; ALL-NEXT: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
291 ; ALL-NEXT: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
292 ; ALL-NEXT: $cl = COPY [[COPY3]]
293 ; ALL-NEXT: [[SHR8rCL:%[0-9]+]]:gr8 = SHR8rCL [[COPY2]], implicit-def dead $eflags, implicit $cl
294 ; ALL-NEXT: $al = COPY [[SHR8rCL]]
295 ; ALL-NEXT: RET 0, implicit $al
298 %2(s8) = G_TRUNC %0(s32)
299 %3(s8) = G_TRUNC %1(s32)
300 %4(s8) = G_LSHR %2, %3
306 name: test_lshr_i8_imm
309 regBankSelected: true
310 tracksRegLiveness: true
312 - { id: 0, class: gpr, preferred-register: '' }
313 - { id: 1, class: gpr, preferred-register: '' }
314 - { id: 2, class: gpr, preferred-register: '' }
315 - { id: 3, class: gpr, preferred-register: '' }
324 ; ALL-LABEL: name: test_lshr_i8_imm
327 ; ALL-NEXT: [[COPY:%[0-9]+]]:gr32 = COPY $edi
328 ; ALL-NEXT: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
329 ; ALL-NEXT: [[SHR8ri:%[0-9]+]]:gr8 = SHR8ri [[COPY1]], 5, implicit-def dead $eflags
330 ; ALL-NEXT: $al = COPY [[SHR8ri]]
331 ; ALL-NEXT: RET 0, implicit $al
333 %2(s8) = G_CONSTANT i8 5
334 %1(s8) = G_TRUNC %0(s32)
335 %3(s8) = G_LSHR %1, %2