OSDN Git Service

* gcc.dg/vect/costmodel/ppc/costmodel-vect-outer-fir.c: Add
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-7.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5 #include <stdio.h>
6
7 #define N 64
8
9 #define DOT1 43680
10 #define DOT2 -20832
11
12 signed short X[N] __attribute__ ((__aligned__(16)));
13 signed short Y[N] __attribute__ ((__aligned__(16)));
14 unsigned char CX[N] __attribute__ ((__aligned__(16)));
15
16 __attribute__ ((noinline)) void
17 foo1(int len) {
18   int i;
19   int result1 = 0;
20   short prod;
21
22   for (i=0; i<len; i++) {
23     result1 += (X[i] * Y[i]);
24     CX[i] = 5;
25   }
26
27   if (result1 != DOT1)
28     abort ();
29 }
30
31
32 int main (void)
33 {
34   int i, dot1, dot2;
35
36   check_vect ();
37
38   for (i=0; i<N; i++) {
39     X[i] = i;
40     Y[i] = 64-i;
41     CX[i] = i;
42   }
43
44   foo1 (N);
45
46   return 0;
47 }
48
49 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_hi } } } */
50 /* { dg-final { cleanup-tree-dump "vect" } } */
51