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