2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-22.c
blob369fab112e5a5f902eddc828be8a656e5952672a
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_float } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 64
9 int ia[N];
10 int ib[N]=
11 {1,1,0,0,1,0,1,0,
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};
20 signed char ca[N];
21 signed char cb[N] =
22 {1,1,0,0,1,0,1,0,
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};
31 short sa[N];
32 short sb[N] =
33 {1,1,0,0,1,0,1,0,
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};
42 float fa[N];
43 float fb[N] =
44 {1,1,0,0,1,0,1,0,
45 1,1,0,0,1,0,1,0,
46 1,1,0,0,1,0,1,0,
47 1,1,0,0,1,0,1,0,
48 1,1,0,0,1,0,1,0,
49 1,1,0,0,1,0,1,0,
50 1,1,0,0,1,0,1,0,
51 1,1,0,0,1,0,1,0};
53 __attribute__ ((noinline)) int
54 main1 ()
56 int i;
57 /* Check ints. */
59 for (i = 0; i < N; i++)
61 ia[i] = -ib[i];
64 /* check results: */
65 for (i = 0; i <N; i++)
67 if (ia[i] != -ib[i])
68 abort ();
71 /* Check chars. */
73 for (i = 0; i < N; i++)
75 ca[i] = -cb[i];
78 /* check results: */
79 for (i = 0; i <N; i++)
81 if (ca[i] != -cb[i])
82 abort ();
85 /* Check shorts. */
87 for (i = 0; i < N; i++)
89 sa[i] = -sb[i];
92 /* check results: */
93 for (i = 0; i <N; i++)
95 if (sa[i] != -sb[i])
96 abort ();
99 /* Check floats. */
101 for (i = 0; i < N; i++)
103 fa[i] = -fb[i];
106 /* check results: */
107 for (i = 0; i <N; i++)
109 if (fa[i] != -fb[i])
110 abort ();
113 return 0;
116 int main (void)
118 check_vect ();
120 return main1 ();
123 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
124 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
126 /* { dg-final { cleanup-tree-dump "vect" } } */