c++: wrong error due to std::initializer_list opt [PR116476]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-1.c
blob4ee25f8d0f7291bbcbf2abd403d559f6807358e4
1 /* { dg-require-effective-target vect_int } */
3 #include "tree-vect.h"
5 #define N 50
7 #ifndef SIGNEDNESS_1
8 #define SIGNEDNESS_1 unsigned
9 #define SIGNEDNESS_2 unsigned
10 #define SIGNEDNESS_3 unsigned
11 #endif
13 SIGNEDNESS_1 int __attribute__ ((noipa))
14 f (SIGNEDNESS_1 int res, SIGNEDNESS_3 char *restrict a,
15 SIGNEDNESS_3 char *restrict b)
17 for (__INTPTR_TYPE__ i = 0; i < N; ++i)
19 int av = a[i];
20 int bv = b[i];
21 SIGNEDNESS_2 short mult = av * bv;
22 res += mult;
24 return res;
27 #define BASE ((SIGNEDNESS_3 int) -1 < 0 ? -126 : 4)
28 #define OFFSET 20
30 int
31 main (void)
33 check_vect ();
35 SIGNEDNESS_3 char a[N], b[N];
36 int expected = 0x12345;
37 for (int i = 0; i < N; ++i)
39 a[i] = BASE + i * 5;
40 b[i] = BASE + OFFSET + i * 4;
41 asm volatile ("" ::: "memory");
42 expected += (SIGNEDNESS_2 short) (a[i] * b[i]);
44 if (f (0x12345, a, b) != expected)
45 __builtin_abort ();
48 /* { dg-final { scan-tree-dump "vect_recog_dot_prod_pattern: detected" "vect" } } */
49 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" { target vect_sdot_qi } } } */