|
1 /* |
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 /** |
|
26 * @test |
|
27 * @bug 7119644 |
|
28 * @summary Increase superword's vector size up to 256 bits |
|
29 * |
|
30 * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestShortIntVect |
|
31 */ |
|
32 |
|
33 public class TestShortIntVect { |
|
34 private static final int ARRLEN = 997; |
|
35 private static final int ITERS = 11000; |
|
36 private static final int OFFSET = 3; |
|
37 private static final int SCALE = 2; |
|
38 private static final int ALIGN_OFF = 8; |
|
39 private static final int UNALIGN_OFF = 5; |
|
40 |
|
41 public static void main(String args[]) { |
|
42 System.out.println("Testing Short + Integer vectors"); |
|
43 int errn = test(); |
|
44 if (errn > 0) { |
|
45 System.err.println("FAILED: " + errn + " errors"); |
|
46 System.exit(97); |
|
47 } |
|
48 System.out.println("PASSED"); |
|
49 } |
|
50 |
|
51 static int test() { |
|
52 short[] a1 = new short[ARRLEN]; |
|
53 short[] a2 = new short[ARRLEN]; |
|
54 int[] b1 = new int[ARRLEN]; |
|
55 int[] b2 = new int[ARRLEN]; |
|
56 System.out.println("Warmup"); |
|
57 for (int i=0; i<ITERS; i++) { |
|
58 test_ci(a1, b1); |
|
59 test_vi(a2, b2, (short)123, (int)103); |
|
60 test_cp(a1, a2, b1, b2); |
|
61 test_ci_neg(a1, b1); |
|
62 test_vi_neg(a1, b1, (short)123, (int)103); |
|
63 test_cp_neg(a1, a2, b1, b2); |
|
64 test_ci_oppos(a1, b1); |
|
65 test_vi_oppos(a1, b1, (short)123, (int)103); |
|
66 test_cp_oppos(a1, a2, b1, b2); |
|
67 test_ci_aln(a1, b1); |
|
68 test_vi_aln(a1, b1, (short)123, (int)103); |
|
69 test_cp_alndst(a1, a2, b1, b2); |
|
70 test_cp_alnsrc(a1, a2, b1, b2); |
|
71 test_ci_unaln(a1, b1); |
|
72 test_vi_unaln(a1, b1, (short)123, (int)103); |
|
73 test_cp_unalndst(a1, a2, b1, b2); |
|
74 test_cp_unalnsrc(a1, a2, b1, b2); |
|
75 } |
|
76 // Initialize |
|
77 for (int i=0; i<ARRLEN; i++) { |
|
78 a1[i] = -1; |
|
79 a2[i] = -1; |
|
80 b1[i] = -1; |
|
81 b2[i] = -1; |
|
82 } |
|
83 // Test and verify results |
|
84 System.out.println("Verification"); |
|
85 int errn = 0; |
|
86 { |
|
87 test_ci(a1, b1); |
|
88 for (int i=0; i<ARRLEN; i++) { |
|
89 errn += verify("test_ci: a1", i, a1[i], (short)-123); |
|
90 errn += verify("test_ci: b1", i, b1[i], (int)-103); |
|
91 } |
|
92 test_vi(a2, b2, (short)123, (int)103); |
|
93 for (int i=0; i<ARRLEN; i++) { |
|
94 errn += verify("test_vi: a2", i, a2[i], (short)123); |
|
95 errn += verify("test_vi: b2", i, b2[i], (int)103); |
|
96 } |
|
97 test_cp(a1, a2, b1, b2); |
|
98 for (int i=0; i<ARRLEN; i++) { |
|
99 errn += verify("test_cp: a1", i, a1[i], (short)123); |
|
100 errn += verify("test_cp: b1", i, b1[i], (int)103); |
|
101 } |
|
102 |
|
103 // Reset for negative stride |
|
104 for (int i=0; i<ARRLEN; i++) { |
|
105 a1[i] = -1; |
|
106 a2[i] = -1; |
|
107 b1[i] = -1; |
|
108 b2[i] = -1; |
|
109 } |
|
110 test_ci_neg(a1, b1); |
|
111 for (int i=0; i<ARRLEN; i++) { |
|
112 errn += verify("test_ci_neg: a1", i, a1[i], (short)-123); |
|
113 errn += verify("test_ci_neg: b1", i, b1[i], (int)-103); |
|
114 } |
|
115 test_vi_neg(a2, b2, (short)123, (int)103); |
|
116 for (int i=0; i<ARRLEN; i++) { |
|
117 errn += verify("test_vi_neg: a2", i, a2[i], (short)123); |
|
118 errn += verify("test_vi_neg: b2", i, b2[i], (int)103); |
|
119 } |
|
120 test_cp_neg(a1, a2, b1, b2); |
|
121 for (int i=0; i<ARRLEN; i++) { |
|
122 errn += verify("test_cp_neg: a1", i, a1[i], (short)123); |
|
123 errn += verify("test_cp_neg: b1", i, b1[i], (int)103); |
|
124 } |
|
125 |
|
126 // Reset for opposite stride |
|
127 for (int i=0; i<ARRLEN; i++) { |
|
128 a1[i] = -1; |
|
129 a2[i] = -1; |
|
130 b1[i] = -1; |
|
131 b2[i] = -1; |
|
132 } |
|
133 test_ci_oppos(a1, b1); |
|
134 for (int i=0; i<ARRLEN; i++) { |
|
135 errn += verify("test_ci_oppos: a1", i, a1[i], (short)-123); |
|
136 errn += verify("test_ci_oppos: b1", i, b1[i], (int)-103); |
|
137 } |
|
138 test_vi_oppos(a2, b2, (short)123, (int)103); |
|
139 for (int i=0; i<ARRLEN; i++) { |
|
140 errn += verify("test_vi_oppos: a2", i, a2[i], (short)123); |
|
141 errn += verify("test_vi_oppos: b2", i, b2[i], (int)103); |
|
142 } |
|
143 test_cp_oppos(a1, a2, b1, b2); |
|
144 for (int i=0; i<ARRLEN; i++) { |
|
145 errn += verify("test_cp_oppos: a1", i, a1[i], (short)123); |
|
146 errn += verify("test_cp_oppos: b1", i, b1[i], (int)103); |
|
147 } |
|
148 |
|
149 // Reset for 2 arrays with relative aligned offset |
|
150 for (int i=0; i<ARRLEN; i++) { |
|
151 a1[i] = -1; |
|
152 a2[i] = 123; |
|
153 b1[i] = -1; |
|
154 b2[i] = 123; |
|
155 } |
|
156 test_cp_alndst(a1, a2, b1, b2); |
|
157 for (int i=0; i<ALIGN_OFF; i++) { |
|
158 errn += verify("test_cp_alndst: a1", i, a1[i], (short)-1); |
|
159 errn += verify("test_cp_alndst: b1", i, b1[i], (int)-1); |
|
160 } |
|
161 for (int i=ALIGN_OFF; i<ARRLEN; i++) { |
|
162 errn += verify("test_cp_alndst: a1", i, a1[i], (short)123); |
|
163 errn += verify("test_cp_alndst: b1", i, b1[i], (int)123); |
|
164 } |
|
165 for (int i=0; i<ARRLEN; i++) { |
|
166 a2[i] = -123; |
|
167 b2[i] = -123; |
|
168 } |
|
169 test_cp_alnsrc(a1, a2, b1, b2); |
|
170 for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { |
|
171 errn += verify("test_cp_alnsrc: a1", i, a1[i], (short)-123); |
|
172 errn += verify("test_cp_alnsrc: b1", i, b1[i], (int)-123); |
|
173 } |
|
174 for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { |
|
175 errn += verify("test_cp_alnsrc: a1", i, a1[i], (short)123); |
|
176 errn += verify("test_cp_alnsrc: b1", i, b1[i], (int)123); |
|
177 } |
|
178 |
|
179 for (int i=0; i<ARRLEN; i++) { |
|
180 a1[i] = -1; |
|
181 b1[i] = -1; |
|
182 } |
|
183 test_ci_aln(a1, b1); |
|
184 for (int i=0; i<ALIGN_OFF; i++) { |
|
185 errn += verify("test_ci_aln: a1", i, a1[i], (short)-1); |
|
186 } |
|
187 for (int i=ALIGN_OFF; i<ARRLEN; i++) { |
|
188 errn += verify("test_ci_aln: a1", i, a1[i], (short)-123); |
|
189 } |
|
190 for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { |
|
191 errn += verify("test_ci_aln: b1", i, b1[i], (int)-103); |
|
192 } |
|
193 for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { |
|
194 errn += verify("test_ci_aln: b1", i, b1[i], (int)-1); |
|
195 } |
|
196 |
|
197 for (int i=0; i<ARRLEN; i++) { |
|
198 a1[i] = -1; |
|
199 b1[i] = -1; |
|
200 } |
|
201 test_vi_aln(a1, b1, (short)123, (int)103); |
|
202 for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { |
|
203 errn += verify("test_vi_aln: a1", i, a1[i], (short)123); |
|
204 } |
|
205 for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { |
|
206 errn += verify("test_vi_aln: a1", i, a1[i], (short)-1); |
|
207 } |
|
208 for (int i=0; i<ALIGN_OFF; i++) { |
|
209 errn += verify("test_vi_aln: b1", i, b1[i], (int)-1); |
|
210 } |
|
211 for (int i=ALIGN_OFF; i<ARRLEN; i++) { |
|
212 errn += verify("test_vi_aln: b1", i, b1[i], (int)103); |
|
213 } |
|
214 |
|
215 // Reset for 2 arrays with relative unaligned offset |
|
216 for (int i=0; i<ARRLEN; i++) { |
|
217 a1[i] = -1; |
|
218 a2[i] = 123; |
|
219 b1[i] = -1; |
|
220 b2[i] = 123; |
|
221 } |
|
222 test_cp_unalndst(a1, a2, b1, b2); |
|
223 for (int i=0; i<UNALIGN_OFF; i++) { |
|
224 errn += verify("test_cp_unalndst: a1", i, a1[i], (short)-1); |
|
225 errn += verify("test_cp_unalndst: b1", i, b1[i], (int)-1); |
|
226 } |
|
227 for (int i=UNALIGN_OFF; i<ARRLEN; i++) { |
|
228 errn += verify("test_cp_unalndst: a1", i, a1[i], (short)123); |
|
229 errn += verify("test_cp_unalndst: b1", i, b1[i], (int)123); |
|
230 } |
|
231 for (int i=0; i<ARRLEN; i++) { |
|
232 a2[i] = -123; |
|
233 b2[i] = -123; |
|
234 } |
|
235 test_cp_unalnsrc(a1, a2, b1, b2); |
|
236 for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { |
|
237 errn += verify("test_cp_unalnsrc: a1", i, a1[i], (short)-123); |
|
238 errn += verify("test_cp_unalnsrc: b1", i, b1[i], (int)-123); |
|
239 } |
|
240 for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { |
|
241 errn += verify("test_cp_unalnsrc: a1", i, a1[i], (short)123); |
|
242 errn += verify("test_cp_unalnsrc: b1", i, b1[i], (int)123); |
|
243 } |
|
244 for (int i=0; i<ARRLEN; i++) { |
|
245 a1[i] = -1; |
|
246 b1[i] = -1; |
|
247 } |
|
248 test_ci_unaln(a1, b1); |
|
249 for (int i=0; i<UNALIGN_OFF; i++) { |
|
250 errn += verify("test_ci_unaln: a1", i, a1[i], (short)-1); |
|
251 } |
|
252 for (int i=UNALIGN_OFF; i<ARRLEN; i++) { |
|
253 errn += verify("test_ci_unaln: a1", i, a1[i], (short)-123); |
|
254 } |
|
255 for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { |
|
256 errn += verify("test_ci_unaln: b1", i, b1[i], (int)-103); |
|
257 } |
|
258 for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { |
|
259 errn += verify("test_ci_unaln: b1", i, b1[i], (int)-1); |
|
260 } |
|
261 for (int i=0; i<ARRLEN; i++) { |
|
262 a1[i] = -1; |
|
263 b1[i] = -1; |
|
264 } |
|
265 test_vi_unaln(a1, b1, (short)123, (int)103); |
|
266 for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { |
|
267 errn += verify("test_vi_unaln: a1", i, a1[i], (short)123); |
|
268 } |
|
269 for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { |
|
270 errn += verify("test_vi_unaln: a1", i, a1[i], (short)-1); |
|
271 } |
|
272 for (int i=0; i<UNALIGN_OFF; i++) { |
|
273 errn += verify("test_vi_unaln: b1", i, b1[i], (int)-1); |
|
274 } |
|
275 for (int i=UNALIGN_OFF; i<ARRLEN; i++) { |
|
276 errn += verify("test_vi_unaln: b1", i, b1[i], (int)103); |
|
277 } |
|
278 |
|
279 // Reset for aligned overlap initialization |
|
280 for (int i=0; i<ALIGN_OFF; i++) { |
|
281 a1[i] = (short)i; |
|
282 b1[i] = (int)i; |
|
283 } |
|
284 for (int i=ALIGN_OFF; i<ARRLEN; i++) { |
|
285 a1[i] = -1; |
|
286 b1[i] = -1; |
|
287 } |
|
288 test_cp_alndst(a1, a1, b1, b1); |
|
289 for (int i=0; i<ARRLEN; i++) { |
|
290 int v = i%ALIGN_OFF; |
|
291 errn += verify("test_cp_alndst_overlap: a1", i, a1[i], (short)v); |
|
292 errn += verify("test_cp_alndst_overlap: b1", i, b1[i], (int)v); |
|
293 } |
|
294 for (int i=0; i<ALIGN_OFF; i++) { |
|
295 a1[i+ALIGN_OFF] = -1; |
|
296 b1[i+ALIGN_OFF] = -1; |
|
297 } |
|
298 test_cp_alnsrc(a1, a1, b1, b1); |
|
299 for (int i=0; i<ALIGN_OFF; i++) { |
|
300 errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (short)-1); |
|
301 errn += verify("test_cp_alnsrc_overlap: b1", i, b1[i], (int)-1); |
|
302 } |
|
303 for (int i=ALIGN_OFF; i<ARRLEN; i++) { |
|
304 int v = i%ALIGN_OFF; |
|
305 errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (short)v); |
|
306 errn += verify("test_cp_alnsrc_overlap: b1", i, b1[i], (int)v); |
|
307 } |
|
308 |
|
309 // Reset for unaligned overlap initialization |
|
310 for (int i=0; i<UNALIGN_OFF; i++) { |
|
311 a1[i] = (short)i; |
|
312 b1[i] = (int)i; |
|
313 } |
|
314 for (int i=UNALIGN_OFF; i<ARRLEN; i++) { |
|
315 a1[i] = -1; |
|
316 b1[i] = -1; |
|
317 } |
|
318 test_cp_unalndst(a1, a1, b1, b1); |
|
319 for (int i=0; i<ARRLEN; i++) { |
|
320 int v = i%UNALIGN_OFF; |
|
321 errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], (short)v); |
|
322 errn += verify("test_cp_unalndst_overlap: b1", i, b1[i], (int)v); |
|
323 } |
|
324 for (int i=0; i<UNALIGN_OFF; i++) { |
|
325 a1[i+UNALIGN_OFF] = -1; |
|
326 b1[i+UNALIGN_OFF] = -1; |
|
327 } |
|
328 test_cp_unalnsrc(a1, a1, b1, b1); |
|
329 for (int i=0; i<UNALIGN_OFF; i++) { |
|
330 errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (short)-1); |
|
331 errn += verify("test_cp_unalnsrc_overlap: b1", i, b1[i], (int)-1); |
|
332 } |
|
333 for (int i=UNALIGN_OFF; i<ARRLEN; i++) { |
|
334 int v = i%UNALIGN_OFF; |
|
335 errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (short)v); |
|
336 errn += verify("test_cp_unalnsrc_overlap: b1", i, b1[i], (int)v); |
|
337 } |
|
338 |
|
339 } |
|
340 |
|
341 if (errn > 0) |
|
342 return errn; |
|
343 |
|
344 System.out.println("Time"); |
|
345 long start, end; |
|
346 start = System.currentTimeMillis(); |
|
347 for (int i=0; i<ITERS; i++) { |
|
348 test_ci(a1, b1); |
|
349 } |
|
350 end = System.currentTimeMillis(); |
|
351 System.out.println("test_ci: " + (end - start)); |
|
352 start = System.currentTimeMillis(); |
|
353 for (int i=0; i<ITERS; i++) { |
|
354 test_vi(a2, b2, (short)123, (int)103); |
|
355 } |
|
356 end = System.currentTimeMillis(); |
|
357 System.out.println("test_vi: " + (end - start)); |
|
358 start = System.currentTimeMillis(); |
|
359 for (int i=0; i<ITERS; i++) { |
|
360 test_cp(a1, a2, b1, b2); |
|
361 } |
|
362 end = System.currentTimeMillis(); |
|
363 System.out.println("test_cp: " + (end - start)); |
|
364 start = System.currentTimeMillis(); |
|
365 for (int i=0; i<ITERS; i++) { |
|
366 test_ci_neg(a1, b1); |
|
367 } |
|
368 end = System.currentTimeMillis(); |
|
369 System.out.println("test_ci_neg: " + (end - start)); |
|
370 start = System.currentTimeMillis(); |
|
371 for (int i=0; i<ITERS; i++) { |
|
372 test_vi_neg(a1, b1, (short)123, (int)103); |
|
373 } |
|
374 end = System.currentTimeMillis(); |
|
375 System.out.println("test_vi_neg: " + (end - start)); |
|
376 start = System.currentTimeMillis(); |
|
377 for (int i=0; i<ITERS; i++) { |
|
378 test_cp_neg(a1, a2, b1, b2); |
|
379 } |
|
380 end = System.currentTimeMillis(); |
|
381 System.out.println("test_cp_neg: " + (end - start)); |
|
382 start = System.currentTimeMillis(); |
|
383 for (int i=0; i<ITERS; i++) { |
|
384 test_ci_oppos(a1, b1); |
|
385 } |
|
386 end = System.currentTimeMillis(); |
|
387 System.out.println("test_ci_oppos: " + (end - start)); |
|
388 start = System.currentTimeMillis(); |
|
389 for (int i=0; i<ITERS; i++) { |
|
390 test_vi_oppos(a1, b1, (short)123, (int)103); |
|
391 } |
|
392 end = System.currentTimeMillis(); |
|
393 System.out.println("test_vi_oppos: " + (end - start)); |
|
394 start = System.currentTimeMillis(); |
|
395 for (int i=0; i<ITERS; i++) { |
|
396 test_cp_oppos(a1, a2, b1, b2); |
|
397 } |
|
398 end = System.currentTimeMillis(); |
|
399 System.out.println("test_cp_oppos: " + (end - start)); |
|
400 start = System.currentTimeMillis(); |
|
401 for (int i=0; i<ITERS; i++) { |
|
402 test_ci_aln(a1, b1); |
|
403 } |
|
404 end = System.currentTimeMillis(); |
|
405 System.out.println("test_ci_aln: " + (end - start)); |
|
406 start = System.currentTimeMillis(); |
|
407 for (int i=0; i<ITERS; i++) { |
|
408 test_vi_aln(a1, b1, (short)123, (int)103); |
|
409 } |
|
410 end = System.currentTimeMillis(); |
|
411 System.out.println("test_vi_aln: " + (end - start)); |
|
412 start = System.currentTimeMillis(); |
|
413 for (int i=0; i<ITERS; i++) { |
|
414 test_cp_alndst(a1, a2, b1, b2); |
|
415 } |
|
416 end = System.currentTimeMillis(); |
|
417 System.out.println("test_cp_alndst: " + (end - start)); |
|
418 start = System.currentTimeMillis(); |
|
419 for (int i=0; i<ITERS; i++) { |
|
420 test_cp_alnsrc(a1, a2, b1, b2); |
|
421 } |
|
422 end = System.currentTimeMillis(); |
|
423 System.out.println("test_cp_alnsrc: " + (end - start)); |
|
424 start = System.currentTimeMillis(); |
|
425 for (int i=0; i<ITERS; i++) { |
|
426 test_ci_unaln(a1, b1); |
|
427 } |
|
428 end = System.currentTimeMillis(); |
|
429 System.out.println("test_ci_unaln: " + (end - start)); |
|
430 start = System.currentTimeMillis(); |
|
431 for (int i=0; i<ITERS; i++) { |
|
432 test_vi_unaln(a1, b1, (short)123, (int)103); |
|
433 } |
|
434 end = System.currentTimeMillis(); |
|
435 System.out.println("test_vi_unaln: " + (end - start)); |
|
436 start = System.currentTimeMillis(); |
|
437 for (int i=0; i<ITERS; i++) { |
|
438 test_cp_unalndst(a1, a2, b1, b2); |
|
439 } |
|
440 end = System.currentTimeMillis(); |
|
441 System.out.println("test_cp_unalndst: " + (end - start)); |
|
442 start = System.currentTimeMillis(); |
|
443 for (int i=0; i<ITERS; i++) { |
|
444 test_cp_unalnsrc(a1, a2, b1, b2); |
|
445 } |
|
446 end = System.currentTimeMillis(); |
|
447 System.out.println("test_cp_unalnsrc: " + (end - start)); |
|
448 return errn; |
|
449 } |
|
450 |
|
451 static void test_ci(short[] a, int[] b) { |
|
452 for (int i = 0; i < a.length; i+=1) { |
|
453 a[i] = -123; |
|
454 b[i] = -103; |
|
455 } |
|
456 } |
|
457 static void test_vi(short[] a, int[] b, short c, int d) { |
|
458 for (int i = 0; i < a.length; i+=1) { |
|
459 a[i] = c; |
|
460 b[i] = d; |
|
461 } |
|
462 } |
|
463 static void test_cp(short[] a, short[] b, int[] c, int[] d) { |
|
464 for (int i = 0; i < a.length; i+=1) { |
|
465 a[i] = b[i]; |
|
466 c[i] = d[i]; |
|
467 } |
|
468 } |
|
469 static void test_ci_neg(short[] a, int[] b) { |
|
470 for (int i = a.length-1; i >= 0; i-=1) { |
|
471 a[i] = -123; |
|
472 b[i] = -103; |
|
473 } |
|
474 } |
|
475 static void test_vi_neg(short[] a, int[] b, short c, int d) { |
|
476 for (int i = a.length-1; i >= 0; i-=1) { |
|
477 a[i] = c; |
|
478 b[i] = d; |
|
479 } |
|
480 } |
|
481 static void test_cp_neg(short[] a, short[] b, int[] c, int[] d) { |
|
482 for (int i = a.length-1; i >= 0; i-=1) { |
|
483 a[i] = b[i]; |
|
484 c[i] = d[i]; |
|
485 } |
|
486 } |
|
487 static void test_ci_oppos(short[] a, int[] b) { |
|
488 int limit = a.length-1; |
|
489 for (int i = 0; i < a.length; i+=1) { |
|
490 a[limit-i] = -123; |
|
491 b[i] = -103; |
|
492 } |
|
493 } |
|
494 static void test_vi_oppos(short[] a, int[] b, short c, int d) { |
|
495 int limit = a.length-1; |
|
496 for (int i = a.length-1; i >= 0; i-=1) { |
|
497 a[i] = c; |
|
498 b[limit-i] = d; |
|
499 } |
|
500 } |
|
501 static void test_cp_oppos(short[] a, short[] b, int[] c, int[] d) { |
|
502 int limit = a.length-1; |
|
503 for (int i = 0; i < a.length; i+=1) { |
|
504 a[i] = b[limit-i]; |
|
505 c[limit-i] = d[i]; |
|
506 } |
|
507 } |
|
508 static void test_ci_aln(short[] a, int[] b) { |
|
509 for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { |
|
510 a[i+ALIGN_OFF] = -123; |
|
511 b[i] = -103; |
|
512 } |
|
513 } |
|
514 static void test_vi_aln(short[] a, int[] b, short c, int d) { |
|
515 for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { |
|
516 a[i] = c; |
|
517 b[i+ALIGN_OFF] = d; |
|
518 } |
|
519 } |
|
520 static void test_cp_alndst(short[] a, short[] b, int[] c, int[] d) { |
|
521 for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { |
|
522 a[i+ALIGN_OFF] = b[i]; |
|
523 c[i+ALIGN_OFF] = d[i]; |
|
524 } |
|
525 } |
|
526 static void test_cp_alnsrc(short[] a, short[] b, int[] c, int[] d) { |
|
527 for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { |
|
528 a[i] = b[i+ALIGN_OFF]; |
|
529 c[i] = d[i+ALIGN_OFF]; |
|
530 } |
|
531 } |
|
532 static void test_ci_unaln(short[] a, int[] b) { |
|
533 for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { |
|
534 a[i+UNALIGN_OFF] = -123; |
|
535 b[i] = -103; |
|
536 } |
|
537 } |
|
538 static void test_vi_unaln(short[] a, int[] b, short c, int d) { |
|
539 for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { |
|
540 a[i] = c; |
|
541 b[i+UNALIGN_OFF] = d; |
|
542 } |
|
543 } |
|
544 static void test_cp_unalndst(short[] a, short[] b, int[] c, int[] d) { |
|
545 for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { |
|
546 a[i+UNALIGN_OFF] = b[i]; |
|
547 c[i+UNALIGN_OFF] = d[i]; |
|
548 } |
|
549 } |
|
550 static void test_cp_unalnsrc(short[] a, short[] b, int[] c, int[] d) { |
|
551 for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { |
|
552 a[i] = b[i+UNALIGN_OFF]; |
|
553 c[i] = d[i+UNALIGN_OFF]; |
|
554 } |
|
555 } |
|
556 |
|
557 static int verify(String text, int i, short elem, short val) { |
|
558 if (elem != val) { |
|
559 System.err.println(text + "[" + i + "] = " + elem + " != " + val); |
|
560 return 1; |
|
561 } |
|
562 return 0; |
|
563 } |
|
564 static int verify(String text, int i, int elem, int val) { |
|
565 if (elem != val) { |
|
566 System.err.println(text + "[" + i + "] = " + elem + " != " + val); |
|
567 return 1; |
|
568 } |
|
569 return 0; |
|
570 } |
|
571 } |