(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr96928.c
       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" } } */
      12  
      13  int
      14  foo (int a)
      15  {
      16    return a < 0 ? ~a : a;
      17  }
      18  
      19  int
      20  bar (int a, int b)
      21  {
      22    return a < 0 ? ~b : b;
      23  }
      24  
      25  unsigned
      26  baz (int a, unsigned int b)
      27  {
      28    return a < 0 ? ~b : b;
      29  }
      30  
      31  unsigned
      32  qux (int a, unsigned int c)
      33  {
      34    return a >= 0 ? ~c : c;
      35  }
      36  
      37  int
      38  corge (int a, int b)
      39  {
      40    return a >= 0 ? b : ~b;
      41  }