2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / backprop-1.c
blob302fdb570b6383633e50893b947442a51fa2f87e
1 /* { dg-do compile } */
2 /* { dg-options "-O -g -fdump-tree-backprop-details" } */
4 /* Test a simple case of non-looping code in which both uses ignore
5 the sign and both definitions are sign ops. */
6 #define TEST_FUNCTION(TYPE, SUFFIX) \
7 TYPE \
8 test##SUFFIX (TYPE x, int sel1, int sel2) \
9 { \
10 TYPE input = sel1 ? -x : __builtin_fabs##SUFFIX (x); \
11 if (sel2) \
12 return __builtin_cos##SUFFIX (input); \
13 else \
14 return __builtin_cosh##SUFFIX (input); \
17 TEST_FUNCTION (float, f)
18 TEST_FUNCTION (double, )
19 TEST_FUNCTION (long double, l)
21 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = -x} 3 "backprop" } } */
22 /* { dg-final { scan-tree-dump-times {Deleting[^\n]* = ABS_EXPR <x} 3 "backprop" } } */