libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr96928.c
blobe8fd82fc26ed25d77cdae577cc4fa9b857962525
1 /* PR tree-optimization/96928 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-phiopt2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */
5 /* The following check is done at optimized because a ^ (~b) is rewritten as ~(a^b)
6 and in the case of match.pd optimizing these ?:, the ~ is moved out already
7 by the time we get to phiopt2. */
8 /* { dg-final { scan-tree-dump-times "\\\^ c_\[0-9]*\\\(D\\\);" 1 "optimized" } } */
9 /* { dg-final { scan-tree-dump-times " = ~" 1 "phiopt2" } } */
10 /* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */
11 /* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */
13 int
14 foo (int a)
16 return a < 0 ? ~a : a;
19 int
20 bar (int a, int b)
22 return a < 0 ? ~b : b;
25 unsigned
26 baz (int a, unsigned int b)
28 return a < 0 ? ~b : b;
31 unsigned
32 qux (int a, unsigned int c)
34 return a >= 0 ? ~c : c;
37 int
38 corge (int a, int b)
40 return a >= 0 ? b : ~b;