(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
slsr-31.c
       1  /* Verify straight-line strength reduction for add candidates in
       2     which the stride is unknown and increments appear that differ
       3     only in sign.  Verify the increments are shared.  */
       4  
       5  /* { dg-do compile } */
       6  /* { dg-options "-O3 -fdump-tree-optimized" } */
       7  
       8  int
       9  f (int s, int c)
      10  {
      11    int a1, a2, a3, a4, x1, x2, x3, x4, x;
      12  
      13    a1 = 2 * s;
      14    x1 = c + a1;
      15    a2 = 4 * s;  /* incr = +2  */
      16    x2 = c + a2;
      17    a3 = 7 * s;
      18    x3 = c + a3;
      19    a4 = 5 * s;  /* incr = -2  */
      20    x4 = c + a4;
      21    x = x1 + x2 + x3 + x4;
      22    return x;
      23  }
      24  
      25  /* { dg-final { scan-tree-dump-times " \\* 2" 1 "optimized" } } */
      26  /* { dg-final { scan-tree-dump-times " \\* -2" 0 "optimized" } } */