< prev index next >

test/jdk/jdk/incubator/vector/ShortMaxVectorLoadStoreTests.java

Print this page
rev 55594 : tests and benchmark changes


  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng/othervm --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED
  28  *      ShortMaxVectorLoadStoreTests
  29  *
  30  */
  31 
  32 import jdk.incubator.vector.Vector.Shape;

  33 import jdk.incubator.vector.Vector;
  34 
  35 import jdk.incubator.vector.ShortVector;
  36 
  37 import org.testng.Assert;
  38 import org.testng.annotations.DataProvider;
  39 import org.testng.annotations.Test;
  40 
  41 import java.lang.invoke.MethodHandles;
  42 import java.lang.invoke.VarHandle;
  43 import java.nio.ByteBuffer;
  44 import java.nio.ShortBuffer;
  45 import java.nio.ByteOrder;
  46 import java.util.List;
  47 import java.util.function.IntFunction;
  48 
  49 @Test
  50 public class ShortMaxVectorLoadStoreTests extends AbstractVectorTest {
  51     static final Shape S_Max_BIT = getMaxBit();
  52 
  53     static final ShortVector.ShortSpecies SPECIES =
  54                 ShortVector.species(S_Max_BIT);
  55 
  56     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 10);
  57 
  58     static Shape getMaxBit() {
  59         return Shape.S_Max_BIT;
  60     }
  61 
  62     static void assertArraysEquals(short[] a, short[] r, boolean[] mask) {
  63         int i = 0;
  64         try {
  65             for (; i < a.length; i++) {
  66                 Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (short) 0, r[i]);
  67             }
  68         } catch (AssertionError e) {
  69             Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (short) 0, r[i], "at index #" + i);
  70         }
  71     }
  72 
  73     static void assertArraysEquals(short[] a, short[] r, int[] im) {
  74         int i = 0;




  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng/othervm --add-opens jdk.incubator.vector/jdk.incubator.vector=ALL-UNNAMED
  28  *      ShortMaxVectorLoadStoreTests
  29  *
  30  */
  31 
  32 import jdk.incubator.vector.Vector.Shape;
  33 import jdk.incubator.vector.Vector.Species;
  34 import jdk.incubator.vector.Vector;
  35 
  36 import jdk.incubator.vector.ShortVector;
  37 
  38 import org.testng.Assert;
  39 import org.testng.annotations.DataProvider;
  40 import org.testng.annotations.Test;
  41 
  42 import java.lang.invoke.MethodHandles;
  43 import java.lang.invoke.VarHandle;
  44 import java.nio.ByteBuffer;
  45 import java.nio.ShortBuffer;
  46 import java.nio.ByteOrder;
  47 import java.util.List;
  48 import java.util.function.IntFunction;
  49 
  50 @Test
  51 public class ShortMaxVectorLoadStoreTests extends AbstractVectorTest {
  52     static final Species<Short> SPECIES =
  53                 ShortVector.SPECIES_MAX;


  54 
  55     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 10);
  56 
  57     static Shape getMaxBit() {
  58         return Shape.S_Max_BIT;
  59     }
  60 
  61     static void assertArraysEquals(short[] a, short[] r, boolean[] mask) {
  62         int i = 0;
  63         try {
  64             for (; i < a.length; i++) {
  65                 Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (short) 0, r[i]);
  66             }
  67         } catch (AssertionError e) {
  68             Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (short) 0, r[i], "at index #" + i);
  69         }
  70     }
  71 
  72     static void assertArraysEquals(short[] a, short[] r, int[] im) {
  73         int i = 0;


< prev index next >