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:             |
35body:             |
36  bb.0.entry:
37    liveins: $x3, $x4
38
39    %1:g8rc = COPY $x4
40    %0:g8rc = COPY $x3
41    %2:g8rc = RLDICL killed %1, 0, 32
42    %3:g8rc = RLDICR %2, 2, 61
43    $x3 = COPY %3
44    BLR8 implicit $lr8, implicit $rm, implicit $x3
45
46...
47# CHECK-LABEL: test:
48# CHECK: # %bb.0: # %entry
49# CHECK-NEXT: 	rldic 3, 4, 2, 30
50# CHECK-NEXT: 	blr
51#
52# CHECK-PASS-NOT:     %2:g8rc = RLDICL killed %1, 0, 32
53# CHECK-PASS-NOT:     %3:g8rc = RLDICR %2, 2, 61
54# CHECK-PASS:     %3:g8rc = RLDIC killed %1, 2, 30
55