< prev index next > test/jdk/jdk/incubator/vector/Long512VectorTests.java
Print this page
int idx = i + j;
Assert.assertEquals(r[i+j], a[i+order[i+j]], "at index #" + idx + ", input = " + a[i+order[i+j]]);
}
}
+ static void assertcompressArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
+ int i = 0, j = 0, k = 0;
+ try {
+ for (; i < a.length; i += vector_len) {
+ k = 0;
+ for (j = 0; j < vector_len; j++) {
+ if (m[(i + j) % SPECIES.length()]) {
+ Assert.assertEquals(r[i + k], a[i + j]);
+ k++;
+ }
+ }
+ for (; k < vector_len; k++) {
+ Assert.assertEquals(r[i + k], (long)0);
+ }
+ }
+ } catch (AssertionError e) {
+ int idx = i + k;
+ if (m[(i + j) % SPECIES.length()]) {
+ Assert.assertEquals(r[idx], a[i + j], "at index #" + idx);
+ } else {
+ Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
+ }
+ }
+ }
+
+ static void assertexpandArraysEquals(long[] r, long[] a, boolean[] m, int vector_len) {
+ int i = 0, j = 0, k = 0;
+ try {
+ for (; i < a.length; i += vector_len) {
+ k = 0;
+ for (j = 0; j < vector_len; j++) {
+ if (m[(i + j) % SPECIES.length()]) {
+ Assert.assertEquals(r[i + j], a[i + k]);
+ k++;
+ } else {
+ Assert.assertEquals(r[i + j], (long)0);
+ }
+ }
+ }
+ } catch (AssertionError e) {
+ int idx = i + j;
+ if (m[idx % SPECIES.length()]) {
+ Assert.assertEquals(r[idx], a[i + k], "at index #" + idx);
+ } else {
+ Assert.assertEquals(r[idx], (long)0, "at index #" + idx);
+ }
+ }
+ }
+
static void assertSelectFromArraysEquals(long[] r, long[] a, long[] order, int vector_len) {
int i = 0, j = 0;
try {
for (; i < a.length; i += vector_len) {
for (j = 0; j < vector_len; j++) {
} catch (AssertionError e) {
Assert.assertEquals(r[i], (double)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
}
}
-
static long bits(long e) {
return e;
}
static final List<IntFunction<long[]>> LONG_GENERATORS = List.of(
return INT_LONG_GENERATORS.stream().
map(f -> new Object[]{f}).
toArray(Object[][]::new);
}
-
@DataProvider
public Object[][] maskProvider() {
return BOOLEAN_MASK_GENERATORS.stream().
map(f -> new Object[]{f}).
toArray(Object[][]::new);
return new Object[] {fa, fs, fm};
}))).
toArray(Object[][]::new);
}
-
static final List<IntFunction<long[]>> LONG_COMPARE_GENERATORS = List.of(
withToString("long[i]", (int s) -> {
return fill(s * BUFFER_REPS,
i -> (long)i);
}),
static final IntFunction<boolean[]> fmr = (vl) -> {
int length = BUFFER_REPS * vl;
return new boolean[length];
};
-
static void replaceZero(long[] a, long v) {
for (int i = 0; i < a.length; i++) {
if (a[i] == 0) {
a[i] = v;
}
static long ROR_scalar(long a, long b) {
return Long.rotateRight(a, ((int)b));
}
+ static long TRAILING_ZEROS_COUNT_scalar(long a) {
+ return Long.numberOfTrailingZeros(a);
+ }
+
+ static long LEADING_ZEROS_COUNT_scalar(long a) {
+ return Long.numberOfLeadingZeros(a);
+ }
+
+ static long REVERSE_scalar(long a) {
+ return Long.reverse(a);
+ }
+
static boolean eq(long a, long b) {
return a == b;
}
static boolean neq(long a, long b) {
a.div(b, m);
Assert.fail();
} catch (ArithmeticException e) {
}
}
+
static long ADD(long a, long b) {
return (long)(a + b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::ADD);
}
+
static long add(long a, long b) {
return (long)(a + b);
}
@Test(dataProvider = "longBinaryOpProvider")
av.add(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::add);
}
+
static long SUB(long a, long b) {
return (long)(a - b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::SUB);
}
+
static long sub(long a, long b) {
return (long)(a - b);
}
@Test(dataProvider = "longBinaryOpProvider")
av.sub(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::sub);
}
+
static long MUL(long a, long b) {
return (long)(a * b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::MUL);
}
+
static long mul(long a, long b) {
return (long)(a * b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::mul);
}
-
-
static long DIV(long a, long b) {
return (long)(a / b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::DIV);
}
+
static long div(long a, long b) {
return (long)(a / b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::div);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void DIVLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
assertArraysEquals(r, a, b, Long512VectorTests::AND);
}
+
static long and(long a, long b) {
return (long)(a & b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::and);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ANDLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::AND);
}
-
static long AND_NOT(long a, long b) {
return (long)(a & ~b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::AND_NOT);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void AND_NOTLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::AND_NOT);
}
-
static long OR(long a, long b) {
return (long)(a | b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::OR);
}
+
static long or(long a, long b) {
return (long)(a | b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::or);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ORLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::OR);
}
-
static long XOR(long a, long b) {
return (long)(a ^ b);
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::XOR);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void XORLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::XOR);
}
+ static long COMPRESS_BITS(long a, long b) {
+ return (long)(Long.compress(a, b));
+ }
+
+ @Test(dataProvider = "longBinaryOpProvider")
+ static void COMPRESS_BITSLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] b = fb.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ LongVector bv = LongVector.fromArray(SPECIES, b, i);
+ av.lanewise(VectorOperators.COMPRESS_BITS, bv).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, b, Long512VectorTests::COMPRESS_BITS);
+ }
+
+ @Test(dataProvider = "longBinaryOpMaskProvider")
+ static void COMPRESS_BITSLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] b = fb.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ LongVector bv = LongVector.fromArray(SPECIES, b, i);
+ av.lanewise(VectorOperators.COMPRESS_BITS, bv, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, b, mask, Long512VectorTests::COMPRESS_BITS);
+ }
+
+ static long EXPAND_BITS(long a, long b) {
+ return (long)(Long.expand(a, b));
+ }
+
+ @Test(dataProvider = "longBinaryOpProvider")
+ static void EXPAND_BITSLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] b = fb.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ LongVector bv = LongVector.fromArray(SPECIES, b, i);
+ av.lanewise(VectorOperators.EXPAND_BITS, bv).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, b, Long512VectorTests::EXPAND_BITS);
+ }
+
+ @Test(dataProvider = "longBinaryOpMaskProvider")
+ static void EXPAND_BITSLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] b = fb.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ LongVector bv = LongVector.fromArray(SPECIES, b, i);
+ av.lanewise(VectorOperators.EXPAND_BITS, bv, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, b, mask, Long512VectorTests::EXPAND_BITS);
+ }
@Test(dataProvider = "longBinaryOpProvider")
static void addLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::mul);
}
-
-
-
@Test(dataProvider = "longBinaryOpProvider")
static void divLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, Long512VectorTests::div);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void divLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::div);
}
-
-
@Test(dataProvider = "longBinaryOpProvider")
static void ORLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, Long512VectorTests::or);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ORLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::OR);
}
-
-
@Test(dataProvider = "longBinaryOpProvider")
static void ANDLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, Long512VectorTests::and);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ANDLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Long512VectorTests::AND);
}
-
-
@Test(dataProvider = "longBinaryOpProvider")
static void ORLong512VectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertBroadcastLongArraysEquals(r, a, b, Long512VectorTests::OR);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ORLong512VectorTestsBroadcastMaskedLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertBroadcastLongArraysEquals(r, a, b, mask, Long512VectorTests::OR);
}
-
@Test(dataProvider = "longBinaryOpProvider")
static void ADDLong512VectorTestsBroadcastLongSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, Long512VectorTests::LSHL);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::LSHL);
}
-
-
-
-
-
static long ASHR(long a, long b) {
return (long)((a >> b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::ASHR);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::ASHR);
}
-
-
-
-
-
static long LSHR(long a, long b) {
return (long)((a >>> b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::LSHR);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::LSHR);
}
-
-
-
-
-
static long LSHL_unary(long a, long b) {
return (long)((a << b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::LSHL_unary);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHLLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::LSHL_unary);
}
-
-
-
-
-
static long LSHR_unary(long a, long b) {
return (long)((a >>> b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::LSHR_unary);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void LSHRLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::LSHR_unary);
}
-
-
-
-
-
static long ASHR_unary(long a, long b) {
return (long)((a >> b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::ASHR_unary);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ASHRLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ASHR_unary);
}
-
-
-
-
-
static long ROR(long a, long b) {
return (long)(ROR_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::ROR);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::ROR);
}
-
static long ROL(long a, long b) {
return (long)(ROL_scalar(a,b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertArraysEquals(r, a, b, Long512VectorTests::ROL);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Long512VectorTests::ROL);
}
-
static long ROR_unary(long a, long b) {
return (long)(ROR_scalar(a, b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::ROR_unary);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void RORLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROR_unary);
}
-
static long ROL_unary(long a, long b) {
return (long)(ROL_scalar(a, b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
assertShiftArraysEquals(r, a, b, Long512VectorTests::ROL_unary);
}
-
-
@Test(dataProvider = "longBinaryOpMaskProvider")
static void ROLLong512VectorTestsScalarShiftMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
assertShiftArraysEquals(r, a, b, mask, Long512VectorTests::ROL_unary);
}
-
-
static long LSHR_binary_const(long a) {
return (long)((a >>> CONST_SHIFT));
}
@Test(dataProvider = "longUnaryOpProvider")
}
assertShiftConstEquals(r, a, Long512VectorTests::LSHR_binary_const);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void LSHRLong512VectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertShiftConstEquals(r, a, mask, Long512VectorTests::LSHR_binary_const);
}
-
-
-
-
-
-
static long LSHL_binary_const(long a) {
return (long)((a << CONST_SHIFT));
}
@Test(dataProvider = "longUnaryOpProvider")
}
assertShiftConstEquals(r, a, Long512VectorTests::LSHL_binary_const);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void LSHLLong512VectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertShiftConstEquals(r, a, mask, Long512VectorTests::LSHL_binary_const);
}
-
-
static long ASHR_binary_const(long a) {
return (long)((a >> CONST_SHIFT));
}
@Test(dataProvider = "longUnaryOpProvider")
}
assertShiftConstEquals(r, a, Long512VectorTests::ASHR_binary_const);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ASHRLong512VectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertShiftConstEquals(r, a, mask, Long512VectorTests::ASHR_binary_const);
}
-
-
static long ROR_binary_const(long a) {
return (long)(ROR_scalar(a, CONST_SHIFT));
}
@Test(dataProvider = "longUnaryOpProvider")
}
assertShiftConstEquals(r, a, Long512VectorTests::ROR_binary_const);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void RORLong512VectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertShiftConstEquals(r, a, mask, Long512VectorTests::ROR_binary_const);
}
-
-
static long ROL_binary_const(long a) {
return (long)(ROL_scalar(a, CONST_SHIFT));
}
@Test(dataProvider = "longUnaryOpProvider")
}
assertShiftConstEquals(r, a, Long512VectorTests::ROL_binary_const);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ROLLong512VectorTestsScalarShiftMaskedConst(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
}
assertArraysEquals(r, a, b, Long512VectorTests::MIN);
}
+
static long min(long a, long b) {
return (long)(Math.min(a, b));
}
@Test(dataProvider = "longBinaryOpProvider")
av.min(bv).intoArray(r, i);
}
assertArraysEquals(r, a, b, Long512VectorTests::min);
}
+
static long MAX(long a, long b) {
return (long)(Math.max(a, b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Long512VectorTests::MAX);
}
+
static long max(long a, long b) {
return (long)(Math.max(a, b));
}
@Test(dataProvider = "longBinaryOpProvider")
}
return res;
}
-
@Test(dataProvider = "longUnaryOpProvider")
static void ANDReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = -1;
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::ANDReduce, Long512VectorTests::ANDReduceAll);
}
-
static long ANDReduceMasked(long[] a, int idx, boolean[] mask) {
long res = -1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res &= a[i];
}
return res;
}
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ANDReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::ANDReduceMasked, Long512VectorTests::ANDReduceAllMasked);
}
-
static long ORReduce(long[] a, int idx) {
long res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res |= a[i];
}
}
return res;
}
-
@Test(dataProvider = "longUnaryOpProvider")
static void ORReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = 0;
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::ORReduce, Long512VectorTests::ORReduceAll);
}
-
static long ORReduceMasked(long[] a, int idx, boolean[] mask) {
long res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res |= a[i];
}
return res;
}
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ORReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::ORReduceMasked, Long512VectorTests::ORReduceAllMasked);
}
-
static long XORReduce(long[] a, int idx) {
long res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res ^= a[i];
}
}
return res;
}
-
@Test(dataProvider = "longUnaryOpProvider")
static void XORReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = 0;
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::XORReduce, Long512VectorTests::XORReduceAll);
}
-
static long XORReduceMasked(long[] a, int idx, boolean[] mask) {
long res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res ^= a[i];
}
return res;
}
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void XORReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
res += ADDReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "longUnaryOpProvider")
static void ADDReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = 0;
}
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::ADDReduce, Long512VectorTests::ADDReduceAll);
}
+
static long ADDReduceMasked(long[] a, int idx, boolean[] mask) {
long res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res += a[i];
res += ADDReduceMasked(a, i, mask);
}
return res;
}
+
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ADDReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::ADDReduceMasked, Long512VectorTests::ADDReduceAllMasked);
}
+
static long MULReduce(long[] a, int idx) {
long res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res *= a[i];
}
res *= MULReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "longUnaryOpProvider")
static void MULReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = 1;
}
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::MULReduce, Long512VectorTests::MULReduceAll);
}
+
static long MULReduceMasked(long[] a, int idx, boolean[] mask) {
long res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res *= a[i];
res *= MULReduceMasked(a, i, mask);
}
return res;
}
+
@Test(dataProvider = "longUnaryOpMaskProvider")
static void MULReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::MULReduceMasked, Long512VectorTests::MULReduceAllMasked);
}
+
static long MINReduce(long[] a, int idx) {
long res = Long.MAX_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (long) Math.min(res, a[i]);
}
res = (long) Math.min(res, MINReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpProvider")
static void MINReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = Long.MAX_VALUE;
}
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::MINReduce, Long512VectorTests::MINReduceAll);
}
+
static long MINReduceMasked(long[] a, int idx, boolean[] mask) {
long res = Long.MAX_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (long) Math.min(res, a[i]);
res = (long) Math.min(res, MINReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpMaskProvider")
static void MINReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::MINReduceMasked, Long512VectorTests::MINReduceAllMasked);
}
+
static long MAXReduce(long[] a, int idx) {
long res = Long.MIN_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (long) Math.max(res, a[i]);
}
res = (long) Math.max(res, MAXReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpProvider")
static void MAXReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = Long.MIN_VALUE;
}
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::MAXReduce, Long512VectorTests::MAXReduceAll);
}
+
static long MAXReduceMasked(long[] a, int idx, boolean[] mask) {
long res = Long.MIN_VALUE;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (long) Math.max(res, a[i]);
res = (long) Math.max(res, MAXReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpMaskProvider")
static void MAXReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Long512VectorTests::MAXReduceMasked, Long512VectorTests::MAXReduceAllMasked);
}
+
static long FIRST_NONZEROReduce(long[] a, int idx) {
long res = (long) 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = firstNonZero(res, a[i]);
}
res = firstNonZero(res, FIRST_NONZEROReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpProvider")
static void FIRST_NONZEROReduceLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
long ra = (long) 0;
}
assertReductionArraysEquals(r, ra, a,
Long512VectorTests::FIRST_NONZEROReduce, Long512VectorTests::FIRST_NONZEROReduceAll);
}
+
static long FIRST_NONZEROReduceMasked(long[] a, int idx, boolean[] mask) {
long res = (long) 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = firstNonZero(res, a[i]);
res = firstNonZero(res, FIRST_NONZEROReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "longUnaryOpMaskProvider")
static void FIRST_NONZEROReduceLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
return res;
}
-
@Test(dataProvider = "boolUnaryOpProvider")
static void anyTrueLong512VectorTests(IntFunction<boolean[]> fm) {
boolean[] mask = fm.apply(SPECIES.length());
boolean[] r = fmr.apply(SPECIES.length());
}
assertReductionBoolArraysEquals(r, mask, Long512VectorTests::anyTrue);
}
-
static boolean allTrue(boolean[] a, int idx) {
boolean res = true;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res &= a[i];
}
return res;
}
-
@Test(dataProvider = "boolUnaryOpProvider")
static void allTrueLong512VectorTests(IntFunction<boolean[]> fm) {
boolean[] mask = fm.apply(SPECIES.length());
boolean[] r = fmr.apply(SPECIES.length());
}
assertReductionBoolArraysEquals(r, mask, Long512VectorTests::allTrue);
}
-
@Test(dataProvider = "longUnaryOpProvider")
static void withLong512VectorTests(IntFunction<long []> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (long)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
}
+
static boolean testIS_DEFAULT(long a) {
return bits(a)==0;
}
@Test(dataProvider = "longTestOpProvider")
Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
}
}
}
}
+
static boolean testIS_NEGATIVE(long a) {
return bits(a)<0;
}
@Test(dataProvider = "longTestOpProvider")
}
}
}
}
-
-
-
@Test(dataProvider = "longCompareOpProvider")
static void LTLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void ltLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void GTLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void EQLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void eqLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void NELong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void LELong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "longCompareOpProvider")
static void GELong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpProvider")
static void UNSIGNED_LTLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void UNSIGNED_LTLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
-
@Test(dataProvider = "longCompareOpProvider")
static void UNSIGNED_GTLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void UNSIGNED_GTLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
-
@Test(dataProvider = "longCompareOpProvider")
static void UNSIGNED_LELong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void UNSIGNED_LELong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
-
@Test(dataProvider = "longCompareOpProvider")
static void UNSIGNED_GELong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void UNSIGNED_GELong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
@Test(dataProvider = "longCompareOpProvider")
static void LTLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
}
}
}
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void LTLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
}
}
}
-
@Test(dataProvider = "longCompareOpMaskProvider")
static void EQLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa,
IntFunction<long[]> fb, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
av.rearrange(VectorShuffle.fromArray(SPECIES, order, i), vmask).intoArray(r, i);
}
assertRearrangeArraysEquals(r, a, order, mask, SPECIES.length());
}
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void compressLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.compress(vmask).intoArray(r, i);
+ }
+ }
+
+ assertcompressArraysEquals(r, a, mask, SPECIES.length());
+ }
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void expandLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.expand(vmask).intoArray(r, i);
+ }
+ }
+
+ assertexpandArraysEquals(r, a, mask, SPECIES.length());
+ }
+
@Test(dataProvider = "longUnaryOpProvider")
static void getLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a);
}
-
-
-
-
@Test(dataProvider = "longUnaryOpProvider")
static void ZeroLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = new long[a.length];
}
Assert.assertEquals(a, r);
}
-
-
-
static long[] sliceUnary(long[] a, int origin, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0; i < SPECIES.length(); i++){
if(i+origin < SPECIES.length())
res[i] = a[idx+i+origin];
}
}
assertArraysEquals(r, a, origin, Long512VectorTests::sliceUnary);
}
+
static long[] sliceBinary(long[] a, long[] b, int origin, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i+origin < SPECIES.length())
res[i] = a[idx+i+origin];
}
}
assertArraysEquals(r, a, b, origin, Long512VectorTests::sliceBinary);
}
+
static long[] slice(long[] a, long[] b, int origin, boolean[] mask, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i+origin < SPECIES.length())
res[i] = mask[i] ? a[idx+i+origin] : (long)0;
}
}
assertArraysEquals(r, a, b, origin, mask, Long512VectorTests::slice);
}
+
static long[] unsliceUnary(long[] a, int origin, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i < origin)
res[i] = (long)0;
}
}
assertArraysEquals(r, a, origin, Long512VectorTests::unsliceUnary);
}
+
static long[] unsliceBinary(long[] a, long[] b, int origin, int part, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if (part == 0) {
if (i < origin)
}
}
assertArraysEquals(r, a, b, origin, part, Long512VectorTests::unsliceBinary);
}
+
static long[] unslice(long[] a, long[] b, int origin, int part, boolean[] mask, int idx) {
long[] res = new long[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i+origin < SPECIES.length())
res[i] = b[idx+i+origin];
}
assertArraysEquals(r, a, b, origin, part, mask, Long512VectorTests::unslice);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
static long BITWISE_BLEND(long a, long b, long c) {
return (long)((a&~(c))|(b&c));
}
+
static long bitwiseBlend(long a, long b, long c) {
return (long)((a&~(c))|(b&c));
}
-
@Test(dataProvider = "longTernaryOpProvider")
static void BITWISE_BLENDLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
}
}
assertArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
}
+
@Test(dataProvider = "longTernaryOpProvider")
static void bitwiseBlendLong512VectorTests(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
}
-
@Test(dataProvider = "longTernaryOpMaskProvider")
static void BITWISE_BLENDLong512VectorTestsMasked(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
}
-
-
-
@Test(dataProvider = "longTernaryOpProvider")
static void BITWISE_BLENDLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
LongVector cv = LongVector.fromArray(SPECIES, c, i);
av.lanewise(VectorOperators.BITWISE_BLEND, b[i], cv).intoArray(r, i);
}
assertAltBroadcastArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
}
+
@Test(dataProvider = "longTernaryOpProvider")
static void bitwiseBlendLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
av.bitwiseBlend(b[i], cv).intoArray(r, i);
}
assertAltBroadcastArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
}
-
@Test(dataProvider = "longTernaryOpMaskProvider")
static void BITWISE_BLENDLong512VectorTestsBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertAltBroadcastArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
}
-
-
-
@Test(dataProvider = "longTernaryOpProvider")
static void BITWISE_BLENDLong512VectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
av.lanewise(VectorOperators.BITWISE_BLEND, b[i], c[i]).intoArray(r, i);
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Long512VectorTests::BITWISE_BLEND);
}
+
@Test(dataProvider = "longTernaryOpProvider")
static void bitwiseBlendLong512VectorTestsDoubleBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb, IntFunction<long[]> fc) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
long[] c = fc.apply(SPECIES.length());
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Long512VectorTests::bitwiseBlend);
}
-
@Test(dataProvider = "longTernaryOpMaskProvider")
static void BITWISE_BLENDLong512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb,
IntFunction<long[]> fc, IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Long512VectorTests::BITWISE_BLEND);
}
-
static long NEG(long a) {
return (long)(-((long)a));
}
static long neg(long a) {
}
assertArraysEquals(r, a, mask, Long512VectorTests::ABS);
}
-
static long NOT(long a) {
return (long)(~((long)a));
}
static long not(long a) {
return (long)(~((long)a));
}
-
-
@Test(dataProvider = "longUnaryOpProvider")
static void NOTLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, Long512VectorTests::not);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void NOTMaskedLong512VectorTests(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, mask, Long512VectorTests::NOT);
}
-
-
static long ZOMO(long a) {
return (long)((a==0?0:-1));
}
-
-
@Test(dataProvider = "longUnaryOpProvider")
static void ZOMOLong512VectorTests(IntFunction<long[]> fa) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, Long512VectorTests::ZOMO);
}
-
-
@Test(dataProvider = "longUnaryOpMaskProvider")
static void ZOMOMaskedLong512VectorTests(IntFunction<long[]> fa,
IntFunction<boolean[]> fm) {
long[] a = fa.apply(SPECIES.length());
long[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, mask, Long512VectorTests::ZOMO);
}
+ static long BIT_COUNT(long a) {
+ return (long)(Long.bitCount(a));
+ }
+ @Test(dataProvider = "longUnaryOpProvider")
+ static void BIT_COUNTLong512VectorTests(IntFunction<long[]> fa) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.BIT_COUNT).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, Long512VectorTests::BIT_COUNT);
+ }
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void BIT_COUNTMaskedLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.BIT_COUNT, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, mask, Long512VectorTests::BIT_COUNT);
+ }
+
+ static long TRAILING_ZEROS_COUNT(long a) {
+ return (long)(TRAILING_ZEROS_COUNT_scalar(a));
+ }
+
+ @Test(dataProvider = "longUnaryOpProvider")
+ static void TRAILING_ZEROS_COUNTLong512VectorTests(IntFunction<long[]> fa) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, Long512VectorTests::TRAILING_ZEROS_COUNT);
+ }
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void TRAILING_ZEROS_COUNTMaskedLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.TRAILING_ZEROS_COUNT, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, mask, Long512VectorTests::TRAILING_ZEROS_COUNT);
+ }
+
+ static long LEADING_ZEROS_COUNT(long a) {
+ return (long)(LEADING_ZEROS_COUNT_scalar(a));
+ }
+
+ @Test(dataProvider = "longUnaryOpProvider")
+ static void LEADING_ZEROS_COUNTLong512VectorTests(IntFunction<long[]> fa) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, Long512VectorTests::LEADING_ZEROS_COUNT);
+ }
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void LEADING_ZEROS_COUNTMaskedLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.LEADING_ZEROS_COUNT, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, mask, Long512VectorTests::LEADING_ZEROS_COUNT);
+ }
+
+ static long REVERSE(long a) {
+ return (long)(REVERSE_scalar(a));
+ }
+
+ @Test(dataProvider = "longUnaryOpProvider")
+ static void REVERSELong512VectorTests(IntFunction<long[]> fa) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.REVERSE).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, Long512VectorTests::REVERSE);
+ }
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void REVERSEMaskedLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.REVERSE, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, mask, Long512VectorTests::REVERSE);
+ }
+
+ static long REVERSE_BYTES(long a) {
+ return (long)(Long.reverseBytes(a));
+ }
+
+ @Test(dataProvider = "longUnaryOpProvider")
+ static void REVERSE_BYTESLong512VectorTests(IntFunction<long[]> fa) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.REVERSE_BYTES).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, Long512VectorTests::REVERSE_BYTES);
+ }
+
+ @Test(dataProvider = "longUnaryOpMaskProvider")
+ static void REVERSE_BYTESMaskedLong512VectorTests(IntFunction<long[]> fa,
+ IntFunction<boolean[]> fm) {
+ long[] a = fa.apply(SPECIES.length());
+ long[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Long> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ LongVector av = LongVector.fromArray(SPECIES, a, i);
+ av.lanewise(VectorOperators.REVERSE_BYTES, vmask).intoArray(r, i);
+ }
+ }
+
+ assertArraysEquals(r, a, mask, Long512VectorTests::REVERSE_BYTES);
+ }
@Test(dataProvider = "longCompareOpProvider")
static void ltLong512VectorTestsBroadcastSmokeTest(IntFunction<long[]> fa, IntFunction<long[]> fb) {
long[] a = fa.apply(SPECIES.length());
long[] b = fb.apply(SPECIES.length());
}
assertMaskReductionArraysEquals(r, a, Long512VectorTests::maskFirstTrue);
}
+ @Test(dataProvider = "maskProvider")
+ static void maskCompressLong512VectorTestsSmokeTest(IntFunction<boolean[]> fa) {
+ int trueCount = 0;
+ boolean[] a = fa.apply(SPECIES.length());
+
+ for (int ic = 0; ic < INVOC_COUNT * INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ var vmask = SPECIES.loadMask(a, i);
+ trueCount = vmask.trueCount();
+ var rmask = vmask.compress();
+ for (int j = 0; j < SPECIES.length(); j++) {
+ Assert.assertEquals(rmask.laneIsSet(j), j < trueCount);
+ }
+ }
+ }
+ }
+
@DataProvider
public static Object[][] longMaskProvider() {
return new Object[][]{
{0xFFFFFFFFFFFFFFFFL},
{0x0000000000000000L},
Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
}
}
}
+ @Test(dataProvider = "offsetProvider")
+ static void indexInRangeLongLong512VectorTestsSmokeTest(int offset) {
+ long limit = SPECIES.length() * BUFFER_REPS;
+ for (long i = 0; i < limit; i += SPECIES.length()) {
+ var actualMask = SPECIES.indexInRange(i + offset, limit);
+ var expectedMask = SPECIES.maskAll(true).indexInRange(i + offset, limit);
+ assert(actualMask.equals(expectedMask));
+ for (int j = 0; j < SPECIES.length(); j++) {
+ long index = i + j + offset;
+ Assert.assertEquals(actualMask.laneIsSet(j), index >= 0 && index < limit);
+ }
+ }
+ }
+
@DataProvider
public static Object[][] lengthProvider() {
return new Object[][]{
{0},
{1},
int actualLoopBound = SPECIES.loopBound(length);
int expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
Assert.assertEquals(actualLoopBound, expectedLoopBound);
}
+ @Test(dataProvider = "lengthProvider")
+ static void loopBoundLongLong512VectorTestsSmokeTest(int _length) {
+ long length = _length;
+ long actualLoopBound = SPECIES.loopBound(length);
+ long expectedLoopBound = length - Math.floorMod(length, SPECIES.length());
+ Assert.assertEquals(actualLoopBound, expectedLoopBound);
+ }
+
@Test
static void ElementSizeLong512VectorTestsSmokeTest() {
LongVector av = LongVector.zero(SPECIES);
int elsize = av.elementSize();
Assert.assertEquals(elsize, Long.SIZE);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
}
}
}
-
< prev index next >