File: pr61743-2.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (52 lines) | stat: -rw-r--r-- 1,229 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* { dg-do compile } */
/* { dg-options "-O3 -funroll-loops -fno-tree-vectorize -fdump-tree-cunroll-details -fno-peel-loops" } */

#define N 8
#define M 14
typedef unsigned char e_u8;
e_u8 x[256];
#define MAX(a,b) ((a)>=(b)?(a):(b))
#define btype e_u8

static inline void bar1(e_u8 a[4][N], e_u8 b[4][N], btype n)
{
  int i, j;

  for(i = 0; i < 4; i++)
    for(j = 0; j < n; j++)
      a[i][j] ^= b[i][j];
}

static inline void bar2(e_u8 a[4][N], e_u8 b[256], btype n)
{
  int i, j;

  for(i = 0; i < 4; i++)
    for(j = 0; j < n; j++)
      a[i][j] = b[a[i][j]] ;
}

int foo1 (e_u8 a[4][N], int b1, int b2, e_u8 b[M+1][4][N])
{
  btype n;
  int r, m;

  switch (b2) {
    case 128: n = 4; break;
    case 192: n = 6; break;
    case 256: n = 8; break;
    default : return (-2);
  }
  switch (MAX(b1,b2)) {
    case 128: m = 10; break;
    case 192: m = 12; break;
    case 256: m = 14; break;
    default : return (-3);
  }
  bar1(a,b[m],n);
  bar2(a,x,n);
  return 0;
}

/* { dg-final { scan-tree-dump-times "loop with 3 iterations completely unrolled" 2 "cunroll" } } */
/* { dg-final { scan-tree-dump-times "loop with 7 iterations completely unrolled" 2 "cunroll" } } */