1 /* { dg-require-effective-target vect_int_mult } */
2 /* { dg-require-effective-target whole_vector_shift } */
3 
4 /* Write a reduction loop to be reduced using vector shifts.  */
5 
6 #include "tree-vect.h"
7 
8 extern void abort(void);
9 
10 unsigned char in[16];
11 
12 int
main(unsigned char argc,char ** argv)13 main (unsigned char argc, char **argv)
14 {
15   unsigned char i = 0;
16   unsigned char sum = 1;
17 
18   check_vect ();
19 
20   for (i = 0; i < 16; i++)
21     in[i] = i + i + 1;
22 
23   /* Prevent constant propagation of the entire loop below.  */
24   asm volatile ("" : : : "memory");
25 
26   for (i = 0; i < 16; i++)
27     sum *= in[i];
28 
29   if (sum != 33)
30     {
31       __builtin_printf("Failed %d\n", sum);
32       abort();
33     }
34 
35   return 0;
36 }
37 
38 /* { dg-final { scan-tree-dump "Reduce using vector shifts" "vect" } } */
39 
40