(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
graphite/
interchange-2.c
       1  /* { dg-require-effective-target size32plus } */
       2  
       3  /* Formerly known as ltrans-2.c */
       4  
       5  #define DEBUG 0
       6  #if DEBUG
       7  #include <stdio.h>
       8  #endif
       9  
      10  double u[1782225];
      11  
      12  static void __attribute__((noinline))
      13  foo (int N, int *res)
      14  {
      15    unsigned int i, j;
      16    double sum = 0;
      17  
      18    /* This loop should be converted to a perfect nest and
      19       interchanged.  */
      20    for (i = 0; i < N; i++)
      21      {
      22        for (j = 0; j < N; j++)
      23  	{
      24  	  sum = sum + u[i + 1335 * j];
      25  	  if (j == N - 1)
      26  	    u[1336 * i] *= 2;
      27  	}
      28      }
      29  
      30    *res = sum + N + u[1336 * 2] + u[1336];
      31  }
      32  
      33  extern void abort ();
      34  
      35  int
      36  main (void)
      37  {
      38    int i, j, res;
      39  
      40    for (i = 0; i < 1782225; i++)
      41      u[i] = 2;
      42  
      43    foo (1335, &res);
      44  
      45  #if DEBUG
      46    fprintf (stderr, "res = %d \n", res);
      47  #endif
      48  
      49    if (res != 3565793)
      50      abort ();
      51  
      52    return 0;
      53  }
      54  
      55  /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */