2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-s8c.c
blob758886ef8adcb12c9609da7411e0fd9f08735320
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 #define DOT3 43680
10 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 /* char->int->int dot product.
14 Not detected as a dot-product pattern. */
15 __attribute__ ((noinline)) int
16 foo3(int len) {
17 int i;
18 int result = 0;
20 for (i=0; i<len; i++) {
21 result += (X[i] * Y[i]);
23 return result;
26 int main (void)
28 int i, dot3;
30 check_vect ();
32 for (i=0; i<N; i++) {
33 X[i] = i;
34 Y[i] = 64-i;
37 dot3 = foo3 (N);
38 if (dot3 != DOT3)
39 abort ();
41 return 0;
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */
45 /* { dg-final { cleanup-tree-dump "vect" } } */