libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-or_1.c
blobdfbdce0aeecd3a9a9fbad7bbe75af595508493e4
1 /* Write a reduction loop to be reduced using vector shifts. */
3 #include "tree-vect.h"
5 #if VECTOR_BITS > 128
6 #define N (VECTOR_BITS / 8)
7 #else
8 #define N 16
9 #endif
11 extern void abort(void);
13 unsigned char in[N] __attribute__((__aligned__(16)));
15 int
16 main (unsigned char argc, char **argv)
18 unsigned char i = 0;
19 unsigned char sum = 1;
20 unsigned char expected = 1;
22 check_vect ();
24 for (i = 0; i < N; i++)
26 in[i] = (i + i + 1) & 0xfd;
27 asm volatile ("" ::: "memory");
30 for (i = 0; i < N; i++)
32 expected |= in[i];
33 asm volatile ("" ::: "memory");
36 for (i = 0; i < N; i++)
37 sum |= in[i];
39 if (sum != expected)
41 __builtin_printf("Failed %d\n", sum);
42 abort();
45 return 0;
48 /* { dg-final { scan-tree-dump "Reduce using vector shifts" "vect" { target { whole_vector_shift && { ! vect_logical_reduc } } } } } */
49 /* { dg-final { scan-tree-dump "Reduce using direct vector reduction" "vect" { target vect_logical_reduc } } } */