PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-u16a.c
blob4bf4a1e3c2cd328dc19e99964c1df54a1f5d6c54
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__(__BIGGEST_ALIGNMENT__)));
12 unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
14 /* short->short->int dot product.
15 Not detected as a dot-product pattern.
16 Requires support for non-widneing multiplication and widening-summation. */
17 __attribute__ ((noinline)) unsigned int
18 foo1(int len) {
19 int i;
20 unsigned int result = 0;
21 unsigned short prod;
23 for (i=0; i<len; i++) {
24 prod = X[i] * Y[i];
25 result += prod;
27 return result;
30 int main (void)
32 unsigned int dot1;
33 unsigned short i;
35 check_vect ();
37 for (i=0; i<N; i++) {
38 X[i] = i;
39 Y[i] = 64-i;
42 dot1 = foo1 (N);
43 if (dot1 != DOT1)
44 abort ();
46 return 0;
49 /* The initialization loop in main also gets vectorized. */
50 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" { xfail *-*-* } } } */
51 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { vect_short_mult && vect_widen_sum_hi_to_si } } } } */