(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr61743-1.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O3 -funroll-loops -fno-tree-vectorize -fdump-tree-cunroll-details -fdump-tree-cunrolli-details -fno-peel-loops" } */
       3  
       4  #define N 8
       5  #define M 14
       6  typedef unsigned char e_u8;
       7  e_u8 x[256];
       8  #define MAX(a,b) ((a)>=(b)?(a):(b))
       9  #define btype int
      10  
      11  static inline void bar1(e_u8 a[4][N], e_u8 b[4][N], btype n)
      12  {
      13    int i, j;
      14  
      15    for(i = 0; i < 4; i++)
      16      for(j = 0; j < n; j++)
      17        a[i][j] ^= b[i][j];
      18  }
      19  
      20  static inline void bar2(e_u8 a[4][N], e_u8 b[256], btype n)
      21  {
      22    int i, j;
      23  
      24    for(i = 0; i < 4; i++)
      25      for(j = 0; j < n; j++)
      26        a[i][j] = b[a[i][j]] ;
      27  }
      28  
      29  int foo1 (e_u8 a[4][N], int b1, int b2, e_u8 b[M+1][4][N])
      30  {
      31    btype n;
      32    int r, m;
      33  
      34    switch (b2) {
      35      case 128: n = 4; break;
      36      case 192: n = 6; break;
      37      case 256: n = 8; break;
      38      default : return (-2);
      39    }
      40    switch (MAX(b1,b2)) {
      41      case 128: m = 10; break;
      42      case 192: m = 12; break;
      43      case 256: m = 14; break;
      44      default : return (-3);
      45    }
      46    bar1(a,b[m],n);
      47    bar2(a,x,n);
      48    return 0;
      49  }
      50  
      51  /* { dg-final { scan-tree-dump-times "loop with 3 iterations completely unrolled" 2 "cunroll" } } */
      52  /* { dg-final { scan-tree-dump-times "loop with 7 iterations completely unrolled" 2 "cunroll" } } */
      53  /* { dg-final { scan-tree-dump-not "completely unrolled" "cunrolli" } } */