1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/compiler/7119644/TestByteLongVect.java Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,571 @@ 1.4 +/* 1.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +/** 1.29 + * @test 1.30 + * @bug 7119644 1.31 + * @summary Increase superword's vector size up to 256 bits 1.32 + * 1.33 + * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestByteLongVect 1.34 + */ 1.35 + 1.36 +public class TestByteLongVect { 1.37 + private static final int ARRLEN = 997; 1.38 + private static final int ITERS = 11000; 1.39 + private static final int OFFSET = 3; 1.40 + private static final int SCALE = 2; 1.41 + private static final int ALIGN_OFF = 8; 1.42 + private static final int UNALIGN_OFF = 5; 1.43 + 1.44 + public static void main(String args[]) { 1.45 + System.out.println("Testing Byte + Long vectors"); 1.46 + int errn = test(); 1.47 + if (errn > 0) { 1.48 + System.err.println("FAILED: " + errn + " errors"); 1.49 + System.exit(97); 1.50 + } 1.51 + System.out.println("PASSED"); 1.52 + } 1.53 + 1.54 + static int test() { 1.55 + byte[] a1 = new byte[ARRLEN]; 1.56 + byte[] a2 = new byte[ARRLEN]; 1.57 + long[] b1 = new long[ARRLEN]; 1.58 + long[] b2 = new long[ARRLEN]; 1.59 + System.out.println("Warmup"); 1.60 + for (int i=0; i<ITERS; i++) { 1.61 + test_ci(a1, b1); 1.62 + test_vi(a2, b2, (byte)123, (long)103); 1.63 + test_cp(a1, a2, b1, b2); 1.64 + test_ci_neg(a1, b1); 1.65 + test_vi_neg(a1, b1, (byte)123, (long)103); 1.66 + test_cp_neg(a1, a2, b1, b2); 1.67 + test_ci_oppos(a1, b1); 1.68 + test_vi_oppos(a1, b1, (byte)123, (long)103); 1.69 + test_cp_oppos(a1, a2, b1, b2); 1.70 + test_ci_aln(a1, b1); 1.71 + test_vi_aln(a1, b1, (byte)123, (long)103); 1.72 + test_cp_alndst(a1, a2, b1, b2); 1.73 + test_cp_alnsrc(a1, a2, b1, b2); 1.74 + test_ci_unaln(a1, b1); 1.75 + test_vi_unaln(a1, b1, (byte)123, (long)103); 1.76 + test_cp_unalndst(a1, a2, b1, b2); 1.77 + test_cp_unalnsrc(a1, a2, b1, b2); 1.78 + } 1.79 + // Initialize 1.80 + for (int i=0; i<ARRLEN; i++) { 1.81 + a1[i] = -1; 1.82 + a2[i] = -1; 1.83 + b1[i] = -1; 1.84 + b2[i] = -1; 1.85 + } 1.86 + // Test and verify results 1.87 + System.out.println("Verification"); 1.88 + int errn = 0; 1.89 + { 1.90 + test_ci(a1, b1); 1.91 + for (int i=0; i<ARRLEN; i++) { 1.92 + errn += verify("test_ci: a1", i, a1[i], (byte)-123); 1.93 + errn += verify("test_ci: b1", i, b1[i], (long)-103); 1.94 + } 1.95 + test_vi(a2, b2, (byte)123, (long)103); 1.96 + for (int i=0; i<ARRLEN; i++) { 1.97 + errn += verify("test_vi: a2", i, a2[i], (byte)123); 1.98 + errn += verify("test_vi: b2", i, b2[i], (long)103); 1.99 + } 1.100 + test_cp(a1, a2, b1, b2); 1.101 + for (int i=0; i<ARRLEN; i++) { 1.102 + errn += verify("test_cp: a1", i, a1[i], (byte)123); 1.103 + errn += verify("test_cp: b1", i, b1[i], (long)103); 1.104 + } 1.105 + 1.106 + // Reset for negative stride 1.107 + for (int i=0; i<ARRLEN; i++) { 1.108 + a1[i] = -1; 1.109 + a2[i] = -1; 1.110 + b1[i] = -1; 1.111 + b2[i] = -1; 1.112 + } 1.113 + test_ci_neg(a1, b1); 1.114 + for (int i=0; i<ARRLEN; i++) { 1.115 + errn += verify("test_ci_neg: a1", i, a1[i], (byte)-123); 1.116 + errn += verify("test_ci_neg: b1", i, b1[i], (long)-103); 1.117 + } 1.118 + test_vi_neg(a2, b2, (byte)123, (long)103); 1.119 + for (int i=0; i<ARRLEN; i++) { 1.120 + errn += verify("test_vi_neg: a2", i, a2[i], (byte)123); 1.121 + errn += verify("test_vi_neg: b2", i, b2[i], (long)103); 1.122 + } 1.123 + test_cp_neg(a1, a2, b1, b2); 1.124 + for (int i=0; i<ARRLEN; i++) { 1.125 + errn += verify("test_cp_neg: a1", i, a1[i], (byte)123); 1.126 + errn += verify("test_cp_neg: b1", i, b1[i], (long)103); 1.127 + } 1.128 + 1.129 + // Reset for opposite stride 1.130 + for (int i=0; i<ARRLEN; i++) { 1.131 + a1[i] = -1; 1.132 + a2[i] = -1; 1.133 + b1[i] = -1; 1.134 + b2[i] = -1; 1.135 + } 1.136 + test_ci_oppos(a1, b1); 1.137 + for (int i=0; i<ARRLEN; i++) { 1.138 + errn += verify("test_ci_oppos: a1", i, a1[i], (byte)-123); 1.139 + errn += verify("test_ci_oppos: b1", i, b1[i], (long)-103); 1.140 + } 1.141 + test_vi_oppos(a2, b2, (byte)123, (long)103); 1.142 + for (int i=0; i<ARRLEN; i++) { 1.143 + errn += verify("test_vi_oppos: a2", i, a2[i], (byte)123); 1.144 + errn += verify("test_vi_oppos: b2", i, b2[i], (long)103); 1.145 + } 1.146 + test_cp_oppos(a1, a2, b1, b2); 1.147 + for (int i=0; i<ARRLEN; i++) { 1.148 + errn += verify("test_cp_oppos: a1", i, a1[i], (byte)123); 1.149 + errn += verify("test_cp_oppos: b1", i, b1[i], (long)103); 1.150 + } 1.151 + 1.152 + // Reset for 2 arrays with relative aligned offset 1.153 + for (int i=0; i<ARRLEN; i++) { 1.154 + a1[i] = -1; 1.155 + a2[i] = 123; 1.156 + b1[i] = -1; 1.157 + b2[i] = 123; 1.158 + } 1.159 + test_cp_alndst(a1, a2, b1, b2); 1.160 + for (int i=0; i<ALIGN_OFF; i++) { 1.161 + errn += verify("test_cp_alndst: a1", i, a1[i], (byte)-1); 1.162 + errn += verify("test_cp_alndst: b1", i, b1[i], (long)-1); 1.163 + } 1.164 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.165 + errn += verify("test_cp_alndst: a1", i, a1[i], (byte)123); 1.166 + errn += verify("test_cp_alndst: b1", i, b1[i], (long)123); 1.167 + } 1.168 + for (int i=0; i<ARRLEN; i++) { 1.169 + a2[i] = -123; 1.170 + b2[i] = -123; 1.171 + } 1.172 + test_cp_alnsrc(a1, a2, b1, b2); 1.173 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.174 + errn += verify("test_cp_alnsrc: a1", i, a1[i], (byte)-123); 1.175 + errn += verify("test_cp_alnsrc: b1", i, b1[i], (long)-123); 1.176 + } 1.177 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.178 + errn += verify("test_cp_alnsrc: a1", i, a1[i], (byte)123); 1.179 + errn += verify("test_cp_alnsrc: b1", i, b1[i], (long)123); 1.180 + } 1.181 + 1.182 + for (int i=0; i<ARRLEN; i++) { 1.183 + a1[i] = -1; 1.184 + b1[i] = -1; 1.185 + } 1.186 + test_ci_aln(a1, b1); 1.187 + for (int i=0; i<ALIGN_OFF; i++) { 1.188 + errn += verify("test_ci_aln: a1", i, a1[i], (byte)-1); 1.189 + } 1.190 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.191 + errn += verify("test_ci_aln: a1", i, a1[i], (byte)-123); 1.192 + } 1.193 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.194 + errn += verify("test_ci_aln: b1", i, b1[i], (long)-103); 1.195 + } 1.196 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.197 + errn += verify("test_ci_aln: b1", i, b1[i], (long)-1); 1.198 + } 1.199 + 1.200 + for (int i=0; i<ARRLEN; i++) { 1.201 + a1[i] = -1; 1.202 + b1[i] = -1; 1.203 + } 1.204 + test_vi_aln(a1, b1, (byte)123, (long)103); 1.205 + for (int i=0; i<ARRLEN-ALIGN_OFF; i++) { 1.206 + errn += verify("test_vi_aln: a1", i, a1[i], (byte)123); 1.207 + } 1.208 + for (int i=ARRLEN-ALIGN_OFF; i<ARRLEN; i++) { 1.209 + errn += verify("test_vi_aln: a1", i, a1[i], (byte)-1); 1.210 + } 1.211 + for (int i=0; i<ALIGN_OFF; i++) { 1.212 + errn += verify("test_vi_aln: b1", i, b1[i], (long)-1); 1.213 + } 1.214 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.215 + errn += verify("test_vi_aln: b1", i, b1[i], (long)103); 1.216 + } 1.217 + 1.218 + // Reset for 2 arrays with relative unaligned offset 1.219 + for (int i=0; i<ARRLEN; i++) { 1.220 + a1[i] = -1; 1.221 + a2[i] = 123; 1.222 + b1[i] = -1; 1.223 + b2[i] = 123; 1.224 + } 1.225 + test_cp_unalndst(a1, a2, b1, b2); 1.226 + for (int i=0; i<UNALIGN_OFF; i++) { 1.227 + errn += verify("test_cp_unalndst: a1", i, a1[i], (byte)-1); 1.228 + errn += verify("test_cp_unalndst: b1", i, b1[i], (long)-1); 1.229 + } 1.230 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.231 + errn += verify("test_cp_unalndst: a1", i, a1[i], (byte)123); 1.232 + errn += verify("test_cp_unalndst: b1", i, b1[i], (long)123); 1.233 + } 1.234 + for (int i=0; i<ARRLEN; i++) { 1.235 + a2[i] = -123; 1.236 + b2[i] = -123; 1.237 + } 1.238 + test_cp_unalnsrc(a1, a2, b1, b2); 1.239 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.240 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], (byte)-123); 1.241 + errn += verify("test_cp_unalnsrc: b1", i, b1[i], (long)-123); 1.242 + } 1.243 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.244 + errn += verify("test_cp_unalnsrc: a1", i, a1[i], (byte)123); 1.245 + errn += verify("test_cp_unalnsrc: b1", i, b1[i], (long)123); 1.246 + } 1.247 + for (int i=0; i<ARRLEN; i++) { 1.248 + a1[i] = -1; 1.249 + b1[i] = -1; 1.250 + } 1.251 + test_ci_unaln(a1, b1); 1.252 + for (int i=0; i<UNALIGN_OFF; i++) { 1.253 + errn += verify("test_ci_unaln: a1", i, a1[i], (byte)-1); 1.254 + } 1.255 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.256 + errn += verify("test_ci_unaln: a1", i, a1[i], (byte)-123); 1.257 + } 1.258 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.259 + errn += verify("test_ci_unaln: b1", i, b1[i], (long)-103); 1.260 + } 1.261 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.262 + errn += verify("test_ci_unaln: b1", i, b1[i], (long)-1); 1.263 + } 1.264 + for (int i=0; i<ARRLEN; i++) { 1.265 + a1[i] = -1; 1.266 + b1[i] = -1; 1.267 + } 1.268 + test_vi_unaln(a1, b1, (byte)123, (long)103); 1.269 + for (int i=0; i<ARRLEN-UNALIGN_OFF; i++) { 1.270 + errn += verify("test_vi_unaln: a1", i, a1[i], (byte)123); 1.271 + } 1.272 + for (int i=ARRLEN-UNALIGN_OFF; i<ARRLEN; i++) { 1.273 + errn += verify("test_vi_unaln: a1", i, a1[i], (byte)-1); 1.274 + } 1.275 + for (int i=0; i<UNALIGN_OFF; i++) { 1.276 + errn += verify("test_vi_unaln: b1", i, b1[i], (long)-1); 1.277 + } 1.278 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.279 + errn += verify("test_vi_unaln: b1", i, b1[i], (long)103); 1.280 + } 1.281 + 1.282 + // Reset for aligned overlap initialization 1.283 + for (int i=0; i<ALIGN_OFF; i++) { 1.284 + a1[i] = (byte)i; 1.285 + b1[i] = (long)i; 1.286 + } 1.287 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.288 + a1[i] = -1; 1.289 + b1[i] = -1; 1.290 + } 1.291 + test_cp_alndst(a1, a1, b1, b1); 1.292 + for (int i=0; i<ARRLEN; i++) { 1.293 + int v = i%ALIGN_OFF; 1.294 + errn += verify("test_cp_alndst_overlap: a1", i, a1[i], (byte)v); 1.295 + errn += verify("test_cp_alndst_overlap: b1", i, b1[i], (long)v); 1.296 + } 1.297 + for (int i=0; i<ALIGN_OFF; i++) { 1.298 + a1[i+ALIGN_OFF] = -1; 1.299 + b1[i+ALIGN_OFF] = -1; 1.300 + } 1.301 + test_cp_alnsrc(a1, a1, b1, b1); 1.302 + for (int i=0; i<ALIGN_OFF; i++) { 1.303 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (byte)-1); 1.304 + errn += verify("test_cp_alnsrc_overlap: b1", i, b1[i], (long)-1); 1.305 + } 1.306 + for (int i=ALIGN_OFF; i<ARRLEN; i++) { 1.307 + int v = i%ALIGN_OFF; 1.308 + errn += verify("test_cp_alnsrc_overlap: a1", i, a1[i], (byte)v); 1.309 + errn += verify("test_cp_alnsrc_overlap: b1", i, b1[i], (long)v); 1.310 + } 1.311 + 1.312 + // Reset for unaligned overlap initialization 1.313 + for (int i=0; i<UNALIGN_OFF; i++) { 1.314 + a1[i] = (byte)i; 1.315 + b1[i] = (long)i; 1.316 + } 1.317 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.318 + a1[i] = -1; 1.319 + b1[i] = -1; 1.320 + } 1.321 + test_cp_unalndst(a1, a1, b1, b1); 1.322 + for (int i=0; i<ARRLEN; i++) { 1.323 + int v = i%UNALIGN_OFF; 1.324 + errn += verify("test_cp_unalndst_overlap: a1", i, a1[i], (byte)v); 1.325 + errn += verify("test_cp_unalndst_overlap: b1", i, b1[i], (long)v); 1.326 + } 1.327 + for (int i=0; i<UNALIGN_OFF; i++) { 1.328 + a1[i+UNALIGN_OFF] = -1; 1.329 + b1[i+UNALIGN_OFF] = -1; 1.330 + } 1.331 + test_cp_unalnsrc(a1, a1, b1, b1); 1.332 + for (int i=0; i<UNALIGN_OFF; i++) { 1.333 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (byte)-1); 1.334 + errn += verify("test_cp_unalnsrc_overlap: b1", i, b1[i], (long)-1); 1.335 + } 1.336 + for (int i=UNALIGN_OFF; i<ARRLEN; i++) { 1.337 + int v = i%UNALIGN_OFF; 1.338 + errn += verify("test_cp_unalnsrc_overlap: a1", i, a1[i], (byte)v); 1.339 + errn += verify("test_cp_unalnsrc_overlap: b1", i, b1[i], (long)v); 1.340 + } 1.341 + 1.342 + } 1.343 + 1.344 + if (errn > 0) 1.345 + return errn; 1.346 + 1.347 + System.out.println("Time"); 1.348 + long start, end; 1.349 + start = System.currentTimeMillis(); 1.350 + for (int i=0; i<ITERS; i++) { 1.351 + test_ci(a1, b1); 1.352 + } 1.353 + end = System.currentTimeMillis(); 1.354 + System.out.println("test_ci: " + (end - start)); 1.355 + start = System.currentTimeMillis(); 1.356 + for (int i=0; i<ITERS; i++) { 1.357 + test_vi(a2, b2, (byte)123, (long)103); 1.358 + } 1.359 + end = System.currentTimeMillis(); 1.360 + System.out.println("test_vi: " + (end - start)); 1.361 + start = System.currentTimeMillis(); 1.362 + for (int i=0; i<ITERS; i++) { 1.363 + test_cp(a1, a2, b1, b2); 1.364 + } 1.365 + end = System.currentTimeMillis(); 1.366 + System.out.println("test_cp: " + (end - start)); 1.367 + start = System.currentTimeMillis(); 1.368 + for (int i=0; i<ITERS; i++) { 1.369 + test_ci_neg(a1, b1); 1.370 + } 1.371 + end = System.currentTimeMillis(); 1.372 + System.out.println("test_ci_neg: " + (end - start)); 1.373 + start = System.currentTimeMillis(); 1.374 + for (int i=0; i<ITERS; i++) { 1.375 + test_vi_neg(a1, b1, (byte)123, (long)103); 1.376 + } 1.377 + end = System.currentTimeMillis(); 1.378 + System.out.println("test_vi_neg: " + (end - start)); 1.379 + start = System.currentTimeMillis(); 1.380 + for (int i=0; i<ITERS; i++) { 1.381 + test_cp_neg(a1, a2, b1, b2); 1.382 + } 1.383 + end = System.currentTimeMillis(); 1.384 + System.out.println("test_cp_neg: " + (end - start)); 1.385 + start = System.currentTimeMillis(); 1.386 + for (int i=0; i<ITERS; i++) { 1.387 + test_ci_oppos(a1, b1); 1.388 + } 1.389 + end = System.currentTimeMillis(); 1.390 + System.out.println("test_ci_oppos: " + (end - start)); 1.391 + start = System.currentTimeMillis(); 1.392 + for (int i=0; i<ITERS; i++) { 1.393 + test_vi_oppos(a1, b1, (byte)123, (long)103); 1.394 + } 1.395 + end = System.currentTimeMillis(); 1.396 + System.out.println("test_vi_oppos: " + (end - start)); 1.397 + start = System.currentTimeMillis(); 1.398 + for (int i=0; i<ITERS; i++) { 1.399 + test_cp_oppos(a1, a2, b1, b2); 1.400 + } 1.401 + end = System.currentTimeMillis(); 1.402 + System.out.println("test_cp_oppos: " + (end - start)); 1.403 + start = System.currentTimeMillis(); 1.404 + for (int i=0; i<ITERS; i++) { 1.405 + test_ci_aln(a1, b1); 1.406 + } 1.407 + end = System.currentTimeMillis(); 1.408 + System.out.println("test_ci_aln: " + (end - start)); 1.409 + start = System.currentTimeMillis(); 1.410 + for (int i=0; i<ITERS; i++) { 1.411 + test_vi_aln(a1, b1, (byte)123, (long)103); 1.412 + } 1.413 + end = System.currentTimeMillis(); 1.414 + System.out.println("test_vi_aln: " + (end - start)); 1.415 + start = System.currentTimeMillis(); 1.416 + for (int i=0; i<ITERS; i++) { 1.417 + test_cp_alndst(a1, a2, b1, b2); 1.418 + } 1.419 + end = System.currentTimeMillis(); 1.420 + System.out.println("test_cp_alndst: " + (end - start)); 1.421 + start = System.currentTimeMillis(); 1.422 + for (int i=0; i<ITERS; i++) { 1.423 + test_cp_alnsrc(a1, a2, b1, b2); 1.424 + } 1.425 + end = System.currentTimeMillis(); 1.426 + System.out.println("test_cp_alnsrc: " + (end - start)); 1.427 + start = System.currentTimeMillis(); 1.428 + for (int i=0; i<ITERS; i++) { 1.429 + test_ci_unaln(a1, b1); 1.430 + } 1.431 + end = System.currentTimeMillis(); 1.432 + System.out.println("test_ci_unaln: " + (end - start)); 1.433 + start = System.currentTimeMillis(); 1.434 + for (int i=0; i<ITERS; i++) { 1.435 + test_vi_unaln(a1, b1, (byte)123, (long)103); 1.436 + } 1.437 + end = System.currentTimeMillis(); 1.438 + System.out.println("test_vi_unaln: " + (end - start)); 1.439 + start = System.currentTimeMillis(); 1.440 + for (int i=0; i<ITERS; i++) { 1.441 + test_cp_unalndst(a1, a2, b1, b2); 1.442 + } 1.443 + end = System.currentTimeMillis(); 1.444 + System.out.println("test_cp_unalndst: " + (end - start)); 1.445 + start = System.currentTimeMillis(); 1.446 + for (int i=0; i<ITERS; i++) { 1.447 + test_cp_unalnsrc(a1, a2, b1, b2); 1.448 + } 1.449 + end = System.currentTimeMillis(); 1.450 + System.out.println("test_cp_unalnsrc: " + (end - start)); 1.451 + return errn; 1.452 + } 1.453 + 1.454 + static void test_ci(byte[] a, long[] b) { 1.455 + for (int i = 0; i < a.length; i+=1) { 1.456 + a[i] = -123; 1.457 + b[i] = -103; 1.458 + } 1.459 + } 1.460 + static void test_vi(byte[] a, long[] b, byte c, long d) { 1.461 + for (int i = 0; i < a.length; i+=1) { 1.462 + a[i] = c; 1.463 + b[i] = d; 1.464 + } 1.465 + } 1.466 + static void test_cp(byte[] a, byte[] b, long[] c, long[] d) { 1.467 + for (int i = 0; i < a.length; i+=1) { 1.468 + a[i] = b[i]; 1.469 + c[i] = d[i]; 1.470 + } 1.471 + } 1.472 + static void test_ci_neg(byte[] a, long[] b) { 1.473 + for (int i = a.length-1; i >= 0; i-=1) { 1.474 + a[i] = -123; 1.475 + b[i] = -103; 1.476 + } 1.477 + } 1.478 + static void test_vi_neg(byte[] a, long[] b, byte c, long d) { 1.479 + for (int i = a.length-1; i >= 0; i-=1) { 1.480 + a[i] = c; 1.481 + b[i] = d; 1.482 + } 1.483 + } 1.484 + static void test_cp_neg(byte[] a, byte[] b, long[] c, long[] d) { 1.485 + for (int i = a.length-1; i >= 0; i-=1) { 1.486 + a[i] = b[i]; 1.487 + c[i] = d[i]; 1.488 + } 1.489 + } 1.490 + static void test_ci_oppos(byte[] a, long[] b) { 1.491 + int limit = a.length-1; 1.492 + for (int i = 0; i < a.length; i+=1) { 1.493 + a[limit-i] = -123; 1.494 + b[i] = -103; 1.495 + } 1.496 + } 1.497 + static void test_vi_oppos(byte[] a, long[] b, byte c, long d) { 1.498 + int limit = a.length-1; 1.499 + for (int i = a.length-1; i >= 0; i-=1) { 1.500 + a[i] = c; 1.501 + b[limit-i] = d; 1.502 + } 1.503 + } 1.504 + static void test_cp_oppos(byte[] a, byte[] b, long[] c, long[] d) { 1.505 + int limit = a.length-1; 1.506 + for (int i = 0; i < a.length; i+=1) { 1.507 + a[i] = b[limit-i]; 1.508 + c[limit-i] = d[i]; 1.509 + } 1.510 + } 1.511 + static void test_ci_aln(byte[] a, long[] b) { 1.512 + for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { 1.513 + a[i+ALIGN_OFF] = -123; 1.514 + b[i] = -103; 1.515 + } 1.516 + } 1.517 + static void test_vi_aln(byte[] a, long[] b, byte c, long d) { 1.518 + for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { 1.519 + a[i] = c; 1.520 + b[i+ALIGN_OFF] = d; 1.521 + } 1.522 + } 1.523 + static void test_cp_alndst(byte[] a, byte[] b, long[] c, long[] d) { 1.524 + for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { 1.525 + a[i+ALIGN_OFF] = b[i]; 1.526 + c[i+ALIGN_OFF] = d[i]; 1.527 + } 1.528 + } 1.529 + static void test_cp_alnsrc(byte[] a, byte[] b, long[] c, long[] d) { 1.530 + for (int i = 0; i < a.length-ALIGN_OFF; i+=1) { 1.531 + a[i] = b[i+ALIGN_OFF]; 1.532 + c[i] = d[i+ALIGN_OFF]; 1.533 + } 1.534 + } 1.535 + static void test_ci_unaln(byte[] a, long[] b) { 1.536 + for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { 1.537 + a[i+UNALIGN_OFF] = -123; 1.538 + b[i] = -103; 1.539 + } 1.540 + } 1.541 + static void test_vi_unaln(byte[] a, long[] b, byte c, long d) { 1.542 + for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { 1.543 + a[i] = c; 1.544 + b[i+UNALIGN_OFF] = d; 1.545 + } 1.546 + } 1.547 + static void test_cp_unalndst(byte[] a, byte[] b, long[] c, long[] d) { 1.548 + for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { 1.549 + a[i+UNALIGN_OFF] = b[i]; 1.550 + c[i+UNALIGN_OFF] = d[i]; 1.551 + } 1.552 + } 1.553 + static void test_cp_unalnsrc(byte[] a, byte[] b, long[] c, long[] d) { 1.554 + for (int i = 0; i < a.length-UNALIGN_OFF; i+=1) { 1.555 + a[i] = b[i+UNALIGN_OFF]; 1.556 + c[i] = d[i+UNALIGN_OFF]; 1.557 + } 1.558 + } 1.559 + 1.560 + static int verify(String text, int i, byte elem, byte val) { 1.561 + if (elem != val) { 1.562 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 1.563 + return 1; 1.564 + } 1.565 + return 0; 1.566 + } 1.567 + static int verify(String text, int i, long elem, long val) { 1.568 + if (elem != val) { 1.569 + System.err.println(text + "[" + i + "] = " + elem + " != " + val); 1.570 + return 1; 1.571 + } 1.572 + return 0; 1.573 + } 1.574 +}