Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-reduc-or_1.c

raw
1 /* Write a reduction loop to be reduced using vector shifts. */
2
3 #include "tree-vect.h"
4
5 #if VECTOR_BITS > 128
6 #define N (VECTOR_BITS / 8)
7 #else
8 #define N 16
9 #endif
10
11 extern void abort(void);
12
13 unsigned char in[N] __attribute__((__aligned__(16)));
14
15 int
16 main (unsigned char argc, char **argv)
17 {
18 unsigned char i = 0;
19 unsigned char sum = 1;
20 unsigned char expected = 1;
21
22 check_vect ();
23
24 for (i = 0; i < N; i++)
25 {
26 in[i] = (i + i + 1) & 0xfd;
27 asm volatile ("" ::: "memory");
28 }
29
30 for (i = 0; i < N; i++)
31 {
32 expected |= in[i];
33 asm volatile ("" ::: "memory");
34 }
35
36 for (i = 0; i < N; i++)
37 sum |= in[i];
38
39 if (sum != expected)
40 {
41 __builtin_printf("Failed %d\n", sum);
42 abort();
43 }
44
45 return 0;
46 }
47
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 } } } */