OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / pr23234.c
1 /* The problem in this PR was mostly finding a suitable place to insert
2    the reciprocals of the function arguments.  This test case tries to
3    test three possible ways of how this may go wrong.  */
4 /* { dg-options "-O2 -ffast-math" } */
5 /* { dg-do compile } */
6
7 /* The original test case.  */
8 double
9 f1 (double a, double b, double c)
10 {
11   double y0;
12
13   if (a == 0.0)
14     {
15       y0 = -c / b;
16       return y0;
17     }
18   y0 = c / b;
19   return y0;
20 }
21
22 /* Labels may end up in the middle of a block.  Also bad.  */
23 double
24 f2 (double a, double b, double c)
25 {
26   double y0;
27
28 a_label:
29 another_label:
30   if (a == 0.0)
31     {
32       y0 = -c / b;
33       return y0;
34     }
35   y0 = c / b;
36   return y0;
37 }
38
39 /* Uses must still be dominated by their defs.  */
40 double
41 f3 (double a, double b, double c)
42 {
43   double y0;
44
45   y0 = -c / b;
46   if (a == 0.0)
47     {
48       return y0;
49     }
50   y0 = c / b;
51   return y0;
52 }