Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/compiler/6340864/TestShortVect.java
32285 views
/*1* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324/**25* @test26* @bug 634086427* @summary Implement vectorization optimizations in hotspot-server28*29* @run main/othervm/timeout=400 -Xbatch -Xmx64m TestShortVect30*/3132public class TestShortVect {33private static final int ARRLEN = 997;34private static final int ITERS = 11000;35private static final int ADD_INIT = Short.MAX_VALUE-500;36private static final int BIT_MASK = 0xB731;37private static final int VALUE = 7;38private static final int SHIFT = 16;3940public static void main(String args[]) {41System.out.println("Testing Short vectors");42int errn = test();43if (errn > 0) {44System.err.println("FAILED: " + errn + " errors");45System.exit(97);46}47System.out.println("PASSED");48}4950static int test() {51short[] a0 = new short[ARRLEN];52short[] a1 = new short[ARRLEN];53short[] a2 = new short[ARRLEN];54short[] a3 = new short[ARRLEN];55short[] a4 = new short[ARRLEN];56int[] p2 = new int[ARRLEN/2];57long[] p4 = new long[ARRLEN/4];58// Initialize59int gold_sum = 0;60for (int i=0; i<ARRLEN; i++) {61short val = (short)(ADD_INIT+i);62gold_sum += val;63a1[i] = val;64a2[i] = (short)VALUE;65a3[i] = (short)-VALUE;66a4[i] = (short)BIT_MASK;67}68System.out.println("Warmup");69for (int i=0; i<ITERS; i++) {70test_sum(a1);71test_addc(a0, a1);72test_addv(a0, a1, (short)VALUE);73test_adda(a0, a1, a2);74test_subc(a0, a1);75test_subv(a0, a1, (short)VALUE);76test_suba(a0, a1, a2);7778test_mulc(a0, a1);79test_mulv(a0, a1, (short)VALUE);80test_mula(a0, a1, a2);81test_divc(a0, a1);82test_divv(a0, a1, (short)VALUE);83test_diva(a0, a1, a2);84test_mulc_n(a0, a1);85test_mulv(a0, a1, (short)-VALUE);86test_mula(a0, a1, a3);87test_divc_n(a0, a1);88test_divv(a0, a1, (short)-VALUE);89test_diva(a0, a1, a3);9091test_andc(a0, a1);92test_andv(a0, a1, (short)BIT_MASK);93test_anda(a0, a1, a4);94test_orc(a0, a1);95test_orv(a0, a1, (short)BIT_MASK);96test_ora(a0, a1, a4);97test_xorc(a0, a1);98test_xorv(a0, a1, (short)BIT_MASK);99test_xora(a0, a1, a4);100101test_sllc(a0, a1);102test_sllv(a0, a1, VALUE);103test_srlc(a0, a1);104test_srlv(a0, a1, VALUE);105test_srac(a0, a1);106test_srav(a0, a1, VALUE);107108test_sllc_n(a0, a1);109test_sllv(a0, a1, -VALUE);110test_srlc_n(a0, a1);111test_srlv(a0, a1, -VALUE);112test_srac_n(a0, a1);113test_srav(a0, a1, -VALUE);114115test_sllc_o(a0, a1);116test_sllv(a0, a1, SHIFT);117test_srlc_o(a0, a1);118test_srlv(a0, a1, SHIFT);119test_srac_o(a0, a1);120test_srav(a0, a1, SHIFT);121122test_sllc_on(a0, a1);123test_sllv(a0, a1, -SHIFT);124test_srlc_on(a0, a1);125test_srlv(a0, a1, -SHIFT);126test_srac_on(a0, a1);127test_srav(a0, a1, -SHIFT);128129test_sllc_add(a0, a1);130test_sllv_add(a0, a1, ADD_INIT);131test_srlc_add(a0, a1);132test_srlv_add(a0, a1, ADD_INIT);133test_srac_add(a0, a1);134test_srav_add(a0, a1, ADD_INIT);135136test_sllc_and(a0, a1);137test_sllv_and(a0, a1, BIT_MASK);138test_srlc_and(a0, a1);139test_srlv_and(a0, a1, BIT_MASK);140test_srac_and(a0, a1);141test_srav_and(a0, a1, BIT_MASK);142143test_pack2(p2, a1);144test_unpack2(a0, p2);145test_pack2_swap(p2, a1);146test_unpack2_swap(a0, p2);147test_pack4(p4, a1);148test_unpack4(a0, p4);149test_pack4_swap(p4, a1);150test_unpack4_swap(a0, p4);151}152// Test and verify results153System.out.println("Verification");154int errn = 0;155{156int sum = test_sum(a1);157if (sum != gold_sum) {158System.err.println("test_sum: " + sum + " != " + gold_sum);159errn++;160}161162test_addc(a0, a1);163for (int i=0; i<ARRLEN; i++) {164errn += verify("test_addc: ", i, a0[i], (short)((short)(ADD_INIT+i)+VALUE));165}166test_addv(a0, a1, (short)VALUE);167for (int i=0; i<ARRLEN; i++) {168errn += verify("test_addv: ", i, a0[i], (short)((short)(ADD_INIT+i)+VALUE));169}170test_adda(a0, a1, a2);171for (int i=0; i<ARRLEN; i++) {172errn += verify("test_adda: ", i, a0[i], (short)((short)(ADD_INIT+i)+VALUE));173}174175test_subc(a0, a1);176for (int i=0; i<ARRLEN; i++) {177errn += verify("test_subc: ", i, a0[i], (short)((short)(ADD_INIT+i)-VALUE));178}179test_subv(a0, a1, (short)VALUE);180for (int i=0; i<ARRLEN; i++) {181errn += verify("test_subv: ", i, a0[i], (short)((short)(ADD_INIT+i)-VALUE));182}183test_suba(a0, a1, a2);184for (int i=0; i<ARRLEN; i++) {185errn += verify("test_suba: ", i, a0[i], (short)((short)(ADD_INIT+i)-VALUE));186}187188test_mulc(a0, a1);189for (int i=0; i<ARRLEN; i++) {190errn += verify("test_mulc: ", i, a0[i], (short)((short)(ADD_INIT+i)*VALUE));191}192test_mulv(a0, a1, (short)VALUE);193for (int i=0; i<ARRLEN; i++) {194errn += verify("test_mulv: ", i, a0[i], (short)((short)(ADD_INIT+i)*VALUE));195}196test_mula(a0, a1, a2);197for (int i=0; i<ARRLEN; i++) {198errn += verify("test_mula: ", i, a0[i], (short)((short)(ADD_INIT+i)*VALUE));199}200201test_divc(a0, a1);202for (int i=0; i<ARRLEN; i++) {203errn += verify("test_divc: ", i, a0[i], (short)((short)(ADD_INIT+i)/VALUE));204}205test_divv(a0, a1, (short)VALUE);206for (int i=0; i<ARRLEN; i++) {207errn += verify("test_divv: ", i, a0[i], (short)((short)(ADD_INIT+i)/VALUE));208}209test_diva(a0, a1, a2);210for (int i=0; i<ARRLEN; i++) {211errn += verify("test_diva: ", i, a0[i], (short)((short)(ADD_INIT+i)/VALUE));212}213214test_mulc_n(a0, a1);215for (int i=0; i<ARRLEN; i++) {216errn += verify("test_mulc_n: ", i, a0[i], (short)((short)(ADD_INIT+i)*(-VALUE)));217}218test_mulv(a0, a1, (short)-VALUE);219for (int i=0; i<ARRLEN; i++) {220errn += verify("test_mulv_n: ", i, a0[i], (short)((short)(ADD_INIT+i)*(-VALUE)));221}222test_mula(a0, a1, a3);223for (int i=0; i<ARRLEN; i++) {224errn += verify("test_mula_n: ", i, a0[i], (short)((short)(ADD_INIT+i)*(-VALUE)));225}226227test_divc_n(a0, a1);228for (int i=0; i<ARRLEN; i++) {229errn += verify("test_divc_n: ", i, a0[i], (short)((short)(ADD_INIT+i)/(-VALUE)));230}231test_divv(a0, a1, (short)-VALUE);232for (int i=0; i<ARRLEN; i++) {233errn += verify("test_divv_n: ", i, a0[i], (short)((short)(ADD_INIT+i)/(-VALUE)));234}235test_diva(a0, a1, a3);236for (int i=0; i<ARRLEN; i++) {237errn += verify("test_diva_n: ", i, a0[i], (short)((short)(ADD_INIT+i)/(-VALUE)));238}239240test_andc(a0, a1);241for (int i=0; i<ARRLEN; i++) {242errn += verify("test_andc: ", i, a0[i], (short)((short)(ADD_INIT+i)&BIT_MASK));243}244test_andv(a0, a1, (short)BIT_MASK);245for (int i=0; i<ARRLEN; i++) {246errn += verify("test_andv: ", i, a0[i], (short)((short)(ADD_INIT+i)&BIT_MASK));247}248test_anda(a0, a1, a4);249for (int i=0; i<ARRLEN; i++) {250errn += verify("test_anda: ", i, a0[i], (short)((short)(ADD_INIT+i)&BIT_MASK));251}252253test_orc(a0, a1);254for (int i=0; i<ARRLEN; i++) {255errn += verify("test_orc: ", i, a0[i], (short)((short)(ADD_INIT+i)|BIT_MASK));256}257test_orv(a0, a1, (short)BIT_MASK);258for (int i=0; i<ARRLEN; i++) {259errn += verify("test_orv: ", i, a0[i], (short)((short)(ADD_INIT+i)|BIT_MASK));260}261test_ora(a0, a1, a4);262for (int i=0; i<ARRLEN; i++) {263errn += verify("test_ora: ", i, a0[i], (short)((short)(ADD_INIT+i)|BIT_MASK));264}265266test_xorc(a0, a1);267for (int i=0; i<ARRLEN; i++) {268errn += verify("test_xorc: ", i, a0[i], (short)((short)(ADD_INIT+i)^BIT_MASK));269}270test_xorv(a0, a1, (short)BIT_MASK);271for (int i=0; i<ARRLEN; i++) {272errn += verify("test_xorv: ", i, a0[i], (short)((short)(ADD_INIT+i)^BIT_MASK));273}274test_xora(a0, a1, a4);275for (int i=0; i<ARRLEN; i++) {276errn += verify("test_xora: ", i, a0[i], (short)((short)(ADD_INIT+i)^BIT_MASK));277}278279test_sllc(a0, a1);280for (int i=0; i<ARRLEN; i++) {281errn += verify("test_sllc: ", i, a0[i], (short)((short)(ADD_INIT+i)<<VALUE));282}283test_sllv(a0, a1, VALUE);284for (int i=0; i<ARRLEN; i++) {285errn += verify("test_sllv: ", i, a0[i], (short)((short)(ADD_INIT+i)<<VALUE));286}287288test_srlc(a0, a1);289for (int i=0; i<ARRLEN; i++) {290errn += verify("test_srlc: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>VALUE));291}292test_srlv(a0, a1, VALUE);293for (int i=0; i<ARRLEN; i++) {294errn += verify("test_srlv: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>VALUE));295}296297test_srac(a0, a1);298for (int i=0; i<ARRLEN; i++) {299errn += verify("test_srac: ", i, a0[i], (short)((short)(ADD_INIT+i)>>VALUE));300}301test_srav(a0, a1, VALUE);302for (int i=0; i<ARRLEN; i++) {303errn += verify("test_srav: ", i, a0[i], (short)((short)(ADD_INIT+i)>>VALUE));304}305306test_sllc_n(a0, a1);307for (int i=0; i<ARRLEN; i++) {308errn += verify("test_sllc_n: ", i, a0[i], (short)((short)(ADD_INIT+i)<<(-VALUE)));309}310test_sllv(a0, a1, -VALUE);311for (int i=0; i<ARRLEN; i++) {312errn += verify("test_sllv_n: ", i, a0[i], (short)((short)(ADD_INIT+i)<<(-VALUE)));313}314315test_srlc_n(a0, a1);316for (int i=0; i<ARRLEN; i++) {317errn += verify("test_srlc_n: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>(-VALUE)));318}319test_srlv(a0, a1, -VALUE);320for (int i=0; i<ARRLEN; i++) {321errn += verify("test_srlv_n: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>(-VALUE)));322}323324test_srac_n(a0, a1);325for (int i=0; i<ARRLEN; i++) {326errn += verify("test_srac_n: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-VALUE)));327}328test_srav(a0, a1, -VALUE);329for (int i=0; i<ARRLEN; i++) {330errn += verify("test_srav_n: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-VALUE)));331}332333test_sllc_o(a0, a1);334for (int i=0; i<ARRLEN; i++) {335errn += verify("test_sllc_o: ", i, a0[i], (short)((short)(ADD_INIT+i)<<SHIFT));336}337test_sllv(a0, a1, SHIFT);338for (int i=0; i<ARRLEN; i++) {339errn += verify("test_sllv_o: ", i, a0[i], (short)((short)(ADD_INIT+i)<<SHIFT));340}341342test_srlc_o(a0, a1);343for (int i=0; i<ARRLEN; i++) {344errn += verify("test_srlc_o: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>SHIFT));345}346test_srlv(a0, a1, SHIFT);347for (int i=0; i<ARRLEN; i++) {348errn += verify("test_srlv_o: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>SHIFT));349}350351test_srac_o(a0, a1);352for (int i=0; i<ARRLEN; i++) {353errn += verify("test_srac_o: ", i, a0[i], (short)((short)(ADD_INIT+i)>>SHIFT));354}355test_srav(a0, a1, SHIFT);356for (int i=0; i<ARRLEN; i++) {357errn += verify("test_srav_o: ", i, a0[i], (short)((short)(ADD_INIT+i)>>SHIFT));358}359360test_sllc_on(a0, a1);361for (int i=0; i<ARRLEN; i++) {362errn += verify("test_sllc_on: ", i, a0[i], (short)((short)(ADD_INIT+i)<<(-SHIFT)));363}364test_sllv(a0, a1, -SHIFT);365for (int i=0; i<ARRLEN; i++) {366errn += verify("test_sllv_on: ", i, a0[i], (short)((short)(ADD_INIT+i)<<(-SHIFT)));367}368369test_srlc_on(a0, a1);370for (int i=0; i<ARRLEN; i++) {371errn += verify("test_srlc_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>(-SHIFT)));372}373test_srlv(a0, a1, -SHIFT);374for (int i=0; i<ARRLEN; i++) {375errn += verify("test_srlv_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>>(-SHIFT)));376}377378test_srac_on(a0, a1);379for (int i=0; i<ARRLEN; i++) {380errn += verify("test_srac_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-SHIFT)));381}382test_srav(a0, a1, -SHIFT);383for (int i=0; i<ARRLEN; i++) {384errn += verify("test_srav_on: ", i, a0[i], (short)((short)(ADD_INIT+i)>>(-SHIFT)));385}386387test_sllc_add(a0, a1);388for (int i=0; i<ARRLEN; i++) {389errn += verify("test_sllc_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)<<VALUE));390}391test_sllv_add(a0, a1, ADD_INIT);392for (int i=0; i<ARRLEN; i++) {393errn += verify("test_sllv_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)<<VALUE));394}395396test_srlc_add(a0, a1);397for (int i=0; i<ARRLEN; i++) {398errn += verify("test_srlc_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>>VALUE));399}400test_srlv_add(a0, a1, ADD_INIT);401for (int i=0; i<ARRLEN; i++) {402errn += verify("test_srlv_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>>VALUE));403}404405test_srac_add(a0, a1);406for (int i=0; i<ARRLEN; i++) {407errn += verify("test_srac_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>VALUE));408}409test_srav_add(a0, a1, ADD_INIT);410for (int i=0; i<ARRLEN; i++) {411errn += verify("test_srav_add: ", i, a0[i], (short)(((short)(ADD_INIT+i) + ADD_INIT)>>VALUE));412}413414test_sllc_and(a0, a1);415for (int i=0; i<ARRLEN; i++) {416errn += verify("test_sllc_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)<<VALUE));417}418test_sllv_and(a0, a1, BIT_MASK);419for (int i=0; i<ARRLEN; i++) {420errn += verify("test_sllv_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)<<VALUE));421}422423test_srlc_and(a0, a1);424for (int i=0; i<ARRLEN; i++) {425errn += verify("test_srlc_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>>VALUE));426}427test_srlv_and(a0, a1, BIT_MASK);428for (int i=0; i<ARRLEN; i++) {429errn += verify("test_srlv_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>>VALUE));430}431432test_srac_and(a0, a1);433for (int i=0; i<ARRLEN; i++) {434errn += verify("test_srac_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>VALUE));435}436test_srav_and(a0, a1, BIT_MASK);437for (int i=0; i<ARRLEN; i++) {438errn += verify("test_srav_and: ", i, a0[i], (short)(((short)(ADD_INIT+i) & BIT_MASK)>>VALUE));439}440441test_pack2(p2, a1);442for (int i=0; i<ARRLEN/2; i++) {443errn += verify("test_pack2: ", i, p2[i], ((int)(ADD_INIT+2*i) & 0xFFFF) | ((int)(ADD_INIT+2*i+1) << 16));444}445for (int i=0; i<ARRLEN; i++) {446a0[i] = -1;447}448test_unpack2(a0, p2);449for (int i=0; i<(ARRLEN&(-2)); i++) {450errn += verify("test_unpack2: ", i, a0[i], (short)(ADD_INIT+i));451}452453test_pack2_swap(p2, a1);454for (int i=0; i<ARRLEN/2; i++) {455errn += verify("test_pack2_swap: ", i, p2[i], ((int)(ADD_INIT+2*i+1) & 0xFFFF) | ((int)(ADD_INIT+2*i) << 16));456}457for (int i=0; i<ARRLEN; i++) {458a0[i] = -1;459}460test_unpack2_swap(a0, p2);461for (int i=0; i<(ARRLEN&(-2)); i++) {462errn += verify("test_unpack2_swap: ", i, a0[i], (short)(ADD_INIT+i));463}464465test_pack4(p4, a1);466for (int i=0; i<ARRLEN/4; i++) {467errn += verify("test_pack4: ", i, p4[i], ((long)(ADD_INIT+4*i+0) & 0xFFFFl) |468(((long)(ADD_INIT+4*i+1) & 0xFFFFl) << 16) |469(((long)(ADD_INIT+4*i+2) & 0xFFFFl) << 32) |470(((long)(ADD_INIT+4*i+3) & 0xFFFFl) << 48));471}472for (int i=0; i<ARRLEN; i++) {473a0[i] = -1;474}475test_unpack4(a0, p4);476for (int i=0; i<(ARRLEN&(-4)); i++) {477errn += verify("test_unpack4: ", i, a0[i], (short)(ADD_INIT+i));478}479480test_pack4_swap(p4, a1);481for (int i=0; i<ARRLEN/4; i++) {482errn += verify("test_pack4_swap: ", i, p4[i], ((long)(ADD_INIT+4*i+3) & 0xFFFFl) |483(((long)(ADD_INIT+4*i+2) & 0xFFFFl) << 16) |484(((long)(ADD_INIT+4*i+1) & 0xFFFFl) << 32) |485(((long)(ADD_INIT+4*i+0) & 0xFFFFl) << 48));486}487for (int i=0; i<ARRLEN; i++) {488a0[i] = -1;489}490test_unpack4_swap(a0, p4);491for (int i=0; i<(ARRLEN&(-4)); i++) {492errn += verify("test_unpack4_swap: ", i, a0[i], (short)(ADD_INIT+i));493}494495}496497if (errn > 0)498return errn;499500System.out.println("Time");501long start, end;502503start = System.currentTimeMillis();504for (int i=0; i<ITERS; i++) {505test_sum(a1);506}507end = System.currentTimeMillis();508System.out.println("test_sum: " + (end - start));509510start = System.currentTimeMillis();511for (int i=0; i<ITERS; i++) {512test_addc(a0, a1);513}514end = System.currentTimeMillis();515System.out.println("test_addc: " + (end - start));516start = System.currentTimeMillis();517for (int i=0; i<ITERS; i++) {518test_addv(a0, a1, (short)VALUE);519}520end = System.currentTimeMillis();521System.out.println("test_addv: " + (end - start));522start = System.currentTimeMillis();523for (int i=0; i<ITERS; i++) {524test_adda(a0, a1, a2);525}526end = System.currentTimeMillis();527System.out.println("test_adda: " + (end - start));528529start = System.currentTimeMillis();530for (int i=0; i<ITERS; i++) {531test_subc(a0, a1);532}533end = System.currentTimeMillis();534System.out.println("test_subc: " + (end - start));535start = System.currentTimeMillis();536for (int i=0; i<ITERS; i++) {537test_subv(a0, a1, (short)VALUE);538}539end = System.currentTimeMillis();540System.out.println("test_subv: " + (end - start));541start = System.currentTimeMillis();542for (int i=0; i<ITERS; i++) {543test_suba(a0, a1, a2);544}545end = System.currentTimeMillis();546System.out.println("test_suba: " + (end - start));547548start = System.currentTimeMillis();549for (int i=0; i<ITERS; i++) {550test_mulc(a0, a1);551}552end = System.currentTimeMillis();553System.out.println("test_mulc: " + (end - start));554start = System.currentTimeMillis();555for (int i=0; i<ITERS; i++) {556test_mulv(a0, a1, (short)VALUE);557}558end = System.currentTimeMillis();559System.out.println("test_mulv: " + (end - start));560start = System.currentTimeMillis();561for (int i=0; i<ITERS; i++) {562test_mula(a0, a1, a2);563}564end = System.currentTimeMillis();565System.out.println("test_mula: " + (end - start));566567start = System.currentTimeMillis();568for (int i=0; i<ITERS; i++) {569test_divc(a0, a1);570}571end = System.currentTimeMillis();572System.out.println("test_divc: " + (end - start));573start = System.currentTimeMillis();574for (int i=0; i<ITERS; i++) {575test_divv(a0, a1, (short)VALUE);576}577end = System.currentTimeMillis();578System.out.println("test_divv: " + (end - start));579start = System.currentTimeMillis();580for (int i=0; i<ITERS; i++) {581test_diva(a0, a1, a2);582}583end = System.currentTimeMillis();584System.out.println("test_diva: " + (end - start));585586start = System.currentTimeMillis();587for (int i=0; i<ITERS; i++) {588test_mulc_n(a0, a1);589}590end = System.currentTimeMillis();591System.out.println("test_mulc_n: " + (end - start));592start = System.currentTimeMillis();593for (int i=0; i<ITERS; i++) {594test_mulv(a0, a1, (short)-VALUE);595}596end = System.currentTimeMillis();597System.out.println("test_mulv_n: " + (end - start));598start = System.currentTimeMillis();599for (int i=0; i<ITERS; i++) {600test_mula(a0, a1, a3);601}602end = System.currentTimeMillis();603System.out.println("test_mula_n: " + (end - start));604605start = System.currentTimeMillis();606for (int i=0; i<ITERS; i++) {607test_divc_n(a0, a1);608}609end = System.currentTimeMillis();610System.out.println("test_divc_n: " + (end - start));611start = System.currentTimeMillis();612for (int i=0; i<ITERS; i++) {613test_divv(a0, a1, (short)-VALUE);614}615end = System.currentTimeMillis();616System.out.println("test_divv_n: " + (end - start));617start = System.currentTimeMillis();618for (int i=0; i<ITERS; i++) {619test_diva(a0, a1, a3);620}621end = System.currentTimeMillis();622System.out.println("test_diva_n: " + (end - start));623624start = System.currentTimeMillis();625for (int i=0; i<ITERS; i++) {626test_andc(a0, a1);627}628end = System.currentTimeMillis();629System.out.println("test_andc: " + (end - start));630start = System.currentTimeMillis();631for (int i=0; i<ITERS; i++) {632test_andv(a0, a1, (short)BIT_MASK);633}634end = System.currentTimeMillis();635System.out.println("test_andv: " + (end - start));636start = System.currentTimeMillis();637for (int i=0; i<ITERS; i++) {638test_anda(a0, a1, a4);639}640end = System.currentTimeMillis();641System.out.println("test_anda: " + (end - start));642643start = System.currentTimeMillis();644for (int i=0; i<ITERS; i++) {645test_orc(a0, a1);646}647end = System.currentTimeMillis();648System.out.println("test_orc: " + (end - start));649start = System.currentTimeMillis();650for (int i=0; i<ITERS; i++) {651test_orv(a0, a1, (short)BIT_MASK);652}653end = System.currentTimeMillis();654System.out.println("test_orv: " + (end - start));655start = System.currentTimeMillis();656for (int i=0; i<ITERS; i++) {657test_ora(a0, a1, a4);658}659end = System.currentTimeMillis();660System.out.println("test_ora: " + (end - start));661662start = System.currentTimeMillis();663for (int i=0; i<ITERS; i++) {664test_xorc(a0, a1);665}666end = System.currentTimeMillis();667System.out.println("test_xorc: " + (end - start));668start = System.currentTimeMillis();669for (int i=0; i<ITERS; i++) {670test_xorv(a0, a1, (short)BIT_MASK);671}672end = System.currentTimeMillis();673System.out.println("test_xorv: " + (end - start));674start = System.currentTimeMillis();675for (int i=0; i<ITERS; i++) {676test_xora(a0, a1, a4);677}678end = System.currentTimeMillis();679System.out.println("test_xora: " + (end - start));680681start = System.currentTimeMillis();682for (int i=0; i<ITERS; i++) {683test_sllc(a0, a1);684}685end = System.currentTimeMillis();686System.out.println("test_sllc: " + (end - start));687start = System.currentTimeMillis();688for (int i=0; i<ITERS; i++) {689test_sllv(a0, a1, VALUE);690}691end = System.currentTimeMillis();692System.out.println("test_sllv: " + (end - start));693694start = System.currentTimeMillis();695for (int i=0; i<ITERS; i++) {696test_srlc(a0, a1);697}698end = System.currentTimeMillis();699System.out.println("test_srlc: " + (end - start));700start = System.currentTimeMillis();701for (int i=0; i<ITERS; i++) {702test_srlv(a0, a1, VALUE);703}704end = System.currentTimeMillis();705System.out.println("test_srlv: " + (end - start));706707start = System.currentTimeMillis();708for (int i=0; i<ITERS; i++) {709test_srac(a0, a1);710}711end = System.currentTimeMillis();712System.out.println("test_srac: " + (end - start));713start = System.currentTimeMillis();714for (int i=0; i<ITERS; i++) {715test_srav(a0, a1, VALUE);716}717end = System.currentTimeMillis();718System.out.println("test_srav: " + (end - start));719720start = System.currentTimeMillis();721for (int i=0; i<ITERS; i++) {722test_sllc_n(a0, a1);723}724end = System.currentTimeMillis();725System.out.println("test_sllc_n: " + (end - start));726start = System.currentTimeMillis();727for (int i=0; i<ITERS; i++) {728test_sllv(a0, a1, -VALUE);729}730end = System.currentTimeMillis();731System.out.println("test_sllv_n: " + (end - start));732733start = System.currentTimeMillis();734for (int i=0; i<ITERS; i++) {735test_srlc_n(a0, a1);736}737end = System.currentTimeMillis();738System.out.println("test_srlc_n: " + (end - start));739start = System.currentTimeMillis();740for (int i=0; i<ITERS; i++) {741test_srlv(a0, a1, -VALUE);742}743end = System.currentTimeMillis();744System.out.println("test_srlv_n: " + (end - start));745746start = System.currentTimeMillis();747for (int i=0; i<ITERS; i++) {748test_srac_n(a0, a1);749}750end = System.currentTimeMillis();751System.out.println("test_srac_n: " + (end - start));752start = System.currentTimeMillis();753for (int i=0; i<ITERS; i++) {754test_srav(a0, a1, -VALUE);755}756end = System.currentTimeMillis();757System.out.println("test_srav_n: " + (end - start));758759start = System.currentTimeMillis();760for (int i=0; i<ITERS; i++) {761test_sllc_o(a0, a1);762}763end = System.currentTimeMillis();764System.out.println("test_sllc_o: " + (end - start));765start = System.currentTimeMillis();766for (int i=0; i<ITERS; i++) {767test_sllv(a0, a1, SHIFT);768}769end = System.currentTimeMillis();770System.out.println("test_sllv_o: " + (end - start));771772start = System.currentTimeMillis();773for (int i=0; i<ITERS; i++) {774test_srlc_o(a0, a1);775}776end = System.currentTimeMillis();777System.out.println("test_srlc_o: " + (end - start));778start = System.currentTimeMillis();779for (int i=0; i<ITERS; i++) {780test_srlv(a0, a1, SHIFT);781}782end = System.currentTimeMillis();783System.out.println("test_srlv_o: " + (end - start));784785start = System.currentTimeMillis();786for (int i=0; i<ITERS; i++) {787test_srac_o(a0, a1);788}789end = System.currentTimeMillis();790System.out.println("test_srac_o: " + (end - start));791start = System.currentTimeMillis();792for (int i=0; i<ITERS; i++) {793test_srav(a0, a1, SHIFT);794}795end = System.currentTimeMillis();796System.out.println("test_srav_o: " + (end - start));797798start = System.currentTimeMillis();799for (int i=0; i<ITERS; i++) {800test_sllc_on(a0, a1);801}802end = System.currentTimeMillis();803System.out.println("test_sllc_on: " + (end - start));804start = System.currentTimeMillis();805for (int i=0; i<ITERS; i++) {806test_sllv(a0, a1, -SHIFT);807}808end = System.currentTimeMillis();809System.out.println("test_sllv_on: " + (end - start));810811start = System.currentTimeMillis();812for (int i=0; i<ITERS; i++) {813test_srlc_on(a0, a1);814}815end = System.currentTimeMillis();816System.out.println("test_srlc_on: " + (end - start));817start = System.currentTimeMillis();818for (int i=0; i<ITERS; i++) {819test_srlv(a0, a1, -SHIFT);820}821end = System.currentTimeMillis();822System.out.println("test_srlv_on: " + (end - start));823824start = System.currentTimeMillis();825for (int i=0; i<ITERS; i++) {826test_srac_on(a0, a1);827}828end = System.currentTimeMillis();829System.out.println("test_srac_on: " + (end - start));830start = System.currentTimeMillis();831for (int i=0; i<ITERS; i++) {832test_srav(a0, a1, -SHIFT);833}834end = System.currentTimeMillis();835System.out.println("test_srav_on: " + (end - start));836837start = System.currentTimeMillis();838for (int i=0; i<ITERS; i++) {839test_sllc_add(a0, a1);840}841end = System.currentTimeMillis();842System.out.println("test_sllc_add: " + (end - start));843start = System.currentTimeMillis();844for (int i=0; i<ITERS; i++) {845test_sllv_add(a0, a1, ADD_INIT);846}847end = System.currentTimeMillis();848System.out.println("test_sllv_add: " + (end - start));849850start = System.currentTimeMillis();851for (int i=0; i<ITERS; i++) {852test_srlc_add(a0, a1);853}854end = System.currentTimeMillis();855System.out.println("test_srlc_add: " + (end - start));856start = System.currentTimeMillis();857for (int i=0; i<ITERS; i++) {858test_srlv_add(a0, a1, ADD_INIT);859}860end = System.currentTimeMillis();861System.out.println("test_srlv_add: " + (end - start));862863start = System.currentTimeMillis();864for (int i=0; i<ITERS; i++) {865test_srac_add(a0, a1);866}867end = System.currentTimeMillis();868System.out.println("test_srac_add: " + (end - start));869start = System.currentTimeMillis();870for (int i=0; i<ITERS; i++) {871test_srav_add(a0, a1, ADD_INIT);872}873end = System.currentTimeMillis();874System.out.println("test_srav_add: " + (end - start));875876start = System.currentTimeMillis();877for (int i=0; i<ITERS; i++) {878test_sllc_and(a0, a1);879}880end = System.currentTimeMillis();881System.out.println("test_sllc_and: " + (end - start));882start = System.currentTimeMillis();883for (int i=0; i<ITERS; i++) {884test_sllv_and(a0, a1, BIT_MASK);885}886end = System.currentTimeMillis();887System.out.println("test_sllv_and: " + (end - start));888889start = System.currentTimeMillis();890for (int i=0; i<ITERS; i++) {891test_srlc_and(a0, a1);892}893end = System.currentTimeMillis();894System.out.println("test_srlc_and: " + (end - start));895start = System.currentTimeMillis();896for (int i=0; i<ITERS; i++) {897test_srlv_and(a0, a1, BIT_MASK);898}899end = System.currentTimeMillis();900System.out.println("test_srlv_and: " + (end - start));901902start = System.currentTimeMillis();903for (int i=0; i<ITERS; i++) {904test_srac_and(a0, a1);905}906end = System.currentTimeMillis();907System.out.println("test_srac_and: " + (end - start));908start = System.currentTimeMillis();909for (int i=0; i<ITERS; i++) {910test_srav_and(a0, a1, BIT_MASK);911}912end = System.currentTimeMillis();913System.out.println("test_srav_and: " + (end - start));914915start = System.currentTimeMillis();916for (int i=0; i<ITERS; i++) {917test_pack2(p2, a1);918}919end = System.currentTimeMillis();920System.out.println("test_pack2: " + (end - start));921start = System.currentTimeMillis();922for (int i=0; i<ITERS; i++) {923test_unpack2(a0, p2);924}925end = System.currentTimeMillis();926System.out.println("test_unpack2: " + (end - start));927start = System.currentTimeMillis();928for (int i=0; i<ITERS; i++) {929test_pack2_swap(p2, a1);930}931end = System.currentTimeMillis();932System.out.println("test_pack2_swap: " + (end - start));933start = System.currentTimeMillis();934for (int i=0; i<ITERS; i++) {935test_unpack2_swap(a0, p2);936}937end = System.currentTimeMillis();938System.out.println("test_unpack2_swap: " + (end - start));939940start = System.currentTimeMillis();941for (int i=0; i<ITERS; i++) {942test_pack4(p4, a1);943}944end = System.currentTimeMillis();945System.out.println("test_pack4: " + (end - start));946start = System.currentTimeMillis();947for (int i=0; i<ITERS; i++) {948test_unpack4(a0, p4);949}950end = System.currentTimeMillis();951System.out.println("test_unpack4: " + (end - start));952start = System.currentTimeMillis();953for (int i=0; i<ITERS; i++) {954test_pack4_swap(p4, a1);955}956end = System.currentTimeMillis();957System.out.println("test_pack4_swap: " + (end - start));958start = System.currentTimeMillis();959for (int i=0; i<ITERS; i++) {960test_unpack4_swap(a0, p4);961}962end = System.currentTimeMillis();963System.out.println("test_unpack4_swap: " + (end - start));964965return errn;966}967968static int test_sum(short[] a1) {969int sum = 0;970for (int i = 0; i < a1.length; i+=1) {971sum += a1[i];972}973return sum;974}975976static void test_addc(short[] a0, short[] a1) {977for (int i = 0; i < a0.length; i+=1) {978a0[i] = (short)(a1[i]+VALUE);979}980}981static void test_addv(short[] a0, short[] a1, short b) {982for (int i = 0; i < a0.length; i+=1) {983a0[i] = (short)(a1[i]+b);984}985}986static void test_adda(short[] a0, short[] a1, short[] a2) {987for (int i = 0; i < a0.length; i+=1) {988a0[i] = (short)(a1[i]+a2[i]);989}990}991992static void test_subc(short[] a0, short[] a1) {993for (int i = 0; i < a0.length; i+=1) {994a0[i] = (short)(a1[i]-VALUE);995}996}997static void test_subv(short[] a0, short[] a1, short b) {998for (int i = 0; i < a0.length; i+=1) {999a0[i] = (short)(a1[i]-b);1000}1001}1002static void test_suba(short[] a0, short[] a1, short[] a2) {1003for (int i = 0; i < a0.length; i+=1) {1004a0[i] = (short)(a1[i]-a2[i]);1005}1006}10071008static void test_mulc(short[] a0, short[] a1) {1009for (int i = 0; i < a0.length; i+=1) {1010a0[i] = (short)(a1[i]*VALUE);1011}1012}1013static void test_mulc_n(short[] a0, short[] a1) {1014for (int i = 0; i < a0.length; i+=1) {1015a0[i] = (short)(a1[i]*(-VALUE));1016}1017}1018static void test_mulv(short[] a0, short[] a1, short b) {1019for (int i = 0; i < a0.length; i+=1) {1020a0[i] = (short)(a1[i]*b);1021}1022}1023static void test_mula(short[] a0, short[] a1, short[] a2) {1024for (int i = 0; i < a0.length; i+=1) {1025a0[i] = (short)(a1[i]*a2[i]);1026}1027}10281029static void test_divc(short[] a0, short[] a1) {1030for (int i = 0; i < a0.length; i+=1) {1031a0[i] = (short)(a1[i]/VALUE);1032}1033}1034static void test_divc_n(short[] a0, short[] a1) {1035for (int i = 0; i < a0.length; i+=1) {1036a0[i] = (short)(a1[i]/(-VALUE));1037}1038}1039static void test_divv(short[] a0, short[] a1, short b) {1040for (int i = 0; i < a0.length; i+=1) {1041a0[i] = (short)(a1[i]/b);1042}1043}1044static void test_diva(short[] a0, short[] a1, short[] a2) {1045for (int i = 0; i < a0.length; i+=1) {1046a0[i] = (short)(a1[i]/a2[i]);1047}1048}10491050static void test_andc(short[] a0, short[] a1) {1051for (int i = 0; i < a0.length; i+=1) {1052a0[i] = (short)(a1[i]&BIT_MASK);1053}1054}1055static void test_andv(short[] a0, short[] a1, short b) {1056for (int i = 0; i < a0.length; i+=1) {1057a0[i] = (short)(a1[i]&b);1058}1059}1060static void test_anda(short[] a0, short[] a1, short[] a2) {1061for (int i = 0; i < a0.length; i+=1) {1062a0[i] = (short)(a1[i]&a2[i]);1063}1064}10651066static void test_orc(short[] a0, short[] a1) {1067for (int i = 0; i < a0.length; i+=1) {1068a0[i] = (short)(a1[i]|BIT_MASK);1069}1070}1071static void test_orv(short[] a0, short[] a1, short b) {1072for (int i = 0; i < a0.length; i+=1) {1073a0[i] = (short)(a1[i]|b);1074}1075}1076static void test_ora(short[] a0, short[] a1, short[] a2) {1077for (int i = 0; i < a0.length; i+=1) {1078a0[i] = (short)(a1[i]|a2[i]);1079}1080}10811082static void test_xorc(short[] a0, short[] a1) {1083for (int i = 0; i < a0.length; i+=1) {1084a0[i] = (short)(a1[i]^BIT_MASK);1085}1086}1087static void test_xorv(short[] a0, short[] a1, short b) {1088for (int i = 0; i < a0.length; i+=1) {1089a0[i] = (short)(a1[i]^b);1090}1091}1092static void test_xora(short[] a0, short[] a1, short[] a2) {1093for (int i = 0; i < a0.length; i+=1) {1094a0[i] = (short)(a1[i]^a2[i]);1095}1096}10971098static void test_sllc(short[] a0, short[] a1) {1099for (int i = 0; i < a0.length; i+=1) {1100a0[i] = (short)(a1[i]<<VALUE);1101}1102}1103static void test_sllc_n(short[] a0, short[] a1) {1104for (int i = 0; i < a0.length; i+=1) {1105a0[i] = (short)(a1[i]<<(-VALUE));1106}1107}1108static void test_sllc_o(short[] a0, short[] a1) {1109for (int i = 0; i < a0.length; i+=1) {1110a0[i] = (short)(a1[i]<<SHIFT);1111}1112}1113static void test_sllc_on(short[] a0, short[] a1) {1114for (int i = 0; i < a0.length; i+=1) {1115a0[i] = (short)(a1[i]<<(-SHIFT));1116}1117}1118static void test_sllv(short[] a0, short[] a1, int b) {1119for (int i = 0; i < a0.length; i+=1) {1120a0[i] = (short)(a1[i]<<b);1121}1122}1123static void test_sllc_add(short[] a0, short[] a1) {1124for (int i = 0; i < a0.length; i+=1) {1125a0[i] = (short)((a1[i] + ADD_INIT)<<VALUE);1126}1127}1128static void test_sllv_add(short[] a0, short[] a1, int b) {1129for (int i = 0; i < a0.length; i+=1) {1130a0[i] = (short)((a1[i] + b)<<VALUE);1131}1132}1133static void test_sllc_and(short[] a0, short[] a1) {1134for (int i = 0; i < a0.length; i+=1) {1135a0[i] = (short)((a1[i] & BIT_MASK)<<VALUE);1136}1137}1138static void test_sllv_and(short[] a0, short[] a1, int b) {1139for (int i = 0; i < a0.length; i+=1) {1140a0[i] = (short)((a1[i] & b)<<VALUE);1141}1142}11431144static void test_srlc(short[] a0, short[] a1) {1145for (int i = 0; i < a0.length; i+=1) {1146a0[i] = (short)(a1[i]>>>VALUE);1147}1148}1149static void test_srlc_n(short[] a0, short[] a1) {1150for (int i = 0; i < a0.length; i+=1) {1151a0[i] = (short)(a1[i]>>>(-VALUE));1152}1153}1154static void test_srlc_o(short[] a0, short[] a1) {1155for (int i = 0; i < a0.length; i+=1) {1156a0[i] = (short)(a1[i]>>>SHIFT);1157}1158}1159static void test_srlc_on(short[] a0, short[] a1) {1160for (int i = 0; i < a0.length; i+=1) {1161a0[i] = (short)(a1[i]>>>(-SHIFT));1162}1163}1164static void test_srlv(short[] a0, short[] a1, int b) {1165for (int i = 0; i < a0.length; i+=1) {1166a0[i] = (short)(a1[i]>>>b);1167}1168}1169static void test_srlc_add(short[] a0, short[] a1) {1170for (int i = 0; i < a0.length; i+=1) {1171a0[i] = (short)((a1[i] + ADD_INIT)>>>VALUE);1172}1173}1174static void test_srlv_add(short[] a0, short[] a1, int b) {1175for (int i = 0; i < a0.length; i+=1) {1176a0[i] = (short)((a1[i] + b)>>>VALUE);1177}1178}1179static void test_srlc_and(short[] a0, short[] a1) {1180for (int i = 0; i < a0.length; i+=1) {1181a0[i] = (short)((a1[i] & BIT_MASK)>>>VALUE);1182}1183}1184static void test_srlv_and(short[] a0, short[] a1, int b) {1185for (int i = 0; i < a0.length; i+=1) {1186a0[i] = (short)((a1[i] & b)>>>VALUE);1187}1188}11891190static void test_srac(short[] a0, short[] a1) {1191for (int i = 0; i < a0.length; i+=1) {1192a0[i] = (short)(a1[i]>>VALUE);1193}1194}1195static void test_srac_n(short[] a0, short[] a1) {1196for (int i = 0; i < a0.length; i+=1) {1197a0[i] = (short)(a1[i]>>(-VALUE));1198}1199}1200static void test_srac_o(short[] a0, short[] a1) {1201for (int i = 0; i < a0.length; i+=1) {1202a0[i] = (short)(a1[i]>>SHIFT);1203}1204}1205static void test_srac_on(short[] a0, short[] a1) {1206for (int i = 0; i < a0.length; i+=1) {1207a0[i] = (short)(a1[i]>>(-SHIFT));1208}1209}1210static void test_srav(short[] a0, short[] a1, int b) {1211for (int i = 0; i < a0.length; i+=1) {1212a0[i] = (short)(a1[i]>>b);1213}1214}1215static void test_srac_add(short[] a0, short[] a1) {1216for (int i = 0; i < a0.length; i+=1) {1217a0[i] = (short)((a1[i] + ADD_INIT)>>VALUE);1218}1219}1220static void test_srav_add(short[] a0, short[] a1, int b) {1221for (int i = 0; i < a0.length; i+=1) {1222a0[i] = (short)((a1[i] + b)>>VALUE);1223}1224}1225static void test_srac_and(short[] a0, short[] a1) {1226for (int i = 0; i < a0.length; i+=1) {1227a0[i] = (short)((a1[i] & BIT_MASK)>>VALUE);1228}1229}1230static void test_srav_and(short[] a0, short[] a1, int b) {1231for (int i = 0; i < a0.length; i+=1) {1232a0[i] = (short)((a1[i] & b)>>VALUE);1233}1234}12351236static void test_pack2(int[] p2, short[] a1) {1237if (p2.length*2 > a1.length) return;1238for (int i = 0; i < p2.length; i+=1) {1239int l0 = (int)a1[i*2+0];1240int l1 = (int)a1[i*2+1];1241p2[i] = (l1 << 16) | (l0 & 0xFFFF);1242}1243}1244static void test_unpack2(short[] a0, int[] p2) {1245if (p2.length*2 > a0.length) return;1246for (int i = 0; i < p2.length; i+=1) {1247int l = p2[i];1248a0[i*2+0] = (short)(l & 0xFFFF);1249a0[i*2+1] = (short)(l >> 16);1250}1251}1252static void test_pack2_swap(int[] p2, short[] a1) {1253if (p2.length*2 > a1.length) return;1254for (int i = 0; i < p2.length; i+=1) {1255int l0 = (int)a1[i*2+0];1256int l1 = (int)a1[i*2+1];1257p2[i] = (l0 << 16) | (l1 & 0xFFFF);1258}1259}1260static void test_unpack2_swap(short[] a0, int[] p2) {1261if (p2.length*2 > a0.length) return;1262for (int i = 0; i < p2.length; i+=1) {1263int l = p2[i];1264a0[i*2+0] = (short)(l >> 16);1265a0[i*2+1] = (short)(l & 0xFFFF);1266}1267}12681269static void test_pack4(long[] p4, short[] a1) {1270if (p4.length*4 > a1.length) return;1271for (int i = 0; i < p4.length; i+=1) {1272long l0 = (long)a1[i*4+0];1273long l1 = (long)a1[i*4+1];1274long l2 = (long)a1[i*4+2];1275long l3 = (long)a1[i*4+3];1276p4[i] = (l0 & 0xFFFFl) |1277((l1 & 0xFFFFl) << 16) |1278((l2 & 0xFFFFl) << 32) |1279((l3 & 0xFFFFl) << 48);1280}1281}1282static void test_unpack4(short[] a0, long[] p4) {1283if (p4.length*4 > a0.length) return;1284for (int i = 0; i < p4.length; i+=1) {1285long l = p4[i];1286a0[i*4+0] = (short)(l & 0xFFFFl);1287a0[i*4+1] = (short)(l >> 16);1288a0[i*4+2] = (short)(l >> 32);1289a0[i*4+3] = (short)(l >> 48);1290}1291}1292static void test_pack4_swap(long[] p4, short[] a1) {1293if (p4.length*4 > a1.length) return;1294for (int i = 0; i < p4.length; i+=1) {1295long l0 = (long)a1[i*4+0];1296long l1 = (long)a1[i*4+1];1297long l2 = (long)a1[i*4+2];1298long l3 = (long)a1[i*4+3];1299p4[i] = (l3 & 0xFFFFl) |1300((l2 & 0xFFFFl) << 16) |1301((l1 & 0xFFFFl) << 32) |1302((l0 & 0xFFFFl) << 48);1303}1304}1305static void test_unpack4_swap(short[] a0, long[] p4) {1306if (p4.length*4 > a0.length) return;1307for (int i = 0; i < p4.length; i+=1) {1308long l = p4[i];1309a0[i*4+0] = (short)(l >> 48);1310a0[i*4+1] = (short)(l >> 32);1311a0[i*4+2] = (short)(l >> 16);1312a0[i*4+3] = (short)(l & 0xFFFFl);1313}1314}13151316static int verify(String text, int i, short elem, short val) {1317if (elem != val) {1318System.err.println(text + "[" + i + "] = " + elem + " != " + val);1319return 1;1320}1321return 0;1322}13231324static int verify(String text, int i, int elem, int val) {1325if (elem != val) {1326System.err.println(text + "[" + i + "] = " + Integer.toHexString(elem) + " != " + Integer.toHexString(val));1327return 1;1328}1329return 0;1330}13311332static int verify(String text, int i, long elem, long val) {1333if (elem != val) {1334System.err.println(text + "[" + i + "] = " + Long.toHexString(elem) + " != " + Long.toHexString(val));1335return 1;1336}1337return 0;1338}1339}134013411342