(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr102232.c
       1  /* PR tree-optimization/102232 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O -fdump-tree-optimized" } */
       4  
       5  int __attribute__ ((noipa)) foo (int a, int b)
       6  {
       7    return b * (1 + a / b) - a;
       8  }
       9  
      10  int
      11  main (void)
      12  {
      13    // few randomly generated test cases
      14    if (foo (71856034, 238) != 212)
      15      {
      16        __builtin_abort ();
      17      }
      18    if (foo (71856034, 10909) != 1549)
      19      {
      20        __builtin_abort ();
      21      }
      22    if (foo (20350, 1744) != 578)
      23      {
      24        __builtin_abort ();
      25      }
      26    if (foo (444813, 88563) != 86565)
      27      {
      28        __builtin_abort ();
      29      }
      30    if (foo (112237, 63004) != 13771)
      31      {
      32        __builtin_abort ();
      33      }
      34    if (foo (68268386, 787116) != 210706)
      35      {
      36        __builtin_abort ();
      37      }
      38    if (foo (-444813, 88563) != 90561)
      39      {
      40        __builtin_abort ();
      41      }
      42    if (foo (-68268386, 787116) != 1363526)
      43      {
      44        __builtin_abort ();
      45      }
      46  
      47    return 0;
      48  }
      49  
      50  /* Verify that multiplication and division has been removed.  */
      51  /* { dg-final { scan-tree-dump-not " \\* " "optimized" } } */
      52  /* { dg-final { scan-tree-dump-not " / " "optimized" } } */