(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr92734-2.c
       1  /* PR tree-optimization/92734 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -fdump-tree-optimized" } */
       4  /* Verify there are no binary additions or subtractions left.  There can
       5     be just casts and negations.  */
       6  /* { dg-final { scan-tree-dump-not " \[+-] " "optimized" } } */
       7  
       8  int
       9  f1 (int x, unsigned y)
      10  {
      11    int a = x + y;
      12    return a - x;
      13  }
      14  
      15  unsigned
      16  f2 (unsigned x, int y)
      17  {
      18    unsigned a = (int) x + y;
      19    return a - x;
      20  }
      21  
      22  int
      23  f3 (int x, unsigned y)
      24  {
      25    int a = x - y;
      26    return a - x;
      27  }
      28  
      29  unsigned
      30  f4 (unsigned x, int y)
      31  {
      32    unsigned a = (int) x - y;
      33    return a - x;
      34  }
      35  
      36  int
      37  f5 (unsigned x, int y)
      38  {
      39    int a = x - y;
      40    return a + y;
      41  }
      42  
      43  unsigned
      44  f6 (int x, unsigned y)
      45  {
      46    unsigned a = x - (int) y;
      47    return a + y;
      48  }
      49  
      50  int
      51  f7 (int x, unsigned y)
      52  {
      53    int a = x + y;
      54    return x - a;
      55  }
      56  
      57  unsigned
      58  f8 (unsigned x, int y)
      59  {
      60    unsigned a = (int) x + y;
      61    return x - a;
      62  }
      63  
      64  int
      65  f9 (int x, unsigned y)
      66  {
      67    int a = x - y;
      68    return x - a;
      69  }
      70  
      71  unsigned
      72  f10 (unsigned x, int y)
      73  {
      74    unsigned a = (int) x - y;
      75    return x - a;
      76  }