* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-s16.c
blobddffc109d35f82b075e0adaefd701cbcc798b3ca
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.
15 Not detected as a dot-product pattern.
16 Currently fails to be vectorized due to presence of type conversions. */
17 int
18 foo1(int len) {
19 int i;
20 int result = 0;
21 short prod;
23 for (i=0; i<len; i++) {
24 prod = X[i] * Y[i];
25 result += prod;
27 return result;
30 /* short->int->int dot product.
31 Detected as a dot-product pattern.
32 Vectorized on targets that support dot-product for signed shorts. */
33 int
34 foo2(int len) {
35 int i;
36 int result = 0;
38 for (i=0; i<len; i++) {
39 result += (X[i] * Y[i]);
41 return result;
45 int main (void)
47 int i, dot1, dot2;
49 check_vect ();
51 for (i=0; i<N; i++) {
52 X[i] = i;
53 Y[i] = 64-i;
56 dot1 = foo1 (N);
57 if (dot1 != DOT1)
58 abort ();
60 dot2 = foo2 (N);
61 if (dot2 != DOT2)
62 abort ();
64 return 0;
67 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 1 "vect" } } */
68 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_hi } } } */
69 /* { dg-final { cleanup-tree-dump "vect" } } */