1 ; RUN: llc -verify-machineinstrs -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s
3 %struct.anon = type { %struct.anon.0, %struct.anon.1 }
4 %struct.anon.0 = type { i32 }
5 %struct.anon.1 = type { i32 }
7 @i = common global i32 0, align 4
8 @b = common global ptr null, align 8
9 @c = common global i32 0, align 4
10 @a = common global i32 0, align 4
11 @h = common global i32 0, align 4
12 @g = common global i32 0, align 4
13 @j = common global i32 0, align 4
14 @f = common global %struct.anon zeroinitializer, align 4
15 @d = common global i32 0, align 4
16 @e = common global i32 0, align 4
18 ; Function Attrs: norecurse nounwind
19 define signext i32 @fn1(ptr nocapture %p1, i32 signext %p2, ptr nocapture %p3) {
21 %0 = load i32, ptr @i, align 4, !tbaa !1
22 %cond = icmp eq i32 %0, 8
23 br i1 %cond, label %if.end16, label %while.cond.preheader
25 while.cond.preheader: ; preds = %entry
26 %1 = load ptr, ptr @b, align 8, !tbaa !5
27 %2 = load i32, ptr %1, align 4, !tbaa !1
28 %tobool18 = icmp eq i32 %2, 0
29 br i1 %tobool18, label %while.end, label %while.body.lr.ph
31 while.body.lr.ph: ; preds = %while.cond.preheader
32 %.pre = load i32, ptr @c, align 4, !tbaa !1
35 while.body: ; preds = %while.body.backedge, %while.body.lr.ph
36 switch i32 %.pre, label %while.body.backedge [
40 i32 240, label %while.cond.backedge
43 while.body.backedge: ; preds = %while.body, %while.cond.backedge
46 sw.bb1: ; preds = %while.body, %while.body, %while.body
47 store i32 2, ptr @a, align 4, !tbaa !1
48 br label %while.cond.backedge
50 while.cond.backedge: ; preds = %while.body, %sw.bb1
51 store i32 4, ptr @a, align 4, !tbaa !1
52 %.pre19 = load i32, ptr %1, align 4, !tbaa !1
53 %tobool = icmp eq i32 %.pre19, 0
54 br i1 %tobool, label %while.end.loopexit, label %while.body.backedge
56 while.end.loopexit: ; preds = %while.cond.backedge
59 while.end: ; preds = %while.end.loopexit, %while.cond.preheader
60 %3 = load i32, ptr @h, align 4, !tbaa !1
61 %mul = mul nsw i32 %0, %3
62 %4 = load i32, ptr @g, align 4, !tbaa !1
63 %mul4 = mul nsw i32 %mul, %4
64 store i32 %mul4, ptr @j, align 4, !tbaa !1
65 %5 = load i32, ptr @f, align 4, !tbaa !7
66 %tobool5 = icmp eq i32 %5, 0
67 br i1 %tobool5, label %if.end, label %if.then
69 if.then: ; preds = %while.end
70 %div = sdiv i32 %5, %mul
71 store i32 %div, ptr @g, align 4, !tbaa !1
74 if.end: ; preds = %while.end, %if.then
75 %6 = phi i32 [ %4, %while.end ], [ %div, %if.then ]
76 %7 = load i32, ptr getelementptr inbounds (%struct.anon, ptr @f, i64 0, i32 1, i32 0), align 4, !tbaa !10
77 %tobool7 = icmp ne i32 %7, 0
78 %tobool8 = icmp ne i32 %mul4, 0
79 %or.cond = and i1 %tobool7, %tobool8
80 %tobool10 = icmp ne i32 %0, 0
81 %or.cond17 = and i1 %or.cond, %tobool10
82 br i1 %or.cond17, label %if.then11, label %if.end13
84 if.then11: ; preds = %if.end
85 store i32 %3, ptr @d, align 4, !tbaa !1
86 %8 = load i32, ptr @e, align 4, !tbaa !1
87 store i32 %8, ptr %p3, align 4, !tbaa !1
88 %.pre20 = load i32, ptr @g, align 4, !tbaa !1
91 if.end13: ; preds = %if.then11, %if.end
92 %9 = phi i32 [ %.pre20, %if.then11 ], [ %6, %if.end ]
93 %tobool14 = icmp eq i32 %9, 0
94 br i1 %tobool14, label %if.end16, label %if.then15
96 if.then15: ; preds = %if.end13
97 store i32 %p2, ptr %p1, align 4, !tbaa !1
100 if.end16: ; preds = %entry, %if.end13, %if.then15
104 ; CHECK: mfocrf {{[0-9]+}}
108 !0 = !{!"clang version 3.9.0 (trunk 261520)"}
109 !1 = !{!2, !2, i64 0}
110 !2 = !{!"int", !3, i64 0}
111 !3 = !{!"omnipotent char", !4, i64 0}
112 !4 = !{!"Simple C/C++ TBAA"}
113 !5 = !{!6, !6, i64 0}
114 !6 = !{!"any pointer", !3, i64 0}
115 !7 = !{!8, !2, i64 0}
116 !8 = !{!"", !9, i64 0, !9, i64 4}
117 !9 = !{!"", !2, i64 0}
118 !10 = !{!8, !2, i64 4}