Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/codegen/TestByteVect.java
41149 views
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
*
29
* @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions
30
* -XX:-TieredCompilation -XX:-OptimizeFill
31
* compiler.codegen.TestByteVect
32
*/
33
34
package compiler.codegen;
35
36
public class TestByteVect {
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 Byte 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
byte[] a1 = new byte[ARRLEN];
56
byte[] a2 = new byte[ARRLEN];
57
System.out.println("Warmup");
58
for (int i=0; i<ITERS; i++) {
59
test_ci(a1);
60
test_vi(a2, (byte)123);
61
test_cp(a1, a2);
62
test_2ci(a1, a2);
63
test_2vi(a1, a2, (byte)123, (byte)103);
64
test_ci_neg(a1);
65
test_vi_neg(a2, (byte)123);
66
test_cp_neg(a1, a2);
67
test_2ci_neg(a1, a2);
68
test_2vi_neg(a1, a2, (byte)123, (byte)103);
69
test_ci_oppos(a1);
70
test_vi_oppos(a2, (byte)123);
71
test_cp_oppos(a1, a2);
72
test_2ci_oppos(a1, a2);
73
test_2vi_oppos(a1, a2, (byte)123, (byte)103);
74
test_ci_off(a1);
75
test_vi_off(a2, (byte)123);
76
test_cp_off(a1, a2);
77
test_2ci_off(a1, a2);
78
test_2vi_off(a1, a2, (byte)123, (byte)103);
79
test_ci_inv(a1, OFFSET);
80
test_vi_inv(a2, (byte)123, OFFSET);
81
test_cp_inv(a1, a2, OFFSET);
82
test_2ci_inv(a1, a2, OFFSET);
83
test_2vi_inv(a1, a2, (byte)123, (byte)103, OFFSET);
84
test_ci_scl(a1);
85
test_vi_scl(a2, (byte)123);
86
test_cp_scl(a1, a2);
87
test_2ci_scl(a1, a2);
88
test_2vi_scl(a1, a2, (byte)123, (byte)103);
89
test_cp_alndst(a1, a2);
90
test_cp_alnsrc(a1, a2);
91
test_2ci_aln(a1, a2);
92
test_2vi_aln(a1, a2, (byte)123, (byte)103);
93
test_cp_unalndst(a1, a2);
94
test_cp_unalnsrc(a1, a2);
95
test_2ci_unaln(a1, a2);
96
test_2vi_unaln(a1, a2, (byte)123, (byte)103);
97
}
98
// Initialize
99
for (int i=0; i<ARRLEN; i++) {
100
a1[i] = -1;
101
a2[i] = -1;
102
}
103
// Test and verify results
104
System.out.println("Verification");
105
int errn = 0;
106
{
107
test_ci(a1);
108
for (int i=0; i<ARRLEN; i++) {
109
errn += verify("test_ci: a1", i, a1[i], (byte)-123);
110
}
111
test_vi(a2, (byte)123);
112
for (int i=0; i<ARRLEN; i++) {
113
errn += verify("test_vi: a2", i, a2[i], (byte)123);
114
}
115
test_cp(a1, a2);
116
for (int i=0; i<ARRLEN; i++) {
117
errn += verify("test_cp: a1", i, a1[i], (byte)123);
118
}
119
test_2ci(a1, a2);
120
for (int i=0; i<ARRLEN; i++) {
121
errn += verify("test_2ci: a1", i, a1[i], (byte)-123);
122
errn += verify("test_2ci: a2", i, a2[i], (byte)-103);
123
}
124
test_2vi(a1, a2, (byte)123, (byte)103);
125
for (int i=0; i<ARRLEN; i++) {
126
errn += verify("test_2vi: a1", i, a1[i], (byte)123);
127
errn += verify("test_2vi: a2", i, a2[i], (byte)103);
128
}
129
// Reset for negative stride
130
for (int i=0; i<ARRLEN; i++) {
131
a1[i] = -1;
132
a2[i] = -1;
133
}
134
test_ci_neg(a1);
135
for (int i=0; i<ARRLEN; i++) {
136
errn += verify("test_ci_neg: a1", i, a1[i], (byte)-123);
137
}
138
test_vi_neg(a2, (byte)123);
139
for (int i=0; i<ARRLEN; i++) {
140
errn += verify("test_vi_neg: a2", i, a2[i], (byte)123);
141
}
142
test_cp_neg(a1, a2);
143
for (int i=0; i<ARRLEN; i++) {
144
errn += verify("test_cp_neg: a1", i, a1[i], (byte)123);
145
}
146
test_2ci_neg(a1, a2);
147
for (int i=0; i<ARRLEN; i++) {
148
errn += verify("test_2ci_neg: a1", i, a1[i], (byte)-123);
149
errn += verify("test_2ci_neg: a2", i, a2[i], (byte)-103);
150
}
151
test_2vi_neg(a1, a2, (byte)123, (byte)103);
152
for (int i=0; i<ARRLEN; i++) {
153
errn += verify("test_2vi_neg: a1", i, a1[i], (byte)123);
154
errn += verify("test_2vi_neg: a2", i, a2[i], (byte)103);
155
}
156
// Reset for opposite stride
157
for (int i=0; i<ARRLEN; i++) {
158
a1[i] = -1;
159
a2[i] = -1;
160
}
161
test_ci_oppos(a1);
162
for (int i=0; i<ARRLEN; i++) {
163
errn += verify("test_ci_oppos: a1", i, a1[i], (byte)-123);
164
}
165
test_vi_oppos(a2, (byte)123);
166
for (int i=0; i<ARRLEN; i++) {
167
errn += verify("test_vi_oppos: a2", i, a2[i], (byte)123);
168
}
169
test_cp_oppos(a1, a2);
170
for (int i=0; i<ARRLEN; i++) {
171
errn += verify("test_cp_oppos: a1", i, a1[i], (byte)123);
172
}
173
test_2ci_oppos(a1, a2);
174
for (int i=0; i<ARRLEN; i++) {
175
errn += verify("test_2ci_oppos: a1", i, a1[i], (byte)-123);
176
errn += verify("test_2ci_oppos: a2", i, a2[i], (byte)-103);
177
}
178
test_2vi_oppos(a1, a2, (byte)123, (byte)103);
179
for (int i=0; i<ARRLEN; i++) {
180
errn += verify("test_2vi_oppos: a1", i, a1[i], (byte)123);
181
errn += verify("test_2vi_oppos: a2", i, a2[i], (byte)103);
182
}
183
// Reset for indexing with offset
184
for (int i=0; i<ARRLEN; i++) {
185
a1[i] = -1;
186
a2[i] = -1;
187
}
188
test_ci_off(a1);
189
for (int i=OFFSET; i<ARRLEN; i++) {
190
errn += verify("test_ci_off: a1", i, a1[i], (byte)-123);
191
}
192
test_vi_off(a2, (byte)123);
193
for (int i=OFFSET; i<ARRLEN; i++) {
194
errn += verify("test_vi_off: a2", i, a2[i], (byte)123);
195
}
196
test_cp_off(a1, a2);
197
for (int i=OFFSET; i<ARRLEN; i++) {
198
errn += verify("test_cp_off: a1", i, a1[i], (byte)123);
199
}
200
test_2ci_off(a1, a2);
201
for (int i=OFFSET; i<ARRLEN; i++) {
202
errn += verify("test_2ci_off: a1", i, a1[i], (byte)-123);
203
errn += verify("test_2ci_off: a2", i, a2[i], (byte)-103);
204
}
205
test_2vi_off(a1, a2, (byte)123, (byte)103);
206
for (int i=OFFSET; i<ARRLEN; i++) {
207
errn += verify("test_2vi_off: a1", i, a1[i], (byte)123);
208
errn += verify("test_2vi_off: a2", i, a2[i], (byte)103);
209
}
210
for (int i=0; i<OFFSET; i++) {
211
errn += verify("test_2vi_off: a1", i, a1[i], (byte)-1);
212
errn += verify("test_2vi_off: a2", i, a2[i], (byte)-1);
213
}
214
// Reset for indexing with invariant offset
215
for (int i=0; i<ARRLEN; i++) {
216
a1[i] = -1;
217
a2[i] = -1;
218
}
219
test_ci_inv(a1, OFFSET);
220
for (int i=OFFSET; i<ARRLEN; i++) {
221
errn += verify("test_ci_inv: a1", i, a1[i], (byte)-123);
222
}
223
test_vi_inv(a2, (byte)123, OFFSET);
224
for (int i=OFFSET; i<ARRLEN; i++) {
225
errn += verify("test_vi_inv: a2", i, a2[i], (byte)123);
226
}
227
test_cp_inv(a1, a2, OFFSET);
228
for (int i=OFFSET; i<ARRLEN; i++) {
229
errn += verify("test_cp_inv: a1", i, a1[i], (byte)123);
230
}
231
test_2ci_inv(a1, a2, OFFSET);
232
for (int i=OFFSET; i<ARRLEN; i++) {
233
errn += verify("test_2ci_inv: a1", i, a1[i], (byte)-123);
234
errn += verify("test_2ci_inv: a2", i, a2[i], (byte)-103);
235
}
236
test_2vi_inv(a1, a2, (byte)123, (byte)103, OFFSET);
237
for (int i=OFFSET; i<ARRLEN; i++) {
238
errn += verify("test_2vi_inv: a1", i, a1[i], (byte)123);
239
errn += verify("test_2vi_inv: a2", i, a2[i], (byte)103);
240
}
241
for (int i=0; i<OFFSET; i++) {
242
errn += verify("test_2vi_inv: a1", i, a1[i], (byte)-1);
243
errn += verify("test_2vi_inv: a2", i, a2[i], (byte)-1);
244
}
245
// Reset for indexing with scale
246
for (int i=0; i<ARRLEN; i++) {
247
a1[i] = -1;
248
a2[i] = -1;
249
}
250
test_ci_scl(a1);
251
for (int i=0; i<ARRLEN; i++) {
252
int val = (i%SCALE != 0) ? -1 : -123;
253
errn += verify("test_ci_scl: a1", i, a1[i], (byte)val);
254
}
255
test_vi_scl(a2, (byte)123);
256
for (int i=0; i<ARRLEN; i++) {
257
int val = (i%SCALE != 0) ? -1 : 123;
258
errn += verify("test_vi_scl: a2", i, a2[i], (byte)val);
259
}
260
test_cp_scl(a1, a2);
261
for (int i=0; i<ARRLEN; i++) {
262
int val = (i%SCALE != 0) ? -1 : 123;
263
errn += verify("test_cp_scl: a1", i, a1[i], (byte)val);
264
}
265
test_2ci_scl(a1, a2);
266
for (int i=0; i<ARRLEN; i++) {
267
if (i%SCALE != 0) {
268
errn += verify("test_2ci_scl: a1", i, a1[i], (byte)-1);
269
} else if (i*SCALE < ARRLEN) {
270
errn += verify("test_2ci_scl: a1", i*SCALE, a1[i*SCALE], (byte)-123);
271
}
272
if (i%SCALE != 0) {
273
errn += verify("test_2ci_scl: a2", i, a2[i], (byte)-1);
274
} else if (i*SCALE < ARRLEN) {
275
errn += verify("test_2ci_scl: a2", i*SCALE, a2[i*SCALE], (byte)-103);
276
}
277
}
278
test_2vi_scl(a1, a2, (byte)123, (byte)103);
279
for (int i=0; i<ARRLEN; i++) {
280
if (i%SCALE != 0) {
281
errn += verify("test_2vi_scl: a1", i, a1[i], (byte)-1);
282
} else if (i*SCALE < ARRLEN) {
283
errn += verify("test_2vi_scl: a1", i*SCALE, a1[i*SCALE], (byte)123);
284
}
285
if (i%SCALE != 0) {
286
errn += verify("test_2vi_scl: a2", i, a2[i], (byte)-1);
287
} else if (i*SCALE < ARRLEN) {
288
errn += verify("test_2vi_scl: a2", i*SCALE, a2[i*SCALE], (byte)103);
289
}
290
}
291
// Reset for 2 arrays with relative aligned offset
292
for (int i=0; i<ARRLEN; i++) {
293
a1[i] = -1;
294
a2[i] = -1;
295
}
296
test_vi(a2, (byte)123);
297
test_cp_alndst(a1, a2);
298
for (int i=0; i<ALIGN_OFF; i++) {
299
errn += verify("test_cp_alndst: a1", i, a1[i], (byte)-1);
300
}
301
for (int i=ALIGN_OFF; i<ARRLEN; i++) {
302
errn += verify("test_cp_alndst: a1", i, a1[i], (byte)123);
303
}
304
test_vi(a2, (byte)-123);
305
test_cp_alnsrc(a1, a2);
306
for (int i=0; i<ARRLEN-ALIGN_OFF; i++) {
307
errn += verify("test_cp_alnsrc: a1", i, a1[i], (byte)-123);
308
}
309
for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) {
310
errn += verify("test_cp_alnsrc: a1", i, a1[i], (byte)123);
311
}
312
for (int i=0; i<ARRLEN; i++) {
313
a1[i] = -1;
314
a2[i] = -1;
315
}
316
test_2ci_aln(a1, a2);
317
for (int i=0; i<ALIGN_OFF; i++) {
318
errn += verify("test_2ci_aln: a1", i, a1[i], (byte)-1);
319
}
320
for (int i=ALIGN_OFF; i<ARRLEN; i++) {
321
errn += verify("test_2ci_aln: a1", i, a1[i], (byte)-123);
322
}
323
for (int i=0; i<ARRLEN-ALIGN_OFF; i++) {
324
errn += verify("test_2ci_aln: a2", i, a2[i], (byte)-103);
325
}
326
for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) {
327
errn += verify("test_2ci_aln: a2", i, a2[i], (byte)-1);
328
}
329
for (int i=0; i<ARRLEN; i++) {
330
a1[i] = -1;
331
a2[i] = -1;
332
}
333
test_2vi_aln(a1, a2, (byte)123, (byte)103);
334
for (int i=0; i<ARRLEN-ALIGN_OFF; i++) {
335
errn += verify("test_2vi_aln: a1", i, a1[i], (byte)123);
336
}
337
for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) {
338
errn += verify("test_2vi_aln: a1", i, a1[i], (byte)-1);
339
}
340
for (int i=0; i<ALIGN_OFF; i++) {
341
errn += verify("test_2vi_aln: a2", i, a2[i], (byte)-1);
342
}
343
for (int i=ALIGN_OFF; i<ARRLEN; i++) {
344
errn += verify("test_2vi_aln: a2", i, a2[i], (byte)103);
345
}
346
347
// Reset for 2 arrays with relative unaligned offset
348
for (int i=0; i<ARRLEN; i++) {
349
a1[i] = -1;
350
a2[i] = -1;
351
}
352
test_vi(a2, (byte)123);
353
test_cp_unalndst(a1, a2);
354
for (int i=0; i<UNALIGN_OFF; i++) {
355
errn += verify("test_cp_unalndst: a1", i, a1[i], (byte)-1);
356
}
357
for (int i=UNALIGN_OFF; i<ARRLEN; i++) {
358
errn += verify("test_cp_unalndst: a1", i, a1[i], (byte)123);
359
}
360
test_vi(a2, (byte)-123);
361
test_cp_unalnsrc(a1, a2);
362
for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) {
363
errn += verify("test_cp_unalnsrc: a1", i, a1[i], (byte)-123);
364
}
365
for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) {
366
errn += verify("test_cp_unalnsrc: a1", i, a1[i], (byte)123);
367
}
368
for (int i=0; i<ARRLEN; i++) {
369
a1[i] = -1;
370
a2[i] = -1;
371
}
372
test_2ci_unaln(a1, a2);
373
for (int i=0; i<UNALIGN_OFF; i++) {
374
errn += verify("test_2ci_unaln: a1", i, a1[i], (byte)-1);
375
}
376
for (int i=UNALIGN_OFF; i<ARRLEN; i++) {
377
errn += verify("test_2ci_unaln: a1", i, a1[i], (byte)-123);
378
}
379
for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) {
380
errn += verify("test_2ci_unaln: a2", i, a2[i], (byte)-103);
381
}
382
for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) {
383
errn += verify("test_2ci_unaln: a2", i, a2[i], (byte)-1);
384
}
385
for (int i=0; i<ARRLEN; i++) {
386
a1[i] = -1;
387
a2[i] = -1;
388
}
389
test_2vi_unaln(a1, a2, (byte)123, (byte)103);
390
for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) {
391
errn += verify("test_2vi_unaln: a1", i, a1[i], (byte)123);
392
}
393
for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) {
394
errn += verify("test_2vi_unaln: a1", i, a1[i], (byte)-1);
395
}
396
for (int i=0; i<UNALIGN_OFF; i++) {
397
errn += verify("test_2vi_unaln: a2", i, a2[i], (byte)-1);
398
}
399
for (int i=UNALIGN_OFF; i<ARRLEN; i++) {
400
errn += verify("test_2vi_unaln: a2", i, a2[i], (byte)103);
401
}
402
403
// Reset for aligned overlap initialization
404
for (int i=0; i<ALIGN_OFF; i++) {
405
a1[i] = (byte)i;
406
}
407
for (int i=ALIGN_OFF; i<ARRLEN; i++) {
408
a1[i] = -1;
409
}
410
test_cp_alndst(a1, a1);
411
for (int i=0; i<ARRLEN; i++) {
412
int v = i%ALIGN_OFF;
413
errn += verify("test_cp_alndst_overlap: a1", i, a1[i], (byte)v);
414
}
415
for (int i=0; i<ALIGN_OFF; i++) {
416
a1[i+ALIGN_OFF] = -1;
417
}
418
test_cp_alnsrc(a1, a1);
419
for (int i=0; i<ALIGN_OFF; i++) {
420
errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (byte)-1);
421
}
422
for (int i=ALIGN_OFF; i<ARRLEN; i++) {
423
int v = i%ALIGN_OFF;
424
errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (byte)v);
425
}
426
for (int i=0; i<ARRLEN; i++) {
427
a1[i] = -1;
428
}
429
test_2ci_aln(a1, a1);
430
for (int i=0; i<ARRLEN-ALIGN_OFF; i++) {
431
errn += verify("test_2ci_aln_overlap: a1", i, a1[i], (byte)-103);
432
}
433
for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) {
434
errn += verify("test_2ci_aln_overlap: a1", i, a1[i], (byte)-123);
435
}
436
for (int i=0; i<ARRLEN; i++) {
437
a1[i] = -1;
438
}
439
test_2vi_aln(a1, a1, (byte)123, (byte)103);
440
for (int i=0; i<ARRLEN-ALIGN_OFF; i++) {
441
errn += verify("test_2vi_aln_overlap: a1", i, a1[i], (byte)123);
442
}
443
for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) {
444
errn += verify("test_2vi_aln_overlap: a1", i, a1[i], (byte)103);
445
}
446
447
// Reset for unaligned overlap initialization
448
for (int i=0; i<UNALIGN_OFF; i++) {
449
a1[i] = (byte)i;
450
}
451
for (int i=UNALIGN_OFF; i<ARRLEN; i++) {
452
a1[i] = -1;
453
}
454
test_cp_unalndst(a1, a1);
455
for (int i=0; i<ARRLEN; i++) {
456
int v = i%UNALIGN_OFF;
457
errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], (byte)v);
458
}
459
for (int i=0; i<UNALIGN_OFF; i++) {
460
a1[i+UNALIGN_OFF] = -1;
461
}
462
test_cp_unalnsrc(a1, a1);
463
for (int i=0; i<UNALIGN_OFF; i++) {
464
errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (byte)-1);
465
}
466
for (int i=UNALIGN_OFF; i<ARRLEN; i++) {
467
int v = i%UNALIGN_OFF;
468
errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (byte)v);
469
}
470
for (int i=0; i<ARRLEN; i++) {
471
a1[i] = -1;
472
}
473
test_2ci_unaln(a1, a1);
474
for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) {
475
errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], (byte)-103);
476
}
477
for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) {
478
errn += verify("test_2ci_unaln_overlap: a1", i, a1[i], (byte)-123);
479
}
480
for (int i=0; i<ARRLEN; i++) {
481
a1[i] = -1;
482
}
483
test_2vi_unaln(a1, a1, (byte)123, (byte)103);
484
for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) {
485
errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], (byte)123);
486
}
487
for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) {
488
errn += verify("test_2vi_unaln_overlap: a1", i, a1[i], (byte)103);
489
}
490
491
}
492
493
if (errn > 0)
494
return errn;
495
496
System.out.println("Time");
497
long start, end;
498
start = System.currentTimeMillis();
499
for (int i=0; i<ITERS; i++) {
500
test_ci(a1);
501
}
502
end = System.currentTimeMillis();
503
System.out.println("test_ci: " + (end - start));
504
start = System.currentTimeMillis();
505
for (int i=0; i<ITERS; i++) {
506
test_vi(a2, (byte)123);
507
}
508
end = System.currentTimeMillis();
509
System.out.println("test_vi: " + (end - start));
510
start = System.currentTimeMillis();
511
for (int i=0; i<ITERS; i++) {
512
test_cp(a1, a2);
513
}
514
end = System.currentTimeMillis();
515
System.out.println("test_cp: " + (end - start));
516
start = System.currentTimeMillis();
517
for (int i=0; i<ITERS; i++) {
518
test_2ci(a1, a2);
519
}
520
end = System.currentTimeMillis();
521
System.out.println("test_2ci: " + (end - start));
522
start = System.currentTimeMillis();
523
for (int i=0; i<ITERS; i++) {
524
test_2vi(a1, a2, (byte)123, (byte)103);
525
}
526
end = System.currentTimeMillis();
527
System.out.println("test_2vi: " + (end - start));
528
529
start = System.currentTimeMillis();
530
for (int i=0; i<ITERS; i++) {
531
test_ci_neg(a1);
532
}
533
end = System.currentTimeMillis();
534
System.out.println("test_ci_neg: " + (end - start));
535
start = System.currentTimeMillis();
536
for (int i=0; i<ITERS; i++) {
537
test_vi_neg(a2, (byte)123);
538
}
539
end = System.currentTimeMillis();
540
System.out.println("test_vi_neg: " + (end - start));
541
start = System.currentTimeMillis();
542
for (int i=0; i<ITERS; i++) {
543
test_cp_neg(a1, a2);
544
}
545
end = System.currentTimeMillis();
546
System.out.println("test_cp_neg: " + (end - start));
547
start = System.currentTimeMillis();
548
for (int i=0; i<ITERS; i++) {
549
test_2ci_neg(a1, a2);
550
}
551
end = System.currentTimeMillis();
552
System.out.println("test_2ci_neg: " + (end - start));
553
start = System.currentTimeMillis();
554
for (int i=0; i<ITERS; i++) {
555
test_2vi_neg(a1, a2, (byte)123, (byte)103);
556
}
557
end = System.currentTimeMillis();
558
System.out.println("test_2vi_neg: " + (end - start));
559
560
start = System.currentTimeMillis();
561
for (int i=0; i<ITERS; i++) {
562
test_ci_oppos(a1);
563
}
564
end = System.currentTimeMillis();
565
System.out.println("test_ci_oppos: " + (end - start));
566
start = System.currentTimeMillis();
567
for (int i=0; i<ITERS; i++) {
568
test_vi_oppos(a2, (byte)123);
569
}
570
end = System.currentTimeMillis();
571
System.out.println("test_vi_oppos: " + (end - start));
572
start = System.currentTimeMillis();
573
for (int i=0; i<ITERS; i++) {
574
test_cp_oppos(a1, a2);
575
}
576
end = System.currentTimeMillis();
577
System.out.println("test_cp_oppos: " + (end - start));
578
start = System.currentTimeMillis();
579
for (int i=0; i<ITERS; i++) {
580
test_2ci_oppos(a1, a2);
581
}
582
end = System.currentTimeMillis();
583
System.out.println("test_2ci_oppos: " + (end - start));
584
start = System.currentTimeMillis();
585
for (int i=0; i<ITERS; i++) {
586
test_2vi_oppos(a1, a2, (byte)123, (byte)103);
587
}
588
end = System.currentTimeMillis();
589
System.out.println("test_2vi_oppos: " + (end - start));
590
591
start = System.currentTimeMillis();
592
for (int i=0; i<ITERS; i++) {
593
test_ci_off(a1);
594
}
595
end = System.currentTimeMillis();
596
System.out.println("test_ci_off: " + (end - start));
597
start = System.currentTimeMillis();
598
for (int i=0; i<ITERS; i++) {
599
test_vi_off(a2, (byte)123);
600
}
601
end = System.currentTimeMillis();
602
System.out.println("test_vi_off: " + (end - start));
603
start = System.currentTimeMillis();
604
for (int i=0; i<ITERS; i++) {
605
test_cp_off(a1, a2);
606
}
607
end = System.currentTimeMillis();
608
System.out.println("test_cp_off: " + (end - start));
609
start = System.currentTimeMillis();
610
for (int i=0; i<ITERS; i++) {
611
test_2ci_off(a1, a2);
612
}
613
end = System.currentTimeMillis();
614
System.out.println("test_2ci_off: " + (end - start));
615
start = System.currentTimeMillis();
616
for (int i=0; i<ITERS; i++) {
617
test_2vi_off(a1, a2, (byte)123, (byte)103);
618
}
619
end = System.currentTimeMillis();
620
System.out.println("test_2vi_off: " + (end - start));
621
622
start = System.currentTimeMillis();
623
for (int i=0; i<ITERS; i++) {
624
test_ci_inv(a1, OFFSET);
625
}
626
end = System.currentTimeMillis();
627
System.out.println("test_ci_inv: " + (end - start));
628
start = System.currentTimeMillis();
629
for (int i=0; i<ITERS; i++) {
630
test_vi_inv(a2, (byte)123, OFFSET);
631
}
632
end = System.currentTimeMillis();
633
System.out.println("test_vi_inv: " + (end - start));
634
start = System.currentTimeMillis();
635
for (int i=0; i<ITERS; i++) {
636
test_cp_inv(a1, a2, OFFSET);
637
}
638
end = System.currentTimeMillis();
639
System.out.println("test_cp_inv: " + (end - start));
640
start = System.currentTimeMillis();
641
for (int i=0; i<ITERS; i++) {
642
test_2ci_inv(a1, a2, OFFSET);
643
}
644
end = System.currentTimeMillis();
645
System.out.println("test_2ci_inv: " + (end - start));
646
start = System.currentTimeMillis();
647
for (int i=0; i<ITERS; i++) {
648
test_2vi_inv(a1, a2, (byte)123, (byte)103, OFFSET);
649
}
650
end = System.currentTimeMillis();
651
System.out.println("test_2vi_inv: " + (end - start));
652
653
start = System.currentTimeMillis();
654
for (int i=0; i<ITERS; i++) {
655
test_ci_scl(a1);
656
}
657
end = System.currentTimeMillis();
658
System.out.println("test_ci_scl: " + (end - start));
659
start = System.currentTimeMillis();
660
for (int i=0; i<ITERS; i++) {
661
test_vi_scl(a2, (byte)123);
662
}
663
end = System.currentTimeMillis();
664
System.out.println("test_vi_scl: " + (end - start));
665
start = System.currentTimeMillis();
666
for (int i=0; i<ITERS; i++) {
667
test_cp_scl(a1, a2);
668
}
669
end = System.currentTimeMillis();
670
System.out.println("test_cp_scl: " + (end - start));
671
start = System.currentTimeMillis();
672
for (int i=0; i<ITERS; i++) {
673
test_2ci_scl(a1, a2);
674
}
675
end = System.currentTimeMillis();
676
System.out.println("test_2ci_scl: " + (end - start));
677
start = System.currentTimeMillis();
678
for (int i=0; i<ITERS; i++) {
679
test_2vi_scl(a1, a2, (byte)123, (byte)103);
680
}
681
end = System.currentTimeMillis();
682
System.out.println("test_2vi_scl: " + (end - start));
683
684
start = System.currentTimeMillis();
685
for (int i=0; i<ITERS; i++) {
686
test_cp_alndst(a1, a2);
687
}
688
end = System.currentTimeMillis();
689
System.out.println("test_cp_alndst: " + (end - start));
690
start = System.currentTimeMillis();
691
for (int i=0; i<ITERS; i++) {
692
test_cp_alnsrc(a1, a2);
693
}
694
end = System.currentTimeMillis();
695
System.out.println("test_cp_alnsrc: " + (end - start));
696
start = System.currentTimeMillis();
697
for (int i=0; i<ITERS; i++) {
698
test_2ci_aln(a1, a2);
699
}
700
end = System.currentTimeMillis();
701
System.out.println("test_2ci_aln: " + (end - start));
702
start = System.currentTimeMillis();
703
for (int i=0; i<ITERS; i++) {
704
test_2vi_aln(a1, a2, (byte)123, (byte)103);
705
}
706
end = System.currentTimeMillis();
707
System.out.println("test_2vi_aln: " + (end - start));
708
709
start = System.currentTimeMillis();
710
for (int i=0; i<ITERS; i++) {
711
test_cp_unalndst(a1, a2);
712
}
713
end = System.currentTimeMillis();
714
System.out.println("test_cp_unalndst: " + (end - start));
715
start = System.currentTimeMillis();
716
for (int i=0; i<ITERS; i++) {
717
test_cp_unalnsrc(a1, a2);
718
}
719
end = System.currentTimeMillis();
720
System.out.println("test_cp_unalnsrc: " + (end - start));
721
start = System.currentTimeMillis();
722
for (int i=0; i<ITERS; i++) {
723
test_2ci_unaln(a1, a2);
724
}
725
end = System.currentTimeMillis();
726
System.out.println("test_2ci_unaln: " + (end - start));
727
start = System.currentTimeMillis();
728
for (int i=0; i<ITERS; i++) {
729
test_2vi_unaln(a1, a2, (byte)123, (byte)103);
730
}
731
end = System.currentTimeMillis();
732
System.out.println("test_2vi_unaln: " + (end - start));
733
734
return errn;
735
}
736
737
static void test_ci(byte[] a) {
738
for (int i = 0; i < a.length; i+=1) {
739
a[i] = -123;
740
}
741
}
742
static void test_vi(byte[] a, byte b) {
743
for (int i = 0; i < a.length; i+=1) {
744
a[i] = b;
745
}
746
}
747
static void test_cp(byte[] a, byte[] b) {
748
for (int i = 0; i < a.length; i+=1) {
749
a[i] = b[i];
750
}
751
}
752
static void test_2ci(byte[] a, byte[] b) {
753
for (int i = 0; i < a.length; i+=1) {
754
a[i] = -123;
755
b[i] = -103;
756
}
757
}
758
static void test_2vi(byte[] a, byte[] b, byte c, byte d) {
759
for (int i = 0; i < a.length; i+=1) {
760
a[i] = c;
761
b[i] = d;
762
}
763
}
764
static void test_ci_neg(byte[] a) {
765
for (int i = a.length-1; i >= 0; i-=1) {
766
a[i] = -123;
767
}
768
}
769
static void test_vi_neg(byte[] a, byte b) {
770
for (int i = a.length-1; i >= 0; i-=1) {
771
a[i] = b;
772
}
773
}
774
static void test_cp_neg(byte[] a, byte[] b) {
775
for (int i = a.length-1; i >= 0; i-=1) {
776
a[i] = b[i];
777
}
778
}
779
static void test_2ci_neg(byte[] a, byte[] b) {
780
for (int i = a.length-1; i >= 0; i-=1) {
781
a[i] = -123;
782
b[i] = -103;
783
}
784
}
785
static void test_2vi_neg(byte[] a, byte[] b, byte c, byte d) {
786
for (int i = a.length-1; i >= 0; i-=1) {
787
a[i] = c;
788
b[i] = d;
789
}
790
}
791
static void test_ci_oppos(byte[] a) {
792
int limit = a.length-1;
793
for (int i = 0; i < a.length; i+=1) {
794
a[limit-i] = -123;
795
}
796
}
797
static void test_vi_oppos(byte[] a, byte b) {
798
int limit = a.length-1;
799
for (int i = limit; i >= 0; i-=1) {
800
a[limit-i] = b;
801
}
802
}
803
static void test_cp_oppos(byte[] a, byte[] b) {
804
int limit = a.length-1;
805
for (int i = 0; i < a.length; i+=1) {
806
a[i] = b[limit-i];
807
}
808
}
809
static void test_2ci_oppos(byte[] a, byte[] b) {
810
int limit = a.length-1;
811
for (int i = 0; i < a.length; i+=1) {
812
a[limit-i] = -123;
813
b[i] = -103;
814
}
815
}
816
static void test_2vi_oppos(byte[] a, byte[] b, byte c, byte d) {
817
int limit = a.length-1;
818
for (int i = limit; i >= 0; i-=1) {
819
a[i] = c;
820
b[limit-i] = d;
821
}
822
}
823
static void test_ci_off(byte[] a) {
824
for (int i = 0; i < a.length-OFFSET; i+=1) {
825
a[i+OFFSET] = -123;
826
}
827
}
828
static void test_vi_off(byte[] a, byte b) {
829
for (int i = 0; i < a.length-OFFSET; i+=1) {
830
a[i+OFFSET] = b;
831
}
832
}
833
static void test_cp_off(byte[] a, byte[] b) {
834
for (int i = 0; i < a.length-OFFSET; i+=1) {
835
a[i+OFFSET] = b[i+OFFSET];
836
}
837
}
838
static void test_2ci_off(byte[] a, byte[] b) {
839
for (int i = 0; i < a.length-OFFSET; i+=1) {
840
a[i+OFFSET] = -123;
841
b[i+OFFSET] = -103;
842
}
843
}
844
static void test_2vi_off(byte[] a, byte[] b, byte c, byte d) {
845
for (int i = 0; i < a.length-OFFSET; i+=1) {
846
a[i+OFFSET] = c;
847
b[i+OFFSET] = d;
848
}
849
}
850
static void test_ci_inv(byte[] a, int k) {
851
for (int i = 0; i < a.length-k; i+=1) {
852
a[i+k] = -123;
853
}
854
}
855
static void test_vi_inv(byte[] a, byte b, int k) {
856
for (int i = 0; i < a.length-k; i+=1) {
857
a[i+k] = b;
858
}
859
}
860
static void test_cp_inv(byte[] a, byte[] b, int k) {
861
for (int i = 0; i < a.length-k; i+=1) {
862
a[i+k] = b[i+k];
863
}
864
}
865
static void test_2ci_inv(byte[] a, byte[] b, int k) {
866
for (int i = 0; i < a.length-k; i+=1) {
867
a[i+k] = -123;
868
b[i+k] = -103;
869
}
870
}
871
static void test_2vi_inv(byte[] a, byte[] b, byte c, byte d, int k) {
872
for (int i = 0; i < a.length-k; i+=1) {
873
a[i+k] = c;
874
b[i+k] = d;
875
}
876
}
877
static void test_ci_scl(byte[] a) {
878
for (int i = 0; i*SCALE < a.length; i+=1) {
879
a[i*SCALE] = -123;
880
}
881
}
882
static void test_vi_scl(byte[] a, byte b) {
883
for (int i = 0; i*SCALE < a.length; i+=1) {
884
a[i*SCALE] = b;
885
}
886
}
887
static void test_cp_scl(byte[] a, byte[] b) {
888
for (int i = 0; i*SCALE < a.length; i+=1) {
889
a[i*SCALE] = b[i*SCALE];
890
}
891
}
892
static void test_2ci_scl(byte[] a, byte[] b) {
893
for (int i = 0; i*SCALE < a.length; i+=1) {
894
a[i*SCALE] = -123;
895
b[i*SCALE] = -103;
896
}
897
}
898
static void test_2vi_scl(byte[] a, byte[] b, byte c, byte d) {
899
for (int i = 0; i*SCALE < a.length; i+=1) {
900
a[i*SCALE] = c;
901
b[i*SCALE] = d;
902
}
903
}
904
static void test_cp_alndst(byte[] a, byte[] b) {
905
for (int i = 0; i < a.length-ALIGN_OFF; i+=1) {
906
a[i+ALIGN_OFF] = b[i];
907
}
908
}
909
static void test_cp_alnsrc(byte[] a, byte[] b) {
910
for (int i = 0; i < a.length-ALIGN_OFF; i+=1) {
911
a[i] = b[i+ALIGN_OFF];
912
}
913
}
914
static void test_2ci_aln(byte[] a, byte[] b) {
915
for (int i = 0; i < a.length-ALIGN_OFF; i+=1) {
916
a[i+ALIGN_OFF] = -123;
917
b[i] = -103;
918
}
919
}
920
static void test_2vi_aln(byte[] a, byte[] b, byte c, byte d) {
921
for (int i = 0; i < a.length-ALIGN_OFF; i+=1) {
922
a[i] = c;
923
b[i+ALIGN_OFF] = d;
924
}
925
}
926
static void test_cp_unalndst(byte[] a, byte[] b) {
927
for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) {
928
a[i+UNALIGN_OFF] = b[i];
929
}
930
}
931
static void test_cp_unalnsrc(byte[] a, byte[] b) {
932
for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) {
933
a[i] = b[i+UNALIGN_OFF];
934
}
935
}
936
static void test_2ci_unaln(byte[] a, byte[] b) {
937
for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) {
938
a[i+UNALIGN_OFF] = -123;
939
b[i] = -103;
940
}
941
}
942
static void test_2vi_unaln(byte[] a, byte[] b, byte c, byte d) {
943
for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) {
944
a[i] = c;
945
b[i+UNALIGN_OFF] = d;
946
}
947
}
948
949
static int verify(String text, int i, byte elem, byte val) {
950
if (elem != val) {
951
System.err.println(text + "[" + i + "] = " + elem + " != " + val);
952
return 1;
953
}
954
return 0;
955
}
956
}
957
958