1; RUN: llc -verify-machineinstrs -mcpu=pwr7 < %s | FileCheck %s
2; RUN: llc -verify-machineinstrs -mcpu=pwr7 -ppc-gen-isel=false < %s | FileCheck --check-prefix=CHECK-NO-ISEL %s
3target datalayout = "E-m:e-i64:64-n32:64"
4target triple = "powerpc64-unknown-linux-gnu"
5
6; Function Attrs: nounwind
7define void @jbd2_journal_commit_transaction(i32* %journal, i64 %inp1, i32 %inp2,
8                                             i32* %inp3, i32** %inp4,
9                                             i32** %inp5, i1 %inp6,
10                                             i1 %inp7, i1 %inp8) #0 {
11entry:
12  br i1 undef, label %do.body, label %if.then5
13
14if.then5:                                         ; preds = %entry
15  unreachable
16
17do.body:                                          ; preds = %entry
18  br i1 undef, label %do.body.i, label %trace_jbd2_start_commit.exit
19
20do.body.i:                                        ; preds = %do.body
21  unreachable
22
23trace_jbd2_start_commit.exit:                     ; preds = %do.body
24  br i1 undef, label %do.body.i1116, label %trace_jbd2_commit_locking.exit
25
26do.body.i1116:                                    ; preds = %trace_jbd2_start_commit.exit
27  br i1 undef, label %if.end.i1123, label %do.body5.i1122
28
29do.body5.i1122:                                   ; preds = %do.body.i1116
30  unreachable
31
32if.end.i1123:                                     ; preds = %do.body.i1116
33  br label %trace_jbd2_commit_locking.exit
34
35trace_jbd2_commit_locking.exit:                   ; preds = %if.end.i1123, %trace_jbd2_start_commit.exit
36  br i1 undef, label %spin_unlock.exit1146, label %if.then.i.i.i.i1144
37
38if.then.i.i.i.i1144:                              ; preds = %trace_jbd2_commit_locking.exit
39  unreachable
40
41spin_unlock.exit1146:                             ; preds = %trace_jbd2_commit_locking.exit
42  br i1 undef, label %spin_unlock.exit1154, label %if.then.i.i.i.i1152
43
44if.then.i.i.i.i1152:                              ; preds = %spin_unlock.exit1146
45  br label %spin_unlock.exit1154
46
47spin_unlock.exit1154:                             ; preds = %if.then.i.i.i.i1152, %spin_unlock.exit1146
48  br i1 undef, label %do.body.i1159, label %trace_jbd2_commit_flushing.exit
49
50do.body.i1159:                                    ; preds = %spin_unlock.exit1154
51  unreachable
52
53trace_jbd2_commit_flushing.exit:                  ; preds = %spin_unlock.exit1154
54  br i1 undef, label %for.end.i, label %for.body.lr.ph.i
55
56for.body.lr.ph.i:                                 ; preds = %trace_jbd2_commit_flushing.exit
57  br i1 undef, label %spin_unlock.exit.i, label %if.then.i.i.i.i.i
58
59if.then.i.i.i.i.i:                                ; preds = %for.body.lr.ph.i
60  unreachable
61
62spin_unlock.exit.i:                               ; preds = %for.body.lr.ph.i
63  unreachable
64
65for.end.i:                                        ; preds = %trace_jbd2_commit_flushing.exit
66  br i1 undef, label %journal_submit_data_buffers.exit, label %if.then.i.i.i.i31.i
67
68if.then.i.i.i.i31.i:                              ; preds = %for.end.i
69  unreachable
70
71journal_submit_data_buffers.exit:                 ; preds = %for.end.i
72  br i1 undef, label %if.end103, label %if.then102
73
74if.then102:                                       ; preds = %journal_submit_data_buffers.exit
75  unreachable
76
77if.end103:                                        ; preds = %journal_submit_data_buffers.exit
78  br i1 undef, label %do.body.i1182, label %trace_jbd2_commit_logging.exit
79
80do.body.i1182:                                    ; preds = %if.end103
81  unreachable
82
83trace_jbd2_commit_logging.exit:                   ; preds = %if.end103
84  br i1 undef, label %for.end.i1287, label %for.body.i1277
85
86for.body.i1277:                                   ; preds = %trace_jbd2_commit_logging.exit
87  unreachable
88
89for.end.i1287:                                    ; preds = %trace_jbd2_commit_logging.exit
90  br i1 undef, label %journal_finish_inode_data_buffers.exit, label %if.then.i.i.i.i84.i
91
92if.then.i.i.i.i84.i:                              ; preds = %for.end.i1287
93  unreachable
94
95journal_finish_inode_data_buffers.exit:           ; preds = %for.end.i1287
96  br i1 undef, label %if.end256, label %if.then249
97
98if.then249:                                       ; preds = %journal_finish_inode_data_buffers.exit
99  unreachable
100
101if.end256:                                        ; preds = %journal_finish_inode_data_buffers.exit
102  br i1 undef, label %do.body277, label %if.then260
103
104if.then260:                                       ; preds = %if.end256
105  br label %do.body277
106
107do.body277:                                       ; preds = %if.then260, %if.end256
108  br label %while.body318
109
110while.body318:                                    ; preds = %wait_on_buffer.exit, %do.body277
111  %tobool.i1295 = icmp eq i64 %inp1, 0
112  br i1 %tobool.i1295, label %wait_on_buffer.exit, label %if.then.i1296
113
114if.then.i1296:                                    ; preds = %while.body318
115  unreachable
116
117wait_on_buffer.exit:                              ; preds = %while.body318
118  br i1 %inp6, label %do.body378, label %while.body318
119
120do.body378:                                       ; preds = %wait_on_buffer.exit
121  br i1 %inp7, label %while.end418, label %while.body392.lr.ph
122
123while.body392.lr.ph:                              ; preds = %do.body378
124  br label %while.body392
125
126while.body392:                                    ; preds = %wait_on_buffer.exit1319, %while.body392.lr.ph
127  %0 = load i8*, i8** undef, align 8
128  %add.ptr399 = getelementptr inbounds i8, i8* %0, i64 -72
129  %b_state.i.i1314 = bitcast i8* %add.ptr399 to i64*
130  %tobool.i1316 = icmp eq i64 %inp1, 0
131  br i1 %tobool.i1316, label %wait_on_buffer.exit1319, label %if.then.i1317
132
133if.then.i1317:                                    ; preds = %while.body392
134  unreachable
135
136wait_on_buffer.exit1319:                          ; preds = %while.body392
137  %1 = load volatile i64, i64* %b_state.i.i1314, align 8
138  %conv.i.i1322 = and i64 %1, 1
139  %lnot404 = icmp eq i64 %conv.i.i1322, 0
140  %.err.4 = select i1 %lnot404, i32 -5, i32 %inp2
141  %2 = call i64 asm sideeffect "1:.long 0x7c0000a8 $| ((($0) & 0x1f) << 21) $| (((0) & 0x1f) << 16) $| ((($3) & 0x1f) << 11) $| (((0) & 0x1) << 0) \0Aandc $0,$0,$2\0Astdcx. $0,0,$3\0Abne- 1b\0A", "=&r,=*m,r,r,*m,~{cc},~{memory}"(i64* %b_state.i.i1314, i64 262144, i64* %b_state.i.i1314, i64* %b_state.i.i1314) #1
142  %prev.i.i.i1325 = getelementptr inbounds i8, i8* %0, i64 8
143  %3 = load i32*, i32** %inp4, align 8
144  store i32* %3, i32** %inp5, align 8
145  call void @__brelse(i32* %3) #1
146  br i1 %inp8, label %while.end418, label %while.body392
147
148; CHECK-LABEL: @jbd2_journal_commit_transaction
149; CHECK-NO-ISEL-LABEL: @jbd2_journal_commit_transaction
150; CHECK: andi.
151; CHECK: crmove
152; CHECK: stdcx.
153; CHECK: isel {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}},
154; CHECK-NO-ISEL: bc 12, 1, [[TRUE:.LBB[0-9]+]]
155; CHECK-NO-ISEL: ori 30, 3, 0
156; CHECK-NO-ISEL: b [[SUCCESSOR:.LBB[0-9]+]]
157
158
159while.end418:                                     ; preds = %wait_on_buffer.exit1319, %do.body378
160  %err.4.lcssa = phi i32 [ %inp2, %do.body378 ], [ %.err.4, %wait_on_buffer.exit1319 ]
161  br i1 %inp7, label %if.end421, label %if.then420
162
163if.then420:                                       ; preds = %while.end418
164  call void @jbd2_journal_abort(i32* %journal, i32 signext %err.4.lcssa) #1
165  br label %if.end421
166
167if.end421:                                        ; preds = %if.then420, %while.end418
168  unreachable
169}
170
171declare void @jbd2_journal_abort(i32*, i32 signext)
172
173declare void @__brelse(i32*)
174
175attributes #0 = { nounwind }
176attributes #1 = { nounwind }
177
178