PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / backprop-4.c
blob54355009c744ec4f2e7463c7e37cc09c188e9239
1 /* { dg-do compile } */
2 /* { dg-options "-O -g -fdump-tree-backprop-details" } */
4 /* Test a simple reduction loop in which all inputs are sign ops and
5 the consumer doesn't care about the sign. */
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 *= -array[i]; \
13 return __builtin_hypot##SUFFIX (x, y); \
16 TEST_FUNCTION (float, f)
17 TEST_FUNCTION (double, )
18 TEST_FUNCTION (long double, l)
20 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = __builtin_copysign} 3 "backprop" } } */
21 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 3 "backprop" } } */