< prev index next > test/jdk/jdk/incubator/vector/Byte256VectorTests.java
Print this page
/*
! * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
static final VectorSpecies<Byte> SPECIES =
ByteVector.SPECIES_256;
static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
+ static ByteVector bcast_vec = ByteVector.broadcast(SPECIES, (byte)10);
+
private static final byte CONST_SHIFT = Byte.SIZE / 2;
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 256);
assertShiftConstEquals(r, a, mask, Byte256VectorTests::ROL_binary_const);
}
- static ByteVector bv_MIN = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpProvider")
static void MINByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MIN, bv_MIN).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::MIN);
}
- static ByteVector bv_min = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpProvider")
static void minByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.min(bv_min).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::min);
}
- static ByteVector bv_MIN_M = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpMaskProvider")
static void MINByte256VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MIN, bv_MIN_M, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, mask, Byte256VectorTests::MIN);
}
- static ByteVector bv_MAX = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpProvider")
static void MAXByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MAX, bv_MAX).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::MAX);
}
- static ByteVector bv_max = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpProvider")
static void maxByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.max(bv_max).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::max);
}
- static ByteVector bv_MAX_M = ByteVector.broadcast(SPECIES, (byte)10);
-
@Test(dataProvider = "byteUnaryOpMaskProvider")
static void MAXByte256VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MAX, bv_MAX_M, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, mask, Byte256VectorTests::MAX);
}
assertShiftConstEquals(r, a, mask, Byte256VectorTests::ROL_binary_const);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void MINByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MIN, bcast_vec).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::MIN);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void minByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.min(bcast_vec).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::min);
}
@Test(dataProvider = "byteUnaryOpMaskProvider")
static void MINByte256VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MIN, bcast_vec, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, mask, Byte256VectorTests::MIN);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void MAXByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MAX, bcast_vec).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::MAX);
}
@Test(dataProvider = "byteUnaryOpProvider")
static void maxByte256VectorTestsWithMemOp(IntFunction<byte[]> fa) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.max(bcast_vec).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, Byte256VectorTests::max);
}
@Test(dataProvider = "byteUnaryOpMaskProvider")
static void MAXByte256VectorTestsMaskedWithMemOp(IntFunction<byte[]> fa, IntFunction<boolean[]> fm) {
byte[] a = fa.apply(SPECIES.length());
byte[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
VectorMask<Byte> vmask = VectorMask.fromArray(SPECIES, mask, 0);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
for (int i = 0; i < a.length; i += SPECIES.length()) {
ByteVector av = ByteVector.fromArray(SPECIES, a, i);
! av.lanewise(VectorOperators.MAX, bcast_vec, vmask).intoArray(r, i);
}
}
assertArraysEquals(r, a, (byte)10, mask, Byte256VectorTests::MAX);
}
< prev index next >