libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-20.c
blobe3e648370134c07f585bff10a108a095ecb5d26e
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-add-options bind_pic_locally } */
3 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 64
10 int ia[N];
11 int ib[N]=
12 {1,1,0,0,1,0,1,0,
13 1,1,0,0,1,0,1,0,
14 1,1,0,0,1,0,1,0,
15 1,1,0,0,1,0,1,0,
16 1,1,0,0,1,0,1,0,
17 1,1,0,0,1,0,1,0,
18 1,1,0,0,1,0,1,0,
19 1,1,0,0,1,0,1,0};
21 signed char ca[N];
22 signed char cb[N] =
23 {1,1,0,0,1,0,1,0,
24 1,1,0,0,1,0,1,0,
25 1,1,0,0,1,0,1,0,
26 1,1,0,0,1,0,1,0,
27 1,1,0,0,1,0,1,0,
28 1,1,0,0,1,0,1,0,
29 1,1,0,0,1,0,1,0,
30 1,1,0,0,1,0,1,0};
32 short sa[N];
33 short sb[N] =
34 {1,1,0,0,1,0,1,0,
35 1,1,0,0,1,0,1,0,
36 1,1,0,0,1,0,1,0,
37 1,1,0,0,1,0,1,0,
38 1,1,0,0,1,0,1,0,
39 1,1,0,0,1,0,1,0,
40 1,1,0,0,1,0,1,0,
41 1,1,0,0,1,0,1,0};
43 __attribute__ ((noinline)) int
44 main1 ()
46 int i;
48 /* Check ints. */
50 for (i = 0; i < N; i++)
52 ia[i] = ~ib[i];
55 /* check results: */
56 #pragma GCC novector
57 for (i = 0; i <N; i++)
59 if (ia[i] != ~ib[i])
60 abort ();
63 /* Check chars. */
65 for (i = 0; i < N; i++)
67 ca[i] = ~cb[i];
70 /* check results: */
71 #pragma GCC novector
72 for (i = 0; i <N; i++)
74 if (ca[i] != ~cb[i])
75 abort ();
78 /* Check shorts. */
80 for (i = 0; i < N; i++)
82 sa[i] = ~sb[i];
85 /* check results: */
86 #pragma GCC novector
87 for (i = 0; i <N; i++)
89 if (sa[i] != ~sb[i])
90 abort ();
93 return 0;
96 int main (void)
98 check_vect ();
100 return main1 ();
103 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_bitwise } } } */
104 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
105 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */