Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-u16.c
blobd66049286a3ca96c85aaa2d44ffbab3ccf77fc98
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 unsigned short X[N] __attribute__ ((__aligned__(16)));
12 unsigned short Y[N] __attribute__ ((__aligned__(16)));
14 /* short->short->int dot product. Not vectorized. */
15 /* ??? Is vectorized on i386. */
16 unsigned int
17 foo1(int len) {
18 int i;
19 unsigned int result = 0;
20 unsigned short prod;
22 for (i=0; i<len; i++) {
23 prod = X[i] * Y[i];
24 result += prod;
26 return result;
29 /* short->int->int dot product. Should be vectorized on ppc,
30 but for some reason currently the GIMPLE arguments are cast to int
31 instead of 'unsigned int'. */
32 /* ??? This is exactly correct. The multiplication promotes to int,
33 then is promoted to unsigned int for the addition. Which results
34 in an int->unsigned int cast, which since no bits are modified in
35 the cast should be trivially vectorizable. */
36 unsigned int
37 foo2(int len) {
38 int i;
39 unsigned int result = 0;
41 for (i=0; i<len; i++) {
42 result += (X[i] * Y[i]);
44 return result;
48 int main (void)
50 unsigned int dot1, dot2;
51 int i;
53 check_vect ();
55 for (i=0; i<N; i++) {
56 X[i] = i;
57 Y[i] = 64-i;
60 dot1 = foo1 (N);
61 if (dot1 != DOT1)
62 abort ();
64 dot2 = foo2 (N);
65 if (dot2 != DOT2)
66 abort ();
68 return 0;
71 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
72 /* { dg-final { cleanup-tree-dump "vect" } } */