1# RUN: llc -start-after=machine-sink -stop-after=peephole-opt -mtriple=powerpc64-unknown-linux-gnu -o - %s | FileCheck %s
2
3--- |
4  ; ModuleID = '<stdin>'
5  source_filename = "<stdin>"
6  target datalayout = "E-m:e-i64:64-n32:64"
7  target triple = "powerpc64-unknown-linux-gnu"
8
9  ; Function Attrs: nounwind readnone
10  declare i128 @llvm.cttz.i128(i128, i1) #0
11
12  define void @fn1(i128, i128, i1) {
13  top:
14    br label %loop
15
16  loop:                                             ; preds = %loop, %top
17    %v = phi i128 [ %3, %loop ], [ %0, %top ]
18    %u = phi i128 [ %3, %loop ], [ %1, %top ]
19    %s = sub i128 %v, %u
20    %3 = call i128 @llvm.cttz.i128(i128 %s, i1 false)
21    br label %loop
22  }
23
24  ; Function Attrs: nounwind
25  declare void @llvm.stackprotector(i8*, i8**) #1
26
27  attributes #0 = { nounwind readnone }
28  attributes #1 = { nounwind }
29
30...
31---
32name:            fn1
33alignment:       4
34exposesReturnsTwice: false
35tracksRegLiveness: true
36registers:
37  - { id: 0, class: g8rc }
38  - { id: 1, class: g8rc }
39  - { id: 2, class: g8rc }
40  - { id: 3, class: g8rc }
41  - { id: 4, class: g8rc }
42  - { id: 5, class: g8rc }
43  - { id: 6, class: g8rc }
44  - { id: 7, class: g8rc }
45  - { id: 8, class: g8rc }
46  - { id: 9, class: g8rc }
47  - { id: 10, class: g8rc }
48  - { id: 11, class: g8rc }
49  - { id: 12, class: g8rc }
50  - { id: 13, class: g8rc }
51  - { id: 14, class: g8rc }
52  - { id: 15, class: g8rc_and_g8rc_nox0 }
53  - { id: 16, class: g8rc_and_g8rc_nox0 }
54  - { id: 17, class: g8rc }
55  - { id: 18, class: g8rc }
56  - { id: 19, class: g8rc }
57  - { id: 20, class: g8rc }
58  - { id: 21, class: g8rc }
59  - { id: 22, class: g8rc }
60  - { id: 23, class: g8rc }
61  - { id: 24, class: g8rc }
62  - { id: 25, class: crrc }
63  - { id: 26, class: g8rc_and_g8rc_nox0 }
64  - { id: 27, class: g8rc_and_g8rc_nox0 }
65liveins:
66  - { reg: '$x3', virtual-reg: '%6' }
67  - { reg: '$x4', virtual-reg: '%7' }
68  - { reg: '$x5', virtual-reg: '%8' }
69  - { reg: '$x6', virtual-reg: '%9' }
70frameInfo:
71  isFrameAddressTaken: false
72  isReturnAddressTaken: false
73  hasStackMap:     false
74  hasPatchPoint:   false
75  stackSize:       0
76  offsetAdjustment: 0
77  maxAlignment:    0
78  adjustsStack:    false
79  hasCalls:        false
80  maxCallFrameSize: 0
81  hasOpaqueSPAdjustment: false
82  hasVAStart:      false
83  hasMustTailInVarArgFunc: false
84body:             |
85  bb.0.top:
86    successors: %bb.1.loop
87    liveins: $x3, $x4, $x5, $x6
88
89    %9 = COPY $x6
90    %8 = COPY $x5
91    %7 = COPY $x4
92    %6 = COPY $x3
93    %14 = COPY %9
94    %13 = COPY %8
95    %12 = COPY %7
96    %11 = COPY %6
97    %21 = LI8 128
98    %23 = LI8 64
99
100  bb.1.loop:
101    successors: %bb.2.loop, %bb.4
102
103    %0 = PHI %11, %bb.0.top, %4, %bb.3.loop
104    %1 = PHI %12, %bb.0.top, %5, %bb.3.loop
105    %2 = PHI %13, %bb.0.top, %4, %bb.3.loop
106    %3 = PHI %14, %bb.0.top, %5, %bb.3.loop
107    %15 = SUBFC8 %3, %1, implicit-def $carry
108    %16 = SUBFE8 %2, %0, implicit-def dead $carry, implicit $carry
109    %17 = ADDI8 %16, -1
110    %18 = ADDI8 %15, -1
111    %19 = ANDC8 killed %17, %16
112    %20 = ANDC8 killed %18, %15
113    %22 = CNTLZD killed %19
114    %24 = CNTLZD killed %20
115    %25 = CMPLDI %15, 0
116    BCC 76, %25, %bb.2.loop
117    ; CHECK: SUBFC8_rec %3, %1, implicit-def $carry, implicit-def $cr0
118    ; CHECK: COPY killed $cr0
119    ; CHECK: BCC
120
121  bb.4:
122    successors: %bb.3.loop
123
124    %27 = SUBF8 %24, %23
125    B %bb.3.loop
126
127  bb.2.loop:
128    successors: %bb.3.loop
129
130    %26 = SUBF8 %22, %21
131
132  bb.3.loop:
133    successors: %bb.1.loop
134
135    %5 = PHI %26, %bb.2.loop, %27, %bb.4
136    %4 = LI8 0
137    B %bb.1.loop
138
139...
140