Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/pr36224.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do run } */ | |
2 /* { dg-require-effective-target lp64 } */ | |
3 /* { dg-options "-O2 -ftree-vectorize" } */ | |
4 | |
5 #ifndef ALIGN16 | |
6 #define ALIGN16 __attribute__((__aligned__(32))) | |
7 #endif | |
8 | |
9 #define I16_B0 1 | |
10 #define I16_B1 23 | |
11 #define I16_B2 345 | |
12 #define I16_B3 6789 | |
13 #define I16_B4 1011 | |
14 #define I16_B5 -12 | |
15 #define I16_B6 1314 | |
16 #define I16_B7 -1516 | |
17 #define I16_B8 -1516 | |
18 #define I16_B9 1314 | |
19 #define I16_B10 -12 | |
20 #define I16_B11 1011 | |
21 #define I16_B12 6789 | |
22 #define I16_B13 345 | |
23 #define I16_B14 23 | |
24 #define I16_B15 1 | |
25 | |
26 #define I16_C0 2 | |
27 #define I16_C1 31567 | |
28 #define I16_C2 1112 | |
29 #define I16_C3 13 | |
30 #define I16_C4 14 | |
31 #define I16_C5 15 | |
32 #define I16_C6 -16 | |
33 #define I16_C7 17 | |
34 #define I16_C8 2 | |
35 #define I16_C9 31567 | |
36 #define I16_C10 1112 | |
37 #define I16_C11 13 | |
38 #define I16_C12 14 | |
39 #define I16_C13 15 | |
40 #define I16_C14 -16 | |
41 #define I16_C15 17 | |
42 | |
43 union ui2 { | |
44 int si[16]; | |
45 unsigned int ui[16]; | |
46 }; | |
47 | |
48 union us { | |
49 short ss[16]; | |
50 unsigned short us[16]; | |
51 }; | |
52 | |
53 static union ui2 i32_sa ALIGN16; | |
54 static union ui2 i32_ua ALIGN16; | |
55 | |
56 static union us i16_b ALIGN16 = { | |
57 (short)I16_B0, | |
58 (short)I16_B1, | |
59 (short)I16_B2, | |
60 (short)I16_B3, | |
61 (short)I16_B4, | |
62 (short)I16_B5, | |
63 (short)I16_B6, | |
64 (short)I16_B7, | |
65 (short)I16_B8, | |
66 (short)I16_B9, | |
67 (short)I16_B10, | |
68 (short)I16_B11, | |
69 (short)I16_B12, | |
70 (short)I16_B13, | |
71 (short)I16_B14, | |
72 (short)I16_B15, | |
73 }; | |
74 | |
75 static union us i16_c ALIGN16 = { | |
76 (short)I16_C0, | |
77 (short)I16_C1, | |
78 (short)I16_C2, | |
79 (short)I16_C3, | |
80 (short)I16_C4, | |
81 (short)I16_C5, | |
82 (short)I16_C6, | |
83 (short)I16_C7, | |
84 (short)I16_C8, | |
85 (short)I16_C9, | |
86 (short)I16_C10, | |
87 (short)I16_C11, | |
88 (short)I16_C12, | |
89 (short)I16_C13, | |
90 (short)I16_C14, | |
91 (short)I16_C15, | |
92 }; | |
93 | |
94 static long i32_sr[16] ALIGN16 = { | |
95 ((int)I16_B0) * ((int)I16_C0), | |
96 ((int)I16_B1) * ((int)I16_C1), | |
97 ((int)I16_B2) * ((int)I16_C2), | |
98 ((int)I16_B3) * ((int)I16_C3), | |
99 ((int)I16_B4) * ((int)I16_C4), | |
100 ((int)I16_B5) * ((int)I16_C5), | |
101 ((int)I16_B6) * ((int)I16_C6), | |
102 ((int)I16_B7) * ((int)I16_C7), | |
103 ((int)I16_B8) * ((int)I16_C8), | |
104 ((int)I16_B9) * ((int)I16_C9), | |
105 ((int)I16_B10) * ((int)I16_C10), | |
106 ((int)I16_B11) * ((int)I16_C11), | |
107 ((int)I16_B12) * ((int)I16_C12), | |
108 ((int)I16_B13) * ((int)I16_C13), | |
109 ((int)I16_B14) * ((int)I16_C14), | |
110 ((int)I16_B15) * ((int)I16_C15), | |
111 }; | |
112 | |
113 static unsigned long i32_ur[16] ALIGN16 = { | |
114 ((unsigned int)(unsigned short)I16_B0) * ((unsigned int)(unsigned short)I16_C0), | |
115 ((unsigned int)(unsigned short)I16_B1) * ((unsigned int)(unsigned short)I16_C1), | |
116 ((unsigned int)(unsigned short)I16_B2) * ((unsigned int)(unsigned short)I16_C2), | |
117 ((unsigned int)(unsigned short)I16_B3) * ((unsigned int)(unsigned short)I16_C3), | |
118 ((unsigned int)(unsigned short)I16_B4) * ((unsigned int)(unsigned short)I16_C4), | |
119 ((unsigned int)(unsigned short)I16_B5) * ((unsigned int)(unsigned short)I16_C5), | |
120 ((unsigned int)(unsigned short)I16_B6) * ((unsigned int)(unsigned short)I16_C6), | |
121 ((unsigned int)(unsigned short)I16_B7) * ((unsigned int)(unsigned short)I16_C7), | |
122 ((unsigned int)(unsigned short)I16_B8) * ((unsigned int)(unsigned short)I16_C8), | |
123 ((unsigned int)(unsigned short)I16_B9) * ((unsigned int)(unsigned short)I16_C9), | |
124 ((unsigned int)(unsigned short)I16_B10) * ((unsigned int)(unsigned short)I16_C10), | |
125 ((unsigned int)(unsigned short)I16_B11) * ((unsigned int)(unsigned short)I16_C11), | |
126 ((unsigned int)(unsigned short)I16_B12) * ((unsigned int)(unsigned short)I16_C12), | |
127 ((unsigned int)(unsigned short)I16_B13) * ((unsigned int)(unsigned short)I16_C13), | |
128 ((unsigned int)(unsigned short)I16_B14) * ((unsigned int)(unsigned short)I16_C14), | |
129 ((unsigned int)(unsigned short)I16_B15) * ((unsigned int)(unsigned short)I16_C15), | |
130 }; | |
131 | |
132 #ifndef ALIGN32 | |
133 #define ALIGN32 __attribute__((__aligned__(32))) | |
134 #endif | |
135 | |
136 #define I32_B0 1 | |
137 #define I32_B1 23 | |
138 #define I32_B2 345 | |
139 #define I32_B3 6789 | |
140 #define I32_B4 101112 | |
141 #define I32_B5 -13 | |
142 #define I32_B6 141516 | |
143 #define I32_B7 -1718 | |
144 | |
145 #define I32_C0 2 | |
146 #define I32_C1 45678910 | |
147 #define I32_C2 1112 | |
148 #define I32_C3 13 | |
149 #define I32_C4 14 | |
150 #define I32_C5 15 | |
151 #define I32_C6 -16 | |
152 #define I32_C7 17 | |
153 | |
154 union ul { | |
155 long sl[8]; | |
156 unsigned long ul[8]; | |
157 }; | |
158 | |
159 union ui { | |
160 int si[8]; | |
161 unsigned int ui[8]; | |
162 }; | |
163 | |
164 static union ul i64_sa ALIGN32; | |
165 static union ul i64_ua ALIGN32; | |
166 | |
167 static union ui i32_b ALIGN32 = { | |
168 (int)I32_B0, | |
169 (int)I32_B1, | |
170 (int)I32_B2, | |
171 (int)I32_B3, | |
172 (int)I32_B4, | |
173 (int)I32_B5, | |
174 (int)I32_B6, | |
175 (int)I32_B7, | |
176 }; | |
177 | |
178 static union ui i32_c ALIGN32 = { | |
179 (int)I32_C0, | |
180 (int)I32_C1, | |
181 (int)I32_C2, | |
182 (int)I32_C3, | |
183 (int)I32_C4, | |
184 (int)I32_C5, | |
185 (int)I32_C6, | |
186 (int)I32_C7, | |
187 }; | |
188 | |
189 static long i64_sr[8] ALIGN32 = { | |
190 ((long)I32_B0) * ((long)I32_C0), | |
191 ((long)I32_B1) * ((long)I32_C1), | |
192 ((long)I32_B2) * ((long)I32_C2), | |
193 ((long)I32_B3) * ((long)I32_C3), | |
194 ((long)I32_B4) * ((long)I32_C4), | |
195 ((long)I32_B5) * ((long)I32_C5), | |
196 ((long)I32_B6) * ((long)I32_C6), | |
197 ((long)I32_B7) * ((long)I32_C7), | |
198 }; | |
199 | |
200 static unsigned long i64_ur[8] ALIGN32 = { | |
201 ((unsigned long)(unsigned)I32_B0) * ((unsigned long)(unsigned)I32_C0), | |
202 ((unsigned long)(unsigned)I32_B1) * ((unsigned long)(unsigned)I32_C1), | |
203 ((unsigned long)(unsigned)I32_B2) * ((unsigned long)(unsigned)I32_C2), | |
204 ((unsigned long)(unsigned)I32_B3) * ((unsigned long)(unsigned)I32_C3), | |
205 ((unsigned long)(unsigned)I32_B4) * ((unsigned long)(unsigned)I32_C4), | |
206 ((unsigned long)(unsigned)I32_B5) * ((unsigned long)(unsigned)I32_C5), | |
207 ((unsigned long)(unsigned)I32_B6) * ((unsigned long)(unsigned)I32_C6), | |
208 ((unsigned long)(unsigned)I32_B7) * ((unsigned long)(unsigned)I32_C7), | |
209 }; | |
210 | |
211 | |
212 int main () | |
213 { | |
214 int i; | |
215 | |
216 /* Signed 16x16 -> 32-bit tests */ | |
217 for (i = 0; i < 16; i++) | |
218 i32_sa.si[i] = ((long)i16_b.ss[i]) * ((long)i16_c.ss[i]); | |
219 | |
220 for (i = 0; i < 16; i++) | |
221 if (i32_sa.si[i] != i32_sr[i]) | |
222 __builtin_abort (); | |
223 | |
224 /* Unsigned 16x16 -> 32-bit tests */ | |
225 for (i = 0; i < 16; i++) | |
226 i32_ua.ui[i] = ((long)i16_b.us[i]) * ((long)i16_c.us[i]); | |
227 | |
228 for (i = 0; i < 16; i++) | |
229 if (i32_ua.ui[i] != i32_ur[i]) | |
230 __builtin_abort (); | |
231 | |
232 /* Signed 32x32 -> 64-bit tests */ | |
233 for (i = 0; i < 8; i++) | |
234 i64_sa.sl[i] = ((long)i32_b.si[i]) * ((long)i32_c.si[i]); | |
235 | |
236 for (i = 0; i < 8; i++) | |
237 if (i64_sa.sl[i] != i64_sr[i]) | |
238 __builtin_abort (); | |
239 | |
240 /* Unsigned 32x32 -> 64-bit tests */ | |
241 for (i = 0; i < 8; i++) | |
242 i64_ua.ul[i] = ((long)i32_b.ui[i]) * ((long)i32_c.ui[i]); | |
243 | |
244 for (i = 0; i < 8; i++) | |
245 if (i64_ua.ul[i] != i64_ur[i]) | |
246 __builtin_abort (); | |
247 | |
248 return 0; | |
249 } |