Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / O3-slp-reduc-10.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 128
7 #define TYPE int
8 #define RESULT 755918
9
10 __attribute__ ((noinline)) TYPE fun2 (TYPE *x, TYPE *y, unsigned int n)
11 {
12   int i, j;
13   TYPE dot = 14;
14
15   for (i = 0; i < n / 2; i++)
16     for (j = 0; j < 2; j++)
17       dot += *(x++) * *(y++);
18
19   return dot;
20 }
21
22 int main (void)
23 {
24   TYPE a[N], b[N], dot;
25   int i;
26
27   check_vect ();
28
29   for (i = 0; i < N; i++)
30     {
31       a[i] = i;
32       b[i] = i+8;
33     }
34
35   dot = fun2 (a, b, N);
36   if (dot != RESULT)
37     abort();
38
39   return 0;
40 }
41
42 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { vect_int_mult && {! vect_no_align } } } } } */
43 /* { dg-final { cleanup-tree-dump "vect" } } */