1 /* { dg-do compile } */ 2 /* { dg-options "-O -g -fdump-tree-backprop-details" } */ 3 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); \ 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} 3 "backprop" } } */ 21 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -} 3 "backprop" } } */ 22