Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-22.c

raw
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_float } */
3 /* { dg-add-options bind_pic_locally } */
4 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
5
6 #include <stdarg.h>
7 #include "tree-vect.h"
8
9 #define N 64
10
11 int ia[N];
12 int ib[N]=
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,
20 1,1,0,0,1,0,1,0};
21
22 signed char ca[N];
23 signed char cb[N] =
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,
31 1,1,0,0,1,0,1,0};
32
33 short sa[N];
34 short sb[N] =
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,
42 1,1,0,0,1,0,1,0};
43
44 float fa[N];
45 float fb[N] =
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,
52 1,1,0,0,1,0,1,0,
53 1,1,0,0,1,0,1,0};
54
55 __attribute__ ((noinline)) int
56 main1 ()
57 {
58 int i;
59 /* Check ints. */
60
61 for (i = 0; i < N; i++)
62 {
63 ia[i] = -ib[i];
64 }
65
66 /* check results: */
67 #pragma GCC novector
68 for (i = 0; i <N; i++)
69 {
70 if (ia[i] != -ib[i])
71 abort ();
72 }
73
74 /* Check chars. */
75
76 for (i = 0; i < N; i++)
77 {
78 ca[i] = -cb[i];
79 }
80
81 /* check results: */
82 #pragma GCC novector
83 for (i = 0; i <N; i++)
84 {
85 if (ca[i] != -cb[i])
86 abort ();
87 }
88
89 /* Check shorts. */
90
91 for (i = 0; i < N; i++)
92 {
93 sa[i] = -sb[i];
94 }
95
96 /* check results: */
97 #pragma GCC novector
98 for (i = 0; i <N; i++)
99 {
100 if (sa[i] != -sb[i])
101 abort ();
102 }
103
104 /* Check floats. */
105
106 for (i = 0; i < N; i++)
107 {
108 fa[i] = -fb[i];
109 }
110
111 /* check results: */
112 #pragma GCC novector
113 for (i = 0; i <N; i++)
114 {
115 if (fa[i] != -fb[i])
116 abort ();
117 }
118
119 return 0;
120 }
121
122 int main (void)
123 {
124 check_vect ();
125
126 return main1 ();
127 }
128
129 /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
130 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
131
132 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */