(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr96708-positive.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O -fdump-tree-optimized" } */
       3  
       4  #include <stdbool.h>
       5  
       6  bool __attribute__ ((noinline))
       7  test1(int a, int b)
       8  {
       9      int tmp = (a < b) ? b : a;
      10      return tmp >= a;
      11  }
      12  
      13  bool __attribute__ ((noinline))
      14  test2(int a, int b)
      15  {
      16      int tmp = (a < b) ? b : a;
      17      return tmp < a;
      18  }
      19  
      20  bool __attribute__ ((noinline))
      21  test3(int a, int b)
      22  {
      23      int tmp = (a > b) ? b : a;
      24      return tmp <= a;
      25  }
      26  
      27  bool __attribute__ ((noinline))
      28  test4(int a, int b)
      29  {
      30      int tmp = (a > b) ? b : a;
      31      return tmp > a;
      32  }
      33  
      34  int main()
      35  {
      36      if (!test1 (1, 2) || !test1 (2, 1) || 
      37          test2 (1, 2) || test2 (2, 1) ||
      38          !test3 (1, 2) || !test3 (2, 1) ||
      39          test4 (1, 2) || test4 (2, 1)) {
      40          __builtin_abort();	
      41      }
      42      return 0;
      43  }
      44  
      45  /* { dg-final { scan-tree-dump-times "return 0;" 3 "optimized" } } */
      46  /* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" } } */
      47  /* { dg-final { scan-tree-dump-not { "MAX_EXPR" } "optimized" } } */
      48  /* { dg-final { scan-tree-dump-not { "MIN_EXPR" } "optimized" } } */