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