annotate gcc/testsuite/gcc.dg/tree-ssa/pr23234.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* The problem in this PR was mostly finding a suitable place to insert
kono
parents:
diff changeset
2 the reciprocals of the function arguments. This test case tries to
kono
parents:
diff changeset
3 test three possible ways of how this may go wrong. */
kono
parents:
diff changeset
4 /* { dg-options "-O2 -ffast-math" } */
kono
parents:
diff changeset
5 /* { dg-do compile } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 /* The original test case. */
kono
parents:
diff changeset
8 double
kono
parents:
diff changeset
9 f1 (double a, double b, double c)
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 double y0;
kono
parents:
diff changeset
12 double y1;
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 if (a == 0.0)
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 y0 = -c / b;
kono
parents:
diff changeset
17 return y0;
kono
parents:
diff changeset
18 }
kono
parents:
diff changeset
19 y0 = c / b;
kono
parents:
diff changeset
20 y1 = a / b;
kono
parents:
diff changeset
21 return y0 * y1;
kono
parents:
diff changeset
22 }
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* Labels may end up in the middle of a block. Also bad. */
kono
parents:
diff changeset
25 double
kono
parents:
diff changeset
26 f2 (double a, double b, double c)
kono
parents:
diff changeset
27 {
kono
parents:
diff changeset
28 double y0;
kono
parents:
diff changeset
29 double y1;
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 a_label:
kono
parents:
diff changeset
32 another_label:
kono
parents:
diff changeset
33 if (a == 0.0)
kono
parents:
diff changeset
34 {
kono
parents:
diff changeset
35 y0 = -c / b;
kono
parents:
diff changeset
36 return y0;
kono
parents:
diff changeset
37 }
kono
parents:
diff changeset
38 y0 = c / b;
kono
parents:
diff changeset
39 y1 = a / b;
kono
parents:
diff changeset
40 return y0 * y1;
kono
parents:
diff changeset
41 }
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 /* Uses must still be dominated by their defs. */
kono
parents:
diff changeset
44 double
kono
parents:
diff changeset
45 f3 (double a, double b, double c)
kono
parents:
diff changeset
46 {
kono
parents:
diff changeset
47 double y0;
kono
parents:
diff changeset
48 double y1;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 y0 = -c / b;
kono
parents:
diff changeset
51 if (a == 0.0)
kono
parents:
diff changeset
52 {
kono
parents:
diff changeset
53 return y0;
kono
parents:
diff changeset
54 }
kono
parents:
diff changeset
55 y0 = c / b;
kono
parents:
diff changeset
56 y1 = a / b;
kono
parents:
diff changeset
57 return y0 * y1;
kono
parents:
diff changeset
58 }