rev 52603 : 8213134: AArch64: vector shift failed with MaxVectorSize=8
Summary: add vshiftcnt instructions for vector64 and add vsra/vsrl instructions to AArch64 backend.
To detect shift failures, MaxVectorSize options are added to jtreg test cases.
Reviewed-by: duke

   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 6340864
  27  * @summary Implement vectorization optimizations in hotspot-server
  28  *
  29  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestFloatVect



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