1; RUN: llc -mtriple=powerpc-unknown-linux-gnu -O1 < %s | FileCheck %s
2
3; double x, y;
4;
5; void foo1()
6; {
7;   x = y = 1.1;
8;   for (int i = 0; i < 175; i++)
9;     y = x + y;
10; }
11; void foo2()
12; {
13;   x = y = 1.1;
14;   for (int i = 0; i < 175; i++)
15;     y = x - y;
16; }
17; void foo3()
18; {
19;   x = y = 1.1;
20;   for (int i = 0; i < 175; i++)
21;     y = x * y;
22; }
23; void foo4()
24; {
25;   x = y = 1.1;
26;   for (int i = 0; i < 175; i++)
27;     y = x / y;
28; }
29
30target datalayout = "E-m:e-p:32:32-i64:64-n32"
31target triple = "powerpc-buildroot-linux-gnu"
32
33@y = common global double 0.000000e+00, align 8
34@x = common global double 0.000000e+00, align 8
35
36define void @foo1() #0 {
37  store double 1.100000e+00, double* @y, align 8
38  store double 1.100000e+00, double* @x, align 8
39  br label %2
40
41; <label>:1                                       ; preds = %2
42  %.lcssa = phi double [ %4, %2 ]
43  store double %.lcssa, double* @y, align 8
44  ret void
45
46; <label>:2                                       ; preds = %2, %0
47  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
48  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
49  %4 = fadd double %3, 1.100000e+00
50  %5 = add nuw nsw i32 %i.01, 1
51  %exitcond = icmp eq i32 %5, 75
52  br i1 %exitcond, label %1, label %2
53  ; CHECK: bl __adddf3
54  ; CHECK: cmplwi
55  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
56  ; CHECK-NOT: mtctr [[REG1]]
57}
58
59define void @foo2() #0 {
60  store double 1.100000e+00, double* @y, align 8
61  store double 1.100000e+00, double* @x, align 8
62  br label %2
63
64; <label>:1                                       ; preds = %2
65  %.lcssa = phi double [ %4, %2 ]
66  store double %.lcssa, double* @y, align 8
67  ret void
68
69; <label>:2                                       ; preds = %2, %0
70  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
71  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
72  %4 = fsub double 1.100000e+00, %3
73  %5 = add nuw nsw i32 %i.01, 1
74  %exitcond = icmp eq i32 %5, 75
75  br i1 %exitcond, label %1, label %2
76  ; CHECK: bl __subdf3
77  ; CHECK: cmplwi
78  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
79  ; CHECK-NOT: mtctr [[REG1]]
80}
81
82define void @foo3() #0 {
83  store double 1.100000e+00, double* @y, align 8
84  store double 1.100000e+00, double* @x, align 8
85  br label %2
86
87; <label>:1                                       ; preds = %2
88  %.lcssa = phi double [ %4, %2 ]
89  store double %.lcssa, double* @y, align 8
90  ret void
91
92; <label>:2                                       ; preds = %2, %0
93  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
94  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
95  %4 = fmul double %3, 1.100000e+00
96  %5 = add nuw nsw i32 %i.01, 1
97  %exitcond = icmp eq i32 %5, 75
98  br i1 %exitcond, label %1, label %2
99  ; CHECK: bl __muldf3
100  ; CHECK: cmplwi
101  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
102  ; CHECK-NOT: mtctr [[REG1]]
103}
104
105define void @foo4() #0 {
106  store double 1.100000e+00, double* @y, align 8
107  store double 1.100000e+00, double* @x, align 8
108  br label %2
109
110; <label>:1                                       ; preds = %2
111  %.lcssa = phi double [ %4, %2 ]
112  store double %.lcssa, double* @y, align 8
113  ret void
114
115; <label>:2                                       ; preds = %2, %0
116  %3 = phi double [ 1.100000e+00, %0 ], [ %4, %2 ]
117  %i.01 = phi i32 [ 0, %0 ], [ %5, %2 ]
118  %4 = fdiv double 1.100000e+00, %3
119  %5 = add nuw nsw i32 %i.01, 1
120  %exitcond = icmp eq i32 %5, 75
121  br i1 %exitcond, label %1, label %2
122  ; CHECK: bl __divdf3
123  ; CHECK: cmplwi
124  ; CHECK-NOT: li [[REG1:[0-9]+]], 175
125  ; CHECK-NOT: mtctr [[REG1]]
126}
127
128attributes #0 = { "use-soft-float"="true" }
129
130