| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fno-trapping-math -funsafe-math-optimizations -fdump-tree-recip" } */ |
| 3 |
|
| 4 |
/* The recip pass has a threshold of 3 reciprocal operations before it attempts |
| 5 |
to optimize a sequence. With a FP enabled ranger, we eliminate one of them |
| 6 |
earlier, causing the pass to skip this optimization. */ |
| 7 |
/* { dg-additional-options "-fno-thread-jumps -fno-tree-dominator-opts" } */ |
| 8 |
|
| 9 |
double F[5] = { 0.0, 0.0 }, e; |
| 10 |
|
| 11 |
/* In this case the optimization is interesting. */ |
| 12 |
float h () |
| 13 |
{ |
| 14 |
int i; |
| 15 |
double E, W, P, d; |
| 16 |
|
| 17 |
W = 1.1; |
| 18 |
d = 2.*e; |
| 19 |
E = 1. - d; |
| 20 |
|
| 21 |
for( i=0; i < 5; i++ ) |
| 22 |
if( d > 0.01 ) |
| 23 |
{ |
| 24 |
P = ( W < E ) ? (W - E)/d : (E - W)/d; |
| 25 |
F[i] += P; |
| 26 |
} |
| 27 |
|
| 28 |
F[0] += E / d; |
| 29 |
} |
| 30 |
|
| 31 |
/* { dg-final { scan-tree-dump-times " / " 1 "recip" } } */ |