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 "optimized" } } */
      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    if (a < 0)
      17      return ~a;
      18    return a;
      19  }
      20  
      21  int
      22  bar (int a, int b)
      23  {
      24    if (a < 0)
      25      return ~b;
      26    return b;
      27  }
      28  
      29  unsigned
      30  baz (int a, unsigned int b)
      31  {
      32    if (a < 0)
      33      return ~b;
      34    return b;
      35  }
      36  
      37  unsigned
      38  qux (int a, unsigned int c)
      39  {
      40    if (a >= 0)
      41      return ~c;
      42    return c;
      43  }
      44  
      45  int
      46  corge (int a, int b)
      47  {
      48    if (a >= 0)
      49      return b;
      50    return ~b;
      51  }