1; RUN: llc < %s -mtriple=arm-apple-darwin -mcpu=cortex-a8 | FileCheck %s
2; rdar://8598427
3; Adjust if-converter heuristics to avoid predicating vmrs which can cause
4; significant regression.
5
6%struct.xyz_t = type { double, double, double }
7
8define i32 @effie(i32 %tsets, %struct.xyz_t* nocapture %p, i32 %a, i32 %b, i32 %c) nounwind readonly noinline {
9; CHECK-LABEL: effie:
10entry:
11  %0 = icmp sgt i32 %tsets, 0
12  br i1 %0, label %bb.nph, label %bb6
13
14bb.nph:                                           ; preds = %entry
15  %1 = add nsw i32 %b, %a
16  %2 = add nsw i32 %1, %c
17  br label %bb
18
19bb:                                               ; preds = %bb4, %bb.nph
20; CHECK: vcmpe.f64
21; CHECK: vmrs APSR_nzcv, fpscr
22  %r.19 = phi i32 [ 0, %bb.nph ], [ %r.0, %bb4 ]
23  %n.08 = phi i32 [ 0, %bb.nph ], [ %10, %bb4 ]
24  %scevgep10 = getelementptr inbounds %struct.xyz_t, %struct.xyz_t* %p, i32 %n.08, i32 0
25  %scevgep11 = getelementptr %struct.xyz_t, %struct.xyz_t* %p, i32 %n.08, i32 1
26  %3 = load double, double* %scevgep10, align 4
27  %4 = load double, double* %scevgep11, align 4
28  %5 = fcmp uge double %3, %4
29  br i1 %5, label %bb3, label %bb1
30
31bb1:                                              ; preds = %bb
32; CHECK-NOT: it
33; CHECK-NOT: vcmpemi
34; CHECK-NOT: vmrsmi
35; CHECK: vcmpe.f64
36; CHECK: vmrs APSR_nzcv, fpscr
37  %scevgep12 = getelementptr %struct.xyz_t, %struct.xyz_t* %p, i32 %n.08, i32 2
38  %6 = load double, double* %scevgep12, align 4
39  %7 = fcmp uge double %3, %6
40  br i1 %7, label %bb3, label %bb2
41
42bb2:                                              ; preds = %bb1
43  %8 = add nsw i32 %2, %r.19
44  br label %bb4
45
46bb3:                                              ; preds = %bb1, %bb
47  %9 = add nsw i32 %r.19, 1
48  br label %bb4
49
50bb4:                                              ; preds = %bb3, %bb2
51  %r.0 = phi i32 [ %9, %bb3 ], [ %8, %bb2 ]
52  %10 = add nsw i32 %n.08, 1
53  %exitcond = icmp eq i32 %10, %tsets
54  br i1 %exitcond, label %bb6, label %bb
55
56bb6:                                              ; preds = %bb4, %entry
57  %r.1.lcssa = phi i32 [ 0, %entry ], [ %r.0, %bb4 ]
58  ret i32 %r.1.lcssa
59}
60