summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c
blob: 6b14e3bf5901911716281379df9f9ed324cc6756 (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
/* { dg-require-effective-target vect_int_mult } */

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

#define K 4 

int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int out[K];
int check_result[K] = {0,16,256,4096};

__attribute__ ((noinline)) void 
foo ()
{
  int sum;
  int i, j, k;

  for (k = 0; k < K; k++)
    {
      sum = 1;
      for (j = 0; j < K; j++) 
        for (i = 0; i < K; i++)
          sum *= in[i+k][j];
      out[k] = sum;
    }
}

int main ()
{
  int i, j, k;

  check_vect ();

  for (i = 0; i < 2*K; i++)
    for (j = 0; j < K; j++)
      in[i][j] = (i+2)/3;

  foo();

  for (k = 0; k < K; k++)
    if (out[k] != check_result[k])
      abort ();

  return 0;
}
        
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */