| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -funsafe-math-optimizations -fdump-tree-gimple" } */ |
| 3 |
|
| 4 |
float f(float x) |
| 5 |
{ |
| 6 |
return x/2 + x/3; |
| 7 |
} |
| 8 |
|
| 9 |
float g(float x) |
| 10 |
{ |
| 11 |
return 2/x + 3/x; |
| 12 |
} |
| 13 |
|
| 14 |
float h(float x) |
| 15 |
{ |
| 16 |
return x/2 - x/3; |
| 17 |
} |
| 18 |
|
| 19 |
float i(float x) |
| 20 |
{ |
| 21 |
return 2/x - 3/x; |
| 22 |
} |
| 23 |
|
| 24 |
/* f and h should be turned into multiplications, |
| 25 |
the divisions in g and i should be grouped together. */ |
| 26 |
|
| 27 |
/* { dg-final { scan-tree-dump-times " \\* " 2 "gimple" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-times " / " 2 "gimple" } } */ |
| 29 |
|