libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-dot-u16b.c
blob6660888c7c5253f92e819772defdb442553f62fb
1 /* Disabling epilogues until we find a better way to deal with scans. */
2 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
3 /* { dg-require-effective-target vect_int } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 64
10 #define DOT2 43680
12 unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
13 unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
15 /* ushort->int->uint dot product: the multiplication promotes the ushorts
16 to int, and then the product is converted to uint for the addition. */
17 __attribute__ ((noinline)) unsigned int
18 foo2(int len) {
19 int i;
20 unsigned int result = 0;
22 for (i=0; i<len; i++) {
23 result += (X[i] * Y[i]);
25 return result;
29 int main (void)
31 unsigned int dot2;
32 int i;
34 check_vect ();
36 for (i=0; i<N; i++) {
37 X[i] = i;
38 Y[i] = 64-i;
39 __asm__ volatile ("");
42 dot2 = foo2 (N);
43 if (dot2 != DOT2)
44 abort ();
46 return 0;
49 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target { vect_pack_trunc || vect_udot_hi } } } } */
51 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_pack_trunc || vect_udot_hi } } } } */