| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -funsafe-math-optimizations -ftrapping-math -fdump-tree-recip -fdump-tree-lim2 --param=ranger-recompute-depth=1" } */ |
| 3 |
/* { dg-warning "'-fassociative-math' disabled" "" { target *-*-* } 0 } */ |
| 4 |
/* ranger-recompute-depth prevents the optimizers from being too smart. */ |
| 5 |
|
| 6 |
double F[2] = { 0., 0. }, e = 0.; |
| 7 |
|
| 8 |
int main() |
| 9 |
{ |
| 10 |
int i; |
| 11 |
double E, W, P, d; |
| 12 |
|
| 13 |
/* make sure the program crashes on FP exception */ |
| 14 |
unsigned short int Mask; |
| 15 |
|
| 16 |
W = 1.; |
| 17 |
d = 2.*e; |
| 18 |
E = 1. - d; |
| 19 |
|
| 20 |
for( i=0; i < 2; i++ ) |
| 21 |
if( d > 0.01 ) |
| 22 |
{ |
| 23 |
P = ( W < E ) ? (W - E)/d : (E - W)/d; |
| 24 |
F[i] += P; |
| 25 |
} |
| 26 |
|
| 27 |
return 0; |
| 28 |
} |
| 29 |
|
| 30 |
/* LIM only performs the transformation in the no-trapping-math case. In |
| 31 |
the future we will do it for trapping-math as well in recip, check that |
| 32 |
this is not wrongly optimized. */ |
| 33 |
/* { dg-final { scan-tree-dump-not "reciptmp" "lim2" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-not "reciptmp" "recip" } } */ |
| 35 |
|