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