hotspot/test/compiler/7200264/TestIntVect.java
changeset 13894 068a8efe7203
equal deleted inserted replaced
13893:8ffaa5b97ca6 13894:068a8efe7203
       
     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 7200264
       
    28  * @summary 7192963 changes disabled shift vectors
       
    29  *
       
    30  * @run shell Test7200264.sh
       
    31  */
       
    32 
       
    33 /*
       
    34  * Copy of test/compiler/6340864/TestIntVect.java without performance tests.
       
    35  */
       
    36 public class TestIntVect {
       
    37   private static final int ARRLEN = 997;
       
    38   private static final int ITERS  = 11000;
       
    39   private static final int ADD_INIT = Integer.MAX_VALUE-500;
       
    40   private static final int BIT_MASK = 0xEC80F731;
       
    41   private static final int VALUE = 15;
       
    42   private static final int SHIFT = 32;
       
    43 
       
    44   public static void main(String args[]) {
       
    45     System.out.println("Testing Integer vectors");
       
    46     int errn = test();
       
    47     if (errn > 0) {
       
    48       System.err.println("FAILED: " + errn + " errors");
       
    49       System.exit(97);
       
    50     }
       
    51     System.out.println("PASSED");
       
    52   }
       
    53 
       
    54   static int test() {
       
    55     int[] a0 = new int[ARRLEN];
       
    56     int[] a1 = new int[ARRLEN];
       
    57     int[] a2 = new int[ARRLEN];
       
    58     int[] a3 = new int[ARRLEN];
       
    59     int[] a4 = new int[ARRLEN];
       
    60     long[] p2 = new long[ARRLEN/2];
       
    61     // Initialize
       
    62     int gold_sum = 0;
       
    63     for (int i=0; i<ARRLEN; i++) {
       
    64       int val = (int)(ADD_INIT+i);
       
    65       gold_sum += val;
       
    66       a1[i] = val;
       
    67       a2[i] = (int)VALUE;
       
    68       a3[i] = (int)-VALUE;
       
    69       a4[i] = (int)BIT_MASK;
       
    70     }
       
    71     System.out.println("Warmup");
       
    72     for (int i=0; i<ITERS; i++) {
       
    73       test_sum(a1);
       
    74       test_addc(a0, a1);
       
    75       test_addv(a0, a1, (int)VALUE);
       
    76       test_adda(a0, a1, a2);
       
    77       test_subc(a0, a1);
       
    78       test_subv(a0, a1, (int)VALUE);
       
    79       test_suba(a0, a1, a2);
       
    80       test_mulc(a0, a1);
       
    81       test_mulv(a0, a1, (int)VALUE);
       
    82       test_mula(a0, a1, a2);
       
    83       test_divc(a0, a1);
       
    84       test_divv(a0, a1, (int)VALUE);
       
    85       test_diva(a0, a1, a2);
       
    86       test_mulc_n(a0, a1);
       
    87       test_mulv(a0, a1, (int)-VALUE);
       
    88       test_mula(a0, a1, a3);
       
    89       test_divc_n(a0, a1);
       
    90       test_divv(a0, a1, (int)-VALUE);
       
    91       test_diva(a0, a1, a3);
       
    92       test_andc(a0, a1);
       
    93       test_andv(a0, a1, (int)BIT_MASK);
       
    94       test_anda(a0, a1, a4);
       
    95       test_orc(a0, a1);
       
    96       test_orv(a0, a1, (int)BIT_MASK);
       
    97       test_ora(a0, a1, a4);
       
    98       test_xorc(a0, a1);
       
    99       test_xorv(a0, a1, (int)BIT_MASK);
       
   100       test_xora(a0, a1, a4);
       
   101       test_sllc(a0, a1);
       
   102       test_sllv(a0, a1, VALUE);
       
   103       test_srlc(a0, a1);
       
   104       test_srlv(a0, a1, VALUE);
       
   105       test_srac(a0, a1);
       
   106       test_srav(a0, a1, VALUE);
       
   107       test_sllc_n(a0, a1);
       
   108       test_sllv(a0, a1, -VALUE);
       
   109       test_srlc_n(a0, a1);
       
   110       test_srlv(a0, a1, -VALUE);
       
   111       test_srac_n(a0, a1);
       
   112       test_srav(a0, a1, -VALUE);
       
   113       test_sllc_o(a0, a1);
       
   114       test_sllv(a0, a1, SHIFT);
       
   115       test_srlc_o(a0, a1);
       
   116       test_srlv(a0, a1, SHIFT);
       
   117       test_srac_o(a0, a1);
       
   118       test_srav(a0, a1, SHIFT);
       
   119       test_sllc_on(a0, a1);
       
   120       test_sllv(a0, a1, -SHIFT);
       
   121       test_srlc_on(a0, a1);
       
   122       test_srlv(a0, a1, -SHIFT);
       
   123       test_srac_on(a0, a1);
       
   124       test_srav(a0, a1, -SHIFT);
       
   125       test_pack2(p2, a1);
       
   126       test_unpack2(a0, p2);
       
   127       test_pack2_swap(p2, a1);
       
   128       test_unpack2_swap(a0, p2);
       
   129     }
       
   130     // Test and verify results
       
   131     System.out.println("Verification");
       
   132     int errn = 0;
       
   133     {
       
   134       int sum = test_sum(a1);
       
   135       if (sum != gold_sum) {
       
   136         System.err.println("test_sum:  " + sum + " != " + gold_sum);
       
   137         errn++;
       
   138       }
       
   139 
       
   140       test_addc(a0, a1);
       
   141       for (int i=0; i<ARRLEN; i++) {
       
   142         errn += verify("test_addc: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE));
       
   143       }
       
   144       test_addv(a0, a1, (int)VALUE);
       
   145       for (int i=0; i<ARRLEN; i++) {
       
   146         errn += verify("test_addv: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE));
       
   147       }
       
   148       test_adda(a0, a1, a2);
       
   149       for (int i=0; i<ARRLEN; i++) {
       
   150         errn += verify("test_adda: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE));
       
   151       }
       
   152 
       
   153       test_subc(a0, a1);
       
   154       for (int i=0; i<ARRLEN; i++) {
       
   155         errn += verify("test_subc: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE));
       
   156       }
       
   157       test_subv(a0, a1, (int)VALUE);
       
   158       for (int i=0; i<ARRLEN; i++) {
       
   159         errn += verify("test_subv: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE));
       
   160       }
       
   161       test_suba(a0, a1, a2);
       
   162       for (int i=0; i<ARRLEN; i++) {
       
   163         errn += verify("test_suba: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE));
       
   164       }
       
   165 
       
   166       test_mulc(a0, a1);
       
   167       for (int i=0; i<ARRLEN; i++) {
       
   168         errn += verify("test_mulc: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE));
       
   169       }
       
   170       test_mulv(a0, a1, (int)VALUE);
       
   171       for (int i=0; i<ARRLEN; i++) {
       
   172         errn += verify("test_mulv: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE));
       
   173       }
       
   174       test_mula(a0, a1, a2);
       
   175       for (int i=0; i<ARRLEN; i++) {
       
   176         errn += verify("test_mula: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE));
       
   177       }
       
   178 
       
   179       test_divc(a0, a1);
       
   180       for (int i=0; i<ARRLEN; i++) {
       
   181         errn += verify("test_divc: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE));
       
   182       }
       
   183       test_divv(a0, a1, (int)VALUE);
       
   184       for (int i=0; i<ARRLEN; i++) {
       
   185         errn += verify("test_divv: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE));
       
   186       }
       
   187       test_diva(a0, a1, a2);
       
   188       for (int i=0; i<ARRLEN; i++) {
       
   189         errn += verify("test_diva: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE));
       
   190       }
       
   191 
       
   192       test_mulc_n(a0, a1);
       
   193       for (int i=0; i<ARRLEN; i++) {
       
   194         errn += verify("test_mulc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE)));
       
   195       }
       
   196       test_mulv(a0, a1, (int)-VALUE);
       
   197       for (int i=0; i<ARRLEN; i++) {
       
   198         errn += verify("test_mulv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE)));
       
   199       }
       
   200       test_mula(a0, a1, a3);
       
   201       for (int i=0; i<ARRLEN; i++) {
       
   202         errn += verify("test_mula_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE)));
       
   203       }
       
   204 
       
   205       test_divc_n(a0, a1);
       
   206       for (int i=0; i<ARRLEN; i++) {
       
   207         errn += verify("test_divc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE)));
       
   208       }
       
   209       test_divv(a0, a1, (int)-VALUE);
       
   210       for (int i=0; i<ARRLEN; i++) {
       
   211         errn += verify("test_divv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE)));
       
   212       }
       
   213       test_diva(a0, a1, a3);
       
   214       for (int i=0; i<ARRLEN; i++) {
       
   215         errn += verify("test_diva_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE)));
       
   216       }
       
   217 
       
   218       test_andc(a0, a1);
       
   219       for (int i=0; i<ARRLEN; i++) {
       
   220         errn += verify("test_andc: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK));
       
   221       }
       
   222       test_andv(a0, a1, (int)BIT_MASK);
       
   223       for (int i=0; i<ARRLEN; i++) {
       
   224         errn += verify("test_andv: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK));
       
   225       }
       
   226       test_anda(a0, a1, a4);
       
   227       for (int i=0; i<ARRLEN; i++) {
       
   228         errn += verify("test_anda: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK));
       
   229       }
       
   230 
       
   231       test_orc(a0, a1);
       
   232       for (int i=0; i<ARRLEN; i++) {
       
   233         errn += verify("test_orc: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK));
       
   234       }
       
   235       test_orv(a0, a1, (int)BIT_MASK);
       
   236       for (int i=0; i<ARRLEN; i++) {
       
   237         errn += verify("test_orv: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK));
       
   238       }
       
   239       test_ora(a0, a1, a4);
       
   240       for (int i=0; i<ARRLEN; i++) {
       
   241         errn += verify("test_ora: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK));
       
   242       }
       
   243 
       
   244       test_xorc(a0, a1);
       
   245       for (int i=0; i<ARRLEN; i++) {
       
   246         errn += verify("test_xorc: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK));
       
   247       }
       
   248       test_xorv(a0, a1, (int)BIT_MASK);
       
   249       for (int i=0; i<ARRLEN; i++) {
       
   250         errn += verify("test_xorv: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK));
       
   251       }
       
   252       test_xora(a0, a1, a4);
       
   253       for (int i=0; i<ARRLEN; i++) {
       
   254         errn += verify("test_xora: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK));
       
   255       }
       
   256 
       
   257       test_sllc(a0, a1);
       
   258       for (int i=0; i<ARRLEN; i++) {
       
   259         errn += verify("test_sllc: ", i, a0[i], (int)((int)(ADD_INIT+i)<<VALUE));
       
   260       }
       
   261       test_sllv(a0, a1, VALUE);
       
   262       for (int i=0; i<ARRLEN; i++) {
       
   263         errn += verify("test_sllv: ", i, a0[i], (int)((int)(ADD_INIT+i)<<VALUE));
       
   264       }
       
   265 
       
   266       test_srlc(a0, a1);
       
   267       for (int i=0; i<ARRLEN; i++) {
       
   268         errn += verify("test_srlc: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>VALUE));
       
   269       }
       
   270       test_srlv(a0, a1, VALUE);
       
   271       for (int i=0; i<ARRLEN; i++) {
       
   272         errn += verify("test_srlv: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>VALUE));
       
   273       }
       
   274 
       
   275       test_srac(a0, a1);
       
   276       for (int i=0; i<ARRLEN; i++) {
       
   277         errn += verify("test_srac: ", i, a0[i], (int)((int)(ADD_INIT+i)>>VALUE));
       
   278       }
       
   279       test_srav(a0, a1, VALUE);
       
   280       for (int i=0; i<ARRLEN; i++) {
       
   281         errn += verify("test_srav: ", i, a0[i], (int)((int)(ADD_INIT+i)>>VALUE));
       
   282       }
       
   283 
       
   284       test_sllc_n(a0, a1);
       
   285       for (int i=0; i<ARRLEN; i++) {
       
   286         errn += verify("test_sllc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-VALUE)));
       
   287       }
       
   288       test_sllv(a0, a1, -VALUE);
       
   289       for (int i=0; i<ARRLEN; i++) {
       
   290         errn += verify("test_sllv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-VALUE)));
       
   291       }
       
   292 
       
   293       test_srlc_n(a0, a1);
       
   294       for (int i=0; i<ARRLEN; i++) {
       
   295         errn += verify("test_srlc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-VALUE)));
       
   296       }
       
   297       test_srlv(a0, a1, -VALUE);
       
   298       for (int i=0; i<ARRLEN; i++) {
       
   299         errn += verify("test_srlv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-VALUE)));
       
   300       }
       
   301 
       
   302       test_srac_n(a0, a1);
       
   303       for (int i=0; i<ARRLEN; i++) {
       
   304         errn += verify("test_srac_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-VALUE)));
       
   305       }
       
   306       test_srav(a0, a1, -VALUE);
       
   307       for (int i=0; i<ARRLEN; i++) {
       
   308         errn += verify("test_srav_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-VALUE)));
       
   309       }
       
   310 
       
   311       test_sllc_o(a0, a1);
       
   312       for (int i=0; i<ARRLEN; i++) {
       
   313         errn += verify("test_sllc_o: ", i, a0[i], (int)((int)(ADD_INIT+i)<<SHIFT));
       
   314       }
       
   315       test_sllv(a0, a1, SHIFT);
       
   316       for (int i=0; i<ARRLEN; i++) {
       
   317         errn += verify("test_sllv_o: ", i, a0[i], (int)((int)(ADD_INIT+i)<<SHIFT));
       
   318       }
       
   319 
       
   320       test_srlc_o(a0, a1);
       
   321       for (int i=0; i<ARRLEN; i++) {
       
   322         errn += verify("test_srlc_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>SHIFT));
       
   323       }
       
   324       test_srlv(a0, a1, SHIFT);
       
   325       for (int i=0; i<ARRLEN; i++) {
       
   326         errn += verify("test_srlv_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>SHIFT));
       
   327       }
       
   328 
       
   329       test_srac_o(a0, a1);
       
   330       for (int i=0; i<ARRLEN; i++) {
       
   331         errn += verify("test_srac_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>SHIFT));
       
   332       }
       
   333       test_srav(a0, a1, SHIFT);
       
   334       for (int i=0; i<ARRLEN; i++) {
       
   335         errn += verify("test_srav_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>SHIFT));
       
   336       }
       
   337 
       
   338       test_sllc_on(a0, a1);
       
   339       for (int i=0; i<ARRLEN; i++) {
       
   340         errn += verify("test_sllc_on: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-SHIFT)));
       
   341       }
       
   342       test_sllv(a0, a1, -SHIFT);
       
   343       for (int i=0; i<ARRLEN; i++) {
       
   344         errn += verify("test_sllv_on: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-SHIFT)));
       
   345       }
       
   346 
       
   347       test_srlc_on(a0, a1);
       
   348       for (int i=0; i<ARRLEN; i++) {
       
   349         errn += verify("test_srlc_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-SHIFT)));
       
   350       }
       
   351       test_srlv(a0, a1, -SHIFT);
       
   352       for (int i=0; i<ARRLEN; i++) {
       
   353         errn += verify("test_srlv_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-SHIFT)));
       
   354       }
       
   355 
       
   356       test_srac_on(a0, a1);
       
   357       for (int i=0; i<ARRLEN; i++) {
       
   358         errn += verify("test_srac_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT)));
       
   359       }
       
   360       test_srav(a0, a1, -SHIFT);
       
   361       for (int i=0; i<ARRLEN; i++) {
       
   362         errn += verify("test_srav_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT)));
       
   363       }
       
   364 
       
   365       test_pack2(p2, a1);
       
   366       for (int i=0; i<ARRLEN/2; i++) {
       
   367         errn += verify("test_pack2: ", i, p2[i], ((long)(ADD_INIT+2*i) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i+1) << 32));
       
   368       }
       
   369       for (int i=0; i<ARRLEN; i++) {
       
   370         a0[i] = -1;
       
   371       }
       
   372       test_unpack2(a0, p2);
       
   373       for (int i=0; i<(ARRLEN&(-2)); i++) {
       
   374         errn += verify("test_unpack2: ", i, a0[i], (ADD_INIT+i));
       
   375       }
       
   376 
       
   377       test_pack2_swap(p2, a1);
       
   378       for (int i=0; i<ARRLEN/2; i++) {
       
   379         errn += verify("test_pack2_swap: ", i, p2[i], ((long)(ADD_INIT+2*i+1) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i) << 32));
       
   380       }
       
   381       for (int i=0; i<ARRLEN; i++) {
       
   382         a0[i] = -1;
       
   383       }
       
   384       test_unpack2_swap(a0, p2);
       
   385       for (int i=0; i<(ARRLEN&(-2)); i++) {
       
   386         errn += verify("test_unpack2_swap: ", i, a0[i], (ADD_INIT+i));
       
   387       }
       
   388 
       
   389     }
       
   390 
       
   391     return errn;
       
   392   }
       
   393 
       
   394   static int test_sum(int[] a1) {
       
   395     int sum = 0;
       
   396     for (int i = 0; i < a1.length; i+=1) {
       
   397       sum += a1[i];
       
   398     }
       
   399     return sum;
       
   400   }
       
   401 
       
   402   static void test_addc(int[] a0, int[] a1) {
       
   403     for (int i = 0; i < a0.length; i+=1) {
       
   404       a0[i] = (int)(a1[i]+VALUE);
       
   405     }
       
   406   }
       
   407   static void test_addv(int[] a0, int[] a1, int b) {
       
   408     for (int i = 0; i < a0.length; i+=1) {
       
   409       a0[i] = (int)(a1[i]+b);
       
   410     }
       
   411   }
       
   412   static void test_adda(int[] a0, int[] a1, int[] a2) {
       
   413     for (int i = 0; i < a0.length; i+=1) {
       
   414       a0[i] = (int)(a1[i]+a2[i]);
       
   415     }
       
   416   }
       
   417 
       
   418   static void test_subc(int[] a0, int[] a1) {
       
   419     for (int i = 0; i < a0.length; i+=1) {
       
   420       a0[i] = (int)(a1[i]-VALUE);
       
   421     }
       
   422   }
       
   423   static void test_subv(int[] a0, int[] a1, int b) {
       
   424     for (int i = 0; i < a0.length; i+=1) {
       
   425       a0[i] = (int)(a1[i]-b);
       
   426     }
       
   427   }
       
   428   static void test_suba(int[] a0, int[] a1, int[] a2) {
       
   429     for (int i = 0; i < a0.length; i+=1) {
       
   430       a0[i] = (int)(a1[i]-a2[i]);
       
   431     }
       
   432   }
       
   433 
       
   434   static void test_mulc(int[] a0, int[] a1) {
       
   435     for (int i = 0; i < a0.length; i+=1) {
       
   436       a0[i] = (int)(a1[i]*VALUE);
       
   437     }
       
   438   }
       
   439   static void test_mulc_n(int[] a0, int[] a1) {
       
   440     for (int i = 0; i < a0.length; i+=1) {
       
   441       a0[i] = (int)(a1[i]*(-VALUE));
       
   442     }
       
   443   }
       
   444   static void test_mulv(int[] a0, int[] a1, int b) {
       
   445     for (int i = 0; i < a0.length; i+=1) {
       
   446       a0[i] = (int)(a1[i]*b);
       
   447     }
       
   448   }
       
   449   static void test_mula(int[] a0, int[] a1, int[] a2) {
       
   450     for (int i = 0; i < a0.length; i+=1) {
       
   451       a0[i] = (int)(a1[i]*a2[i]);
       
   452     }
       
   453   }
       
   454 
       
   455   static void test_divc(int[] a0, int[] a1) {
       
   456     for (int i = 0; i < a0.length; i+=1) {
       
   457       a0[i] = (int)(a1[i]/VALUE);
       
   458     }
       
   459   }
       
   460   static void test_divc_n(int[] a0, int[] a1) {
       
   461     for (int i = 0; i < a0.length; i+=1) {
       
   462       a0[i] = (int)(a1[i]/(-VALUE));
       
   463     }
       
   464   }
       
   465   static void test_divv(int[] a0, int[] a1, int b) {
       
   466     for (int i = 0; i < a0.length; i+=1) {
       
   467       a0[i] = (int)(a1[i]/b);
       
   468     }
       
   469   }
       
   470   static void test_diva(int[] a0, int[] a1, int[] a2) {
       
   471     for (int i = 0; i < a0.length; i+=1) {
       
   472       a0[i] = (int)(a1[i]/a2[i]);
       
   473     }
       
   474   }
       
   475 
       
   476   static void test_andc(int[] a0, int[] a1) {
       
   477     for (int i = 0; i < a0.length; i+=1) {
       
   478       a0[i] = (int)(a1[i]&BIT_MASK);
       
   479     }
       
   480   }
       
   481   static void test_andv(int[] a0, int[] a1, int b) {
       
   482     for (int i = 0; i < a0.length; i+=1) {
       
   483       a0[i] = (int)(a1[i]&b);
       
   484     }
       
   485   }
       
   486   static void test_anda(int[] a0, int[] a1, int[] a2) {
       
   487     for (int i = 0; i < a0.length; i+=1) {
       
   488       a0[i] = (int)(a1[i]&a2[i]);
       
   489     }
       
   490   }
       
   491 
       
   492   static void test_orc(int[] a0, int[] a1) {
       
   493     for (int i = 0; i < a0.length; i+=1) {
       
   494       a0[i] = (int)(a1[i]|BIT_MASK);
       
   495     }
       
   496   }
       
   497   static void test_orv(int[] a0, int[] a1, int b) {
       
   498     for (int i = 0; i < a0.length; i+=1) {
       
   499       a0[i] = (int)(a1[i]|b);
       
   500     }
       
   501   }
       
   502   static void test_ora(int[] a0, int[] a1, int[] a2) {
       
   503     for (int i = 0; i < a0.length; i+=1) {
       
   504       a0[i] = (int)(a1[i]|a2[i]);
       
   505     }
       
   506   }
       
   507 
       
   508   static void test_xorc(int[] a0, int[] a1) {
       
   509     for (int i = 0; i < a0.length; i+=1) {
       
   510       a0[i] = (int)(a1[i]^BIT_MASK);
       
   511     }
       
   512   }
       
   513   static void test_xorv(int[] a0, int[] a1, int b) {
       
   514     for (int i = 0; i < a0.length; i+=1) {
       
   515       a0[i] = (int)(a1[i]^b);
       
   516     }
       
   517   }
       
   518   static void test_xora(int[] a0, int[] a1, int[] a2) {
       
   519     for (int i = 0; i < a0.length; i+=1) {
       
   520       a0[i] = (int)(a1[i]^a2[i]);
       
   521     }
       
   522   }
       
   523 
       
   524   static void test_sllc(int[] a0, int[] a1) {
       
   525     for (int i = 0; i < a0.length; i+=1) {
       
   526       a0[i] = (int)(a1[i]<<VALUE);
       
   527     }
       
   528   }
       
   529   static void test_sllc_n(int[] a0, int[] a1) {
       
   530     for (int i = 0; i < a0.length; i+=1) {
       
   531       a0[i] = (int)(a1[i]<<(-VALUE));
       
   532     }
       
   533   }
       
   534   static void test_sllc_o(int[] a0, int[] a1) {
       
   535     for (int i = 0; i < a0.length; i+=1) {
       
   536       a0[i] = (int)(a1[i]<<SHIFT);
       
   537     }
       
   538   }
       
   539   static void test_sllc_on(int[] a0, int[] a1) {
       
   540     for (int i = 0; i < a0.length; i+=1) {
       
   541       a0[i] = (int)(a1[i]<<(-SHIFT));
       
   542     }
       
   543   }
       
   544   static void test_sllv(int[] a0, int[] a1, int b) {
       
   545     for (int i = 0; i < a0.length; i+=1) {
       
   546       a0[i] = (int)(a1[i]<<b);
       
   547     }
       
   548   }
       
   549 
       
   550   static void test_srlc(int[] a0, int[] a1) {
       
   551     for (int i = 0; i < a0.length; i+=1) {
       
   552       a0[i] = (int)(a1[i]>>>VALUE);
       
   553     }
       
   554   }
       
   555   static void test_srlc_n(int[] a0, int[] a1) {
       
   556     for (int i = 0; i < a0.length; i+=1) {
       
   557       a0[i] = (int)(a1[i]>>>(-VALUE));
       
   558     }
       
   559   }
       
   560   static void test_srlc_o(int[] a0, int[] a1) {
       
   561     for (int i = 0; i < a0.length; i+=1) {
       
   562       a0[i] = (int)(a1[i]>>>SHIFT);
       
   563     }
       
   564   }
       
   565   static void test_srlc_on(int[] a0, int[] a1) {
       
   566     for (int i = 0; i < a0.length; i+=1) {
       
   567       a0[i] = (int)(a1[i]>>>(-SHIFT));
       
   568     }
       
   569   }
       
   570   static void test_srlv(int[] a0, int[] a1, int b) {
       
   571     for (int i = 0; i < a0.length; i+=1) {
       
   572       a0[i] = (int)(a1[i]>>>b);
       
   573     }
       
   574   }
       
   575 
       
   576   static void test_srac(int[] a0, int[] a1) {
       
   577     for (int i = 0; i < a0.length; i+=1) {
       
   578       a0[i] = (int)(a1[i]>>VALUE);
       
   579     }
       
   580   }
       
   581   static void test_srac_n(int[] a0, int[] a1) {
       
   582     for (int i = 0; i < a0.length; i+=1) {
       
   583       a0[i] = (int)(a1[i]>>(-VALUE));
       
   584     }
       
   585   }
       
   586   static void test_srac_o(int[] a0, int[] a1) {
       
   587     for (int i = 0; i < a0.length; i+=1) {
       
   588       a0[i] = (int)(a1[i]>>SHIFT);
       
   589     }
       
   590   }
       
   591   static void test_srac_on(int[] a0, int[] a1) {
       
   592     for (int i = 0; i < a0.length; i+=1) {
       
   593       a0[i] = (int)(a1[i]>>(-SHIFT));
       
   594     }
       
   595   }
       
   596   static void test_srav(int[] a0, int[] a1, int b) {
       
   597     for (int i = 0; i < a0.length; i+=1) {
       
   598       a0[i] = (int)(a1[i]>>b);
       
   599     }
       
   600   }
       
   601 
       
   602   static void test_pack2(long[] p2, int[] a1) {
       
   603     if (p2.length*2 > a1.length) return;
       
   604     for (int i = 0; i < p2.length; i+=1) {
       
   605       long l0 = (long)a1[i*2+0];
       
   606       long l1 = (long)a1[i*2+1];
       
   607       p2[i] = (l1 << 32) | (l0 & 0xFFFFFFFFl);
       
   608     }
       
   609   }
       
   610   static void test_unpack2(int[] a0, long[] p2) {
       
   611     if (p2.length*2 > a0.length) return;
       
   612     for (int i = 0; i < p2.length; i+=1) {
       
   613       long l = p2[i];
       
   614       a0[i*2+0] = (int)(l & 0xFFFFFFFFl);
       
   615       a0[i*2+1] = (int)(l >> 32);
       
   616     }
       
   617   }
       
   618   static void test_pack2_swap(long[] p2, int[] a1) {
       
   619     if (p2.length*2 > a1.length) return;
       
   620     for (int i = 0; i < p2.length; i+=1) {
       
   621       long l0 = (long)a1[i*2+0];
       
   622       long l1 = (long)a1[i*2+1];
       
   623       p2[i] = (l0 << 32) | (l1 & 0xFFFFFFFFl);
       
   624     }
       
   625   }
       
   626   static void test_unpack2_swap(int[] a0, long[] p2) {
       
   627     if (p2.length*2 > a0.length) return;
       
   628     for (int i = 0; i < p2.length; i+=1) {
       
   629       long l = p2[i];
       
   630       a0[i*2+0] = (int)(l >> 32);
       
   631       a0[i*2+1] = (int)(l & 0xFFFFFFFFl);
       
   632     }
       
   633   }
       
   634 
       
   635   static int verify(String text, int i, int elem, int val) {
       
   636     if (elem != val) {
       
   637       System.err.println(text + "[" + i + "] = " + elem + " != " + val);
       
   638       return 1;
       
   639     }
       
   640     return 0;
       
   641   }
       
   642 
       
   643   static int verify(String text, int i, long elem, long val) {
       
   644     if (elem != val) {
       
   645       System.err.println(text + "[" + i + "] = " + Long.toHexString(elem) + " != " + Long.toHexString(val));
       
   646       return 1;
       
   647     }
       
   648     return 0;
       
   649   }
       
   650 }