| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O -g -fdump-tree-backprop-details" } */ |
| 3 |
|
| 4 |
/* Test a loop that does both a multiplication and addition. The addition |
| 5 |
should prevent any sign ops from being removed. */ |
| 6 |
#define TEST_FUNCTION(TYPE, SUFFIX) \ |
| 7 |
TYPE \ |
| 8 |
test##SUFFIX (TYPE x, TYPE y, TYPE *array, int n) \ |
| 9 |
{ \ |
| 10 |
x = __builtin_copysign##SUFFIX (x, y); \ |
| 11 |
for (int i = 0; i < n; ++i) \ |
| 12 |
x = (x + 1) * array[i]; \ |
| 13 |
return __builtin_hypot##SUFFIX (x, y); \ |
| 14 |
} |
| 15 |
|
| 16 |
TEST_FUNCTION (float, f) |
| 17 |
TEST_FUNCTION (double, ) |
| 18 |
TEST_FUNCTION (long double, l) |
| 19 |
|
| 20 |
/* { dg-final { scan-tree-dump-times {Deleting[^\n]* = __builtin_copysign} 0 "backprop" } } */ |