(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr96779.c
       1  /* PR tree-optimization/96779 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O -fdump-tree-optimized" } */
       4  
       5  #include <stdbool.h>
       6  
       7  bool __attribute__ ((noipa)) f_func(int a)
       8  {
       9      return -a == a;
      10  }
      11  
      12  bool __attribute__ ((noipa)) h_func(short a)
      13  {
      14      return -a == a;
      15  }
      16  
      17  bool __attribute__ ((noipa)) k_func(long a)
      18  {
      19      return -a == a;
      20  }
      21  
      22  int
      23  main (void)
      24  {
      25    // few randomly generated test cases
      26    if (f_func (71856034))
      27      {
      28        __builtin_abort ();
      29      }
      30    if (f_func (71856034))
      31      {
      32        __builtin_abort ();
      33      }
      34    if (h_func (1744))
      35      {
      36        __builtin_abort ();
      37      }
      38    if (k_func (68268386))
      39      {
      40        __builtin_abort ();
      41      }
      42    if (f_func (-112237))
      43      {
      44        __builtin_abort ();
      45      }
      46    if (f_func (-787116))
      47      {
      48        __builtin_abort ();
      49      }
      50    if (h_func (-863))
      51      {
      52        __builtin_abort ();
      53      }
      54    if (k_func (-787116))
      55      {
      56        __builtin_abort ();
      57      }
      58    if (!f_func (0))
      59      {
      60        __builtin_abort ();
      61      }
      62    if (!f_func (0))
      63      {
      64        __builtin_abort ();
      65      }
      66    if (!h_func (0))
      67      {
      68        __builtin_abort ();
      69      }
      70    if (!k_func (0))
      71      {
      72        __builtin_abort ();
      73      }
      74  
      75    return 0;
      76  }
      77  
      78  /* Verify that we transfered to "= -" pattern from "_2 = -_1;".  */
      79  /* { dg-final { scan-tree-dump-not "= -" "optimized" } } */