xref: /llvm-project/llvm/test/CodeGen/PowerPC/jump-tables-collapse-rotate-remove-SrcMI.mir (revision 6820cb2dd5cfa103953373b5a00b8e59365bad7f)
1# RUN: llc -mtriple=powerpc64le--linux-gnu -start-before ppc-mi-peepholes %s -o - -verify-machineinstrs | FileCheck %s
2# RUN: llc -mtriple=powerpc64le--linux-gnu -run-pass ppc-mi-peepholes %s -o - -verify-machineinstrs | FileCheck %s --check-prefix=CHECK-PASS
3
4# The differential revision https://reviews.llvm.org/D60402 was supposed to
5# collapse RLDICL/RLDICR into RLDIC when possible, but it missed removing the
6# RLDICL instruction. This test case tests the fix for the bug.
7
8--- |
9  ; ModuleID = 'jump-tables-collapse-rotate-remove-SrcMI.ll'
10  source_filename = "jump-tables-collapse-rotate-remove-SrcMI.ll"
11  target datalayout = "e-m:e-i64:64-n32:64"
12
13  define dso_local i64 @test(i64 %a, i64 %b) local_unnamed_addr {
14  entry:
15    %add = add nsw i64 %b, %a
16    ret i64 %add
17  }
18
19...
20---
21name:            test
22alignment:       16
23tracksRegLiveness: true
24registers:
25  - { id: 0, class: g8rc }
26  - { id: 1, class: g8rc }
27  - { id: 2, class: g8rc }
28liveins:
29  - { reg: '$x3', virtual-reg: '%0' }
30  - { reg: '$x4', virtual-reg: '%1' }
31frameInfo:
32  maxAlignment:    1
33machineFunctionInfo: {}
34body:             |
35  bb.0.entry:
36    liveins: $x3, $x4
37
38    %1:g8rc = COPY $x4
39    %0:g8rc = COPY $x3
40    %2:g8rc = RLDICL killed %1, 0, 32
41    %3:g8rc = RLDICR %2, 2, 61
42    $x3 = COPY %3
43    BLR8 implicit $lr8, implicit $rm, implicit $x3
44
45...
46# CHECK-LABEL: test:
47# CHECK: # %bb.0: # %entry
48# CHECK-NEXT: 	rldic 3, 4, 2, 30
49# CHECK-NEXT: 	blr
50#
51# CHECK-PASS-NOT:     %2:g8rc = RLDICL killed %1, 0, 32
52# CHECK-PASS-NOT:     %3:g8rc = RLDICR %2, 2, 61
53# CHECK-PASS:     %3:g8rc = RLDIC killed %1, 2, 30
54