summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-98-big-array.c
blob: 0528d43b807bf621086f2a37ab2ba4a4f203dc1f (plain)
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
53
54
55
56
57
/* { dg-require-effective-target vect_int } */

#include <stdarg.h>
#include "tree-vect.h"

#define N 16
#define DOT16( a, b)   ( a[0]*b[0]   + a[1]*b[1]   + a[2]*b[2]   + a[3]*b[3] + \
			 a[4]*b[4]   + a[5]*b[5]   + a[6]*b[6]   + a[7]*b[7] + \
			 a[8]*b[8]   + a[9]*b[9]   + a[10]*b[10] + a[11]*b[11] + \
			 a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15])

volatile int y = 0;

__attribute__ ((noinline))
int main1 (int ia[][N])
{
  int i, j;
  int ib[N] = {0,3,6,9};
  int ic[N][N];

  for (i = 0; i < N; i++)
    {
	ic[0][i] = DOT16 (ia[i], ib);
    }

  /* check results: */
  for (i = 0; i < N; i++)
    {
       if (ic[0][i] != DOT16 (ia[i], ib))
           abort ();
    }

  return 0;
}

int main (void)
{
  int ia[N][N];
  int i,j;
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      {
        ia[i][j] = i + j + 1;
	/* Avoid vectorization.  */
	if (y)
	  abort ();
      }

  check_vect ();

  return main1 (ia);
}

/* Needs interleaving support.  */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided4 } } } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { xfail  vect_strided4 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */