Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-s16.c
blob4d2fc200b63c70fd997b6ad679c267dd074551cd
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 #define DOT1 43680
9 #define DOT2 43680
11 signed short X[N] __attribute__ ((__aligned__(16)));
12 signed short Y[N] __attribute__ ((__aligned__(16)));
14 /* short->short->int dot product. Not vectorized. */
15 int
16 foo1(int len) {
17 int i;
18 int result = 0;
19 short prod;
21 for (i=0; i<len; i++) {
22 prod = X[i] * Y[i];
23 result += prod;
25 return result;
28 /* short->int->int dot product. Vectorized on ppc. */
29 int
30 foo2(int len) {
31 int i;
32 int result = 0;
34 for (i=0; i<len; i++) {
35 result += (X[i] * Y[i]);
37 return result;
41 int main (void)
43 int i, dot1, dot2;
45 check_vect ();
47 for (i=0; i<N; i++) {
48 X[i] = i;
49 Y[i] = 64-i;
52 dot1 = foo1 (N);
53 if (dot1 != DOT1)
54 abort ();
56 dot2 = foo2 (N);
57 if (dot2 != DOT2)
58 abort ();
60 return 0;
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target powerpc*-*-* } } } */
64 /* { dg-final { cleanup-tree-dump "vect" } } */