| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -funswitch-loops -fno-thread-jumps -fdump-tree-unswitch-optimized" } */ |
| 3 |
|
| 4 |
int |
| 5 |
foo(double *a, double *b, double *c, double *d, double *r, int size, float order) |
| 6 |
{ |
| 7 |
for (int i = 0; i < size; i++) |
| 8 |
{ |
| 9 |
double tmp; |
| 10 |
|
| 11 |
if (order == 1.f) |
| 12 |
tmp = -8 * a[i]; |
| 13 |
else |
| 14 |
tmp = -4 * b[i]; |
| 15 |
|
| 16 |
double x = 3 * tmp + d[i] + tmp; |
| 17 |
|
| 18 |
if (order == 1.f) |
| 19 |
x += 2; |
| 20 |
|
| 21 |
double y = 3.4f * tmp + d[i]; |
| 22 |
r[i] = x + y; |
| 23 |
} |
| 24 |
|
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
/* { dg-final { scan-tree-dump-times "unswitching loop . on .if. with condition: order.* == 1.0e" 1 "unswitch" } } */ |