< prev index next >

test/jdk/jdk/incubator/vector/Byte128VectorLoadStoreTests.java

Print this page
rev 55594 : tests and benchmark changes


  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng Byte128VectorLoadStoreTests
  28  *
  29  */
  30 
  31 import jdk.incubator.vector.Vector.Shape;

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




  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng Byte128VectorLoadStoreTests
  28  *
  29  */
  30 
  31 import jdk.incubator.vector.Vector.Shape;
  32 import jdk.incubator.vector.Vector.Species;
  33 import jdk.incubator.vector.Vector;
  34 
  35 import jdk.incubator.vector.ByteVector;
  36 
  37 import org.testng.Assert;
  38 import org.testng.annotations.DataProvider;
  39 import org.testng.annotations.Test;
  40 
  41 import java.nio.ByteBuffer;
  42 import java.nio.ByteOrder;
  43 import java.util.List;
  44 import java.util.function.IntFunction;
  45 
  46 @Test
  47 public class Byte128VectorLoadStoreTests extends AbstractVectorTest {
  48     static final Species<Byte> SPECIES =
  49                 ByteVector.SPECIES_128;
  50 
  51     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 10);
  52 
  53     static void assertArraysEquals(byte[] a, byte[] r, boolean[] mask) {
  54         int i = 0;
  55         try {
  56             for (; i < a.length; i++) {
  57                 Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (byte) 0, r[i]);
  58             }
  59         } catch (AssertionError e) {
  60             Assert.assertEquals(mask[i % SPECIES.length()] ? a[i] : (byte) 0, r[i], "at index #" + i);
  61         }
  62     }
  63 
  64     static void assertArraysEquals(byte[] a, byte[] r, int[] im) {
  65         int i = 0;
  66         try {
  67             for (; i < a.length; i++) {
  68                 Assert.assertEquals(a[im[i]], r[i]);
  69             }


< prev index next >