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 i64 @test_lshr_i64_imm1(i64 %arg1) {
16 %res = lshr i64 %arg1, 1
20 define i32 @test_lshr_i32(i32 %arg1, i32 %arg2) {
21 %res = lshr i32 %arg1, %arg2
25 define i32 @test_lshr_i32_imm(i32 %arg1) {
26 %res = lshr i32 %arg1, 5
30 define i32 @test_lshr_i32_imm1(i32 %arg1) {
31 %res = lshr i32 %arg1, 1
35 define i16 @test_lshr_i16(i32 %arg1, i32 %arg2) {
36 %a = trunc i32 %arg1 to i16
37 %a2 = trunc i32 %arg2 to i16
38 %res = lshr i16 %a, %a2
42 define i16 @test_lshr_i16_imm(i32 %arg1) {
43 %a = trunc i32 %arg1 to i16
48 define i16 @test_lshr_i16_imm1(i32 %arg1) {
49 %a = trunc i32 %arg1 to i16
54 define i8 @test_lshr_i8(i32 %arg1, i32 %arg2) {
55 %a = trunc i32 %arg1 to i8
56 %a2 = trunc i32 %arg2 to i8
57 %res = lshr i8 %a, %a2
61 define i8 @test_lshr_i8_imm(i32 %arg1) {
62 %a = trunc i32 %arg1 to i8
67 define i8 @test_lshr_i8_imm1(i32 %arg1) {
68 %a = trunc i32 %arg1 to i8
78 tracksRegLiveness: true
80 - { id: 0, class: gpr, preferred-register: '' }
81 - { id: 1, class: gpr, preferred-register: '' }
82 - { id: 2, class: gpr, preferred-register: '' }
83 - { id: 3, class: gpr, preferred-register: '' }
92 ; ALL-LABEL: name: test_lshr_i64
93 ; ALL: liveins: $rdi, $rsi
94 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
95 ; ALL: [[COPY1:%[0-9]+]]:gr64_with_sub_8bit = COPY $rsi
96 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
97 ; ALL: $cl = COPY [[COPY2]]
98 ; ALL: [[SHR64rCL:%[0-9]+]]:gr64 = SHR64rCL [[COPY]], implicit-def $eflags, implicit $cl
99 ; ALL: $rax = COPY [[SHR64rCL]]
100 ; ALL: RET 0, implicit $rax
104 %3(s64) = G_LSHR %0, %2
110 name: test_lshr_i64_imm
113 regBankSelected: true
114 tracksRegLiveness: true
116 - { id: 0, class: gpr, preferred-register: '' }
117 - { id: 1, class: gpr, preferred-register: '' }
118 - { id: 2, class: gpr, preferred-register: '' }
127 ; ALL-LABEL: name: test_lshr_i64_imm
129 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
130 ; ALL: [[SHR64ri:%[0-9]+]]:gr64 = SHR64ri [[COPY]], 5, implicit-def $eflags
131 ; ALL: $rax = COPY [[SHR64ri]]
132 ; ALL: RET 0, implicit $rax
134 %1(s8) = G_CONSTANT i8 5
135 %2(s64) = G_LSHR %0, %1
141 name: test_lshr_i64_imm1
144 regBankSelected: true
145 tracksRegLiveness: true
147 - { id: 0, class: gpr, preferred-register: '' }
148 - { id: 1, class: gpr, preferred-register: '' }
149 - { id: 2, class: gpr, preferred-register: '' }
158 ; ALL-LABEL: name: test_lshr_i64_imm1
160 ; ALL: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
161 ; ALL: [[SHR64r1_:%[0-9]+]]:gr64 = SHR64r1 [[COPY]], implicit-def $eflags
162 ; ALL: $rax = COPY [[SHR64r1_]]
163 ; ALL: RET 0, implicit $rax
165 %1(s8) = G_CONSTANT i8 1
166 %2(s64) = G_LSHR %0, %1
175 regBankSelected: true
176 tracksRegLiveness: true
178 - { id: 0, class: gpr, preferred-register: '' }
179 - { id: 1, class: gpr, preferred-register: '' }
180 - { id: 2, class: gpr, preferred-register: '' }
181 - { id: 3, class: gpr, preferred-register: '' }
190 ; ALL-LABEL: name: test_lshr_i32
191 ; ALL: liveins: $edi, $esi
192 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
193 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
194 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
195 ; ALL: $cl = COPY [[COPY2]]
196 ; ALL: [[SHR32rCL:%[0-9]+]]:gr32 = SHR32rCL [[COPY]], implicit-def $eflags, implicit $cl
197 ; ALL: $eax = COPY [[SHR32rCL]]
198 ; ALL: RET 0, implicit $eax
202 %3(s32) = G_LSHR %0, %2
208 name: test_lshr_i32_imm
211 regBankSelected: true
212 tracksRegLiveness: true
214 - { id: 0, class: gpr, preferred-register: '' }
215 - { id: 1, class: gpr, preferred-register: '' }
216 - { id: 2, class: gpr, preferred-register: '' }
225 ; ALL-LABEL: name: test_lshr_i32_imm
227 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
228 ; ALL: [[SHR32ri:%[0-9]+]]:gr32 = SHR32ri [[COPY]], 5, implicit-def $eflags
229 ; ALL: $eax = COPY [[SHR32ri]]
230 ; ALL: RET 0, implicit $eax
232 %1(s8) = G_CONSTANT i8 5
233 %2(s32) = G_LSHR %0, %1
239 name: test_lshr_i32_imm1
242 regBankSelected: true
243 tracksRegLiveness: true
245 - { id: 0, class: gpr, preferred-register: '' }
246 - { id: 1, class: gpr, preferred-register: '' }
247 - { id: 2, class: gpr, preferred-register: '' }
256 ; ALL-LABEL: name: test_lshr_i32_imm1
258 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
259 ; ALL: [[SHR32r1_:%[0-9]+]]:gr32 = SHR32r1 [[COPY]], implicit-def $eflags
260 ; ALL: $eax = COPY [[SHR32r1_]]
261 ; ALL: RET 0, implicit $eax
263 %1(s8) = G_CONSTANT i8 1
264 %2(s32) = G_LSHR %0, %1
273 regBankSelected: true
274 tracksRegLiveness: true
276 - { id: 0, class: gpr, preferred-register: '' }
277 - { id: 1, class: gpr, preferred-register: '' }
278 - { id: 2, class: gpr, preferred-register: '' }
279 - { id: 3, class: gpr, preferred-register: '' }
280 - { id: 4, class: gpr, preferred-register: '' }
289 ; ALL-LABEL: name: test_lshr_i16
290 ; ALL: liveins: $edi, $esi
291 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
292 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
293 ; ALL: [[COPY2:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
294 ; ALL: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
295 ; ALL: $cl = COPY [[COPY3]]
296 ; ALL: [[SHR16rCL:%[0-9]+]]:gr16 = SHR16rCL [[COPY2]], implicit-def $eflags, implicit $cl
297 ; ALL: $ax = COPY [[SHR16rCL]]
298 ; ALL: RET 0, implicit $ax
301 %2(s16) = G_TRUNC %0(s32)
302 %3(s8) = G_TRUNC %1(s32)
303 %4(s16) = G_LSHR %2, %3
309 name: test_lshr_i16_imm
312 regBankSelected: true
313 tracksRegLiveness: true
315 - { id: 0, class: gpr, preferred-register: '' }
316 - { id: 1, class: gpr, preferred-register: '' }
317 - { id: 2, class: gpr, preferred-register: '' }
318 - { id: 3, class: gpr, preferred-register: '' }
327 ; ALL-LABEL: name: test_lshr_i16_imm
329 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
330 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
331 ; ALL: [[SHR16ri:%[0-9]+]]:gr16 = SHR16ri [[COPY1]], 5, implicit-def $eflags
332 ; ALL: $ax = COPY [[SHR16ri]]
333 ; ALL: RET 0, implicit $ax
335 %2(s8) = G_CONSTANT i8 5
336 %1(s16) = G_TRUNC %0(s32)
337 %3(s16) = G_LSHR %1, %2
343 name: test_lshr_i16_imm1
346 regBankSelected: true
347 tracksRegLiveness: true
349 - { id: 0, class: gpr, preferred-register: '' }
350 - { id: 1, class: gpr, preferred-register: '' }
351 - { id: 2, class: gpr, preferred-register: '' }
352 - { id: 3, class: gpr, preferred-register: '' }
361 ; ALL-LABEL: name: test_lshr_i16_imm1
363 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
364 ; ALL: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
365 ; ALL: [[SHR16r1_:%[0-9]+]]:gr16 = SHR16r1 [[COPY1]], implicit-def $eflags
366 ; ALL: $ax = COPY [[SHR16r1_]]
367 ; ALL: RET 0, implicit $ax
369 %2(s8) = G_CONSTANT i8 1
370 %1(s16) = G_TRUNC %0(s32)
371 %3(s16) = G_LSHR %1, %2
380 regBankSelected: true
381 tracksRegLiveness: true
383 - { id: 0, class: gpr, preferred-register: '' }
384 - { id: 1, class: gpr, preferred-register: '' }
385 - { id: 2, class: gpr, preferred-register: '' }
386 - { id: 3, class: gpr, preferred-register: '' }
387 - { id: 4, class: gpr, preferred-register: '' }
396 ; ALL-LABEL: name: test_lshr_i8
397 ; ALL: liveins: $edi, $esi
398 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
399 ; ALL: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
400 ; ALL: [[COPY2:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
401 ; ALL: [[COPY3:%[0-9]+]]:gr8 = COPY [[COPY1]].sub_8bit
402 ; ALL: $cl = COPY [[COPY3]]
403 ; ALL: [[SHR8rCL:%[0-9]+]]:gr8 = SHR8rCL [[COPY2]], implicit-def $eflags, implicit $cl
404 ; ALL: $al = COPY [[SHR8rCL]]
405 ; ALL: RET 0, implicit $al
408 %2(s8) = G_TRUNC %0(s32)
409 %3(s8) = G_TRUNC %1(s32)
410 %4(s8) = G_LSHR %2, %3
416 name: test_lshr_i8_imm
419 regBankSelected: true
420 tracksRegLiveness: true
422 - { id: 0, class: gpr, preferred-register: '' }
423 - { id: 1, class: gpr, preferred-register: '' }
424 - { id: 2, class: gpr, preferred-register: '' }
425 - { id: 3, class: gpr, preferred-register: '' }
434 ; ALL-LABEL: name: test_lshr_i8_imm
436 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
437 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
438 ; ALL: [[SHR8ri:%[0-9]+]]:gr8 = SHR8ri [[COPY1]], 5, implicit-def $eflags
439 ; ALL: $al = COPY [[SHR8ri]]
440 ; ALL: RET 0, implicit $al
442 %2(s8) = G_CONSTANT i8 5
443 %1(s8) = G_TRUNC %0(s32)
444 %3(s8) = G_LSHR %1, %2
450 name: test_lshr_i8_imm1
453 regBankSelected: true
454 tracksRegLiveness: true
456 - { id: 0, class: gpr, preferred-register: '' }
457 - { id: 1, class: gpr, preferred-register: '' }
458 - { id: 2, class: gpr, preferred-register: '' }
459 - { id: 3, class: gpr, preferred-register: '' }
468 ; ALL-LABEL: name: test_lshr_i8_imm1
470 ; ALL: [[COPY:%[0-9]+]]:gr32 = COPY $edi
471 ; ALL: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
472 ; ALL: [[SHR8r1_:%[0-9]+]]:gr8 = SHR8r1 [[COPY1]], implicit-def $eflags
473 ; ALL: $al = COPY [[SHR8r1_]]
474 ; ALL: RET 0, implicit $al
476 %2(s8) = G_CONSTANT i8 1
477 %1(s8) = G_TRUNC %0(s32)
478 %3(s8) = G_LSHR %1, %2