* tree-loop-distribution.c (INCLUDE_ALGORITHM): New header file.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / backprop-6.c
blob31f05716f1498dc709cac95fa20fb5796642c77e
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-backprop-details" } */
4 void start (void *);
5 void end (void *);
7 /* Test that we optimize the contents of infinite loops. */
8 #define TEST_FUNCTION(TYPE, SUFFIX) \
9 void \
10 test##SUFFIX (TYPE *array, TYPE y, int n) \
11 { \
12 for (;;) \
13 { \
14 start (array); \
15 TYPE x = -__builtin_fabs##SUFFIX (array[-1]); \
16 for (int i = 0; i < n; ++i) \
17 x = -x / array[i]; \
18 array[-1] = x * x; \
19 array[-2] = __builtin_fma##SUFFIX (x, x, y); \
20 array[-3] = __builtin_pow##SUFFIX (x, 20); \
21 end (array); \
22 } \
25 TEST_FUNCTION (float, f)
26 TEST_FUNCTION (double, )
27 TEST_FUNCTION (long double, l)
29 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 6 "backprop" } } */
30 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = ABS_EXPR <} 3 "backprop" } } */