re PR tree-optimization/33291 (a+=2; a+=2 not simplified to a+=4; with -O3 ...
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / recip-4.c
1 /* { dg-do compile } */
2 /* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */
3
4 /* based on the test case in pr23109 */
5
6 double F[2] = { 0., 0. }, e = 0.;
7
8 /* Nope, we cannot prove the optimization is worthwhile in this case. */
9 void f ()
10 {
11 int i;
12 double E, W, P, d;
13
14 W = 1.;
15 d = 2.*e;
16 E = 1. - d;
17
18 if( d > 0.01 )
19 {
20 P = ( W < E ) ? (W - E)/d : (E - W)/d;
21 F[i] += P;
22 }
23 }
24
25 /* We also cannot prove the optimization is worthwhile in this case. */
26 float g ()
27 {
28 int i;
29 double E, W, P, d;
30
31 W = 1.;
32 d = 2.*e;
33 E = 1. - d;
34
35 if( d > 0.01 )
36 {
37 P = ( W < E ) ? (W - E)/d : (E - W)/d;
38 F[i] += P;
39 }
40
41 return 1.0 / d;
42 }
43
44 /* { dg-final { scan-tree-dump-not "reciptmp" "recip" } } */
45 /* { dg-final { cleanup-tree-dump "recip" } } */