< prev index next > test/jdk/jdk/incubator/vector/Double512VectorTests.java
Print this page
DoubleVector.SPECIES_512;
static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
- private static final double CONST_SHIFT = Double.SIZE / 2;
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 512);
interface FUnOp {
double apply(double a);
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(double[] r, double[] 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], (double)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], (double)0, "at index #" + idx);
+ }
+ }
+ }
+
+ static void assertexpandArraysEquals(double[] r, double[] 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], (double)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], (double)0, "at index #" + idx);
+ }
+ }
+ }
+
static void assertSelectFromArraysEquals(double[] r, double[] a, double[] 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], (long)(a[i+offs]), "at index #" + i + ", input = " + a[i+offs]);
}
}
-
-
static long bits(double e) {
return Double.doubleToLongBits(e);
}
static final List<IntFunction<double[]>> DOUBLE_GENERATORS = List.of(
return new Object[] {fa, fs, fm};
}))).
toArray(Object[][]::new);
}
-
static final List<IntFunction<double[]>> DOUBLE_COMPARE_GENERATORS = List.of(
withToString("double[i]", (int s) -> {
return fill(s * BUFFER_REPS,
i -> (double)i);
}),
static final IntFunction<long[]> lfr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
};
-
static boolean eq(double a, double b) {
return a == b;
}
static boolean neq(double a, double b) {
static boolean ge(double a, double b) {
return a >= b;
}
-
static double firstNonZero(double a, double b) {
return Double.compare(a, (double) 0) != 0 ? a : b;
}
@Test
}
}
assertArraysEquals(r, a, b, Double512VectorTests::ADD);
}
+
static double add(double a, double b) {
return (double)(a + b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
av.add(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Double512VectorTests::add);
}
+
static double SUB(double a, double b) {
return (double)(a - b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Double512VectorTests::SUB);
}
+
static double sub(double a, double b) {
return (double)(a - b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
av.sub(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Double512VectorTests::sub);
}
+
static double MUL(double a, double b) {
return (double)(a * b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Double512VectorTests::MUL);
}
+
static double mul(double a, double b) {
return (double)(a * b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Double512VectorTests::DIV);
}
+
static double div(double a, double b) {
return (double)(a / b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
assertArraysEquals(r, a, b, Double512VectorTests::div);
}
-
-
@Test(dataProvider = "doubleBinaryOpMaskProvider")
static void DIVDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<double[]> fb,
IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Double512VectorTests::div);
}
-
-
static double FIRST_NONZERO(double a, double b) {
return (double)(Double.doubleToLongBits(a)!=0?a:b);
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
assertArraysEquals(r, a, b, mask, Double512VectorTests::FIRST_NONZERO);
}
-
-
-
-
-
-
-
-
@Test(dataProvider = "doubleBinaryOpProvider")
static void addDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Double512VectorTests::mul);
}
-
@Test(dataProvider = "doubleBinaryOpProvider")
static void divDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, Double512VectorTests::div);
}
-
-
@Test(dataProvider = "doubleBinaryOpMaskProvider")
static void divDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Double512VectorTests::div);
}
-
-
-
-
-
-
-
-
-
@Test(dataProvider = "doubleBinaryOpProvider")
static void ADDDouble512VectorTestsBroadcastLongSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertBroadcastLongArraysEquals(r, a, b, mask, Double512VectorTests::ADD);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
static double MIN(double a, double b) {
return (double)(Math.min(a, b));
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Double512VectorTests::MIN);
}
+
static double min(double a, double b) {
return (double)(Math.min(a, b));
}
@Test(dataProvider = "doubleBinaryOpProvider")
av.min(bv).intoArray(r, i);
}
assertArraysEquals(r, a, b, Double512VectorTests::min);
}
+
static double MAX(double a, double b) {
return (double)(Math.max(a, b));
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Double512VectorTests::MAX);
}
+
static double max(double a, double b) {
return (double)(Math.max(a, b));
}
@Test(dataProvider = "doubleBinaryOpProvider")
}
assertBroadcastArraysEquals(r, a, b, Double512VectorTests::max);
}
-
-
-
-
-
-
-
-
-
-
-
static double ADDReduce(double[] a, int idx) {
double res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res += a[i];
}
res += ADDReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpProvider")
static void ADDReduceDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
double ra = 0;
}
assertReductionArraysEquals(r, ra, a,
Double512VectorTests::ADDReduce, Double512VectorTests::ADDReduceAll);
}
+
static double ADDReduceMasked(double[] a, int idx, boolean[] mask) {
double 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 = "doubleUnaryOpMaskProvider")
static void ADDReduceDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Double512VectorTests::ADDReduceMasked, Double512VectorTests::ADDReduceAllMasked);
}
+
static double MULReduce(double[] a, int idx) {
double res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res *= a[i];
}
res *= MULReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpProvider")
static void MULReduceDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
double ra = 1;
}
assertReductionArraysEquals(r, ra, a,
Double512VectorTests::MULReduce, Double512VectorTests::MULReduceAll);
}
+
static double MULReduceMasked(double[] a, int idx, boolean[] mask) {
double 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 = "doubleUnaryOpMaskProvider")
static void MULReduceDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Double512VectorTests::MULReduceMasked, Double512VectorTests::MULReduceAllMasked);
}
+
static double MINReduce(double[] a, int idx) {
double res = Double.POSITIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (double) Math.min(res, a[i]);
}
res = (double) Math.min(res, MINReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpProvider")
static void MINReduceDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
double ra = Double.POSITIVE_INFINITY;
}
assertReductionArraysEquals(r, ra, a,
Double512VectorTests::MINReduce, Double512VectorTests::MINReduceAll);
}
+
static double MINReduceMasked(double[] a, int idx, boolean[] mask) {
double res = Double.POSITIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (double) Math.min(res, a[i]);
res = (double) Math.min(res, MINReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpMaskProvider")
static void MINReduceDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Double512VectorTests::MINReduceMasked, Double512VectorTests::MINReduceAllMasked);
}
+
static double MAXReduce(double[] a, int idx) {
double res = Double.NEGATIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (double) Math.max(res, a[i]);
}
res = (double) Math.max(res, MAXReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpProvider")
static void MAXReduceDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
double ra = Double.NEGATIVE_INFINITY;
}
assertReductionArraysEquals(r, ra, a,
Double512VectorTests::MAXReduce, Double512VectorTests::MAXReduceAll);
}
+
static double MAXReduceMasked(double[] a, int idx, boolean[] mask) {
double res = Double.NEGATIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (double) Math.max(res, a[i]);
res = (double) Math.max(res, MAXReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "doubleUnaryOpMaskProvider")
static void MAXReduceDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Double512VectorTests::MAXReduceMasked, Double512VectorTests::MAXReduceAllMasked);
}
+
static double FIRST_NONZEROReduce(double[] a, int idx) {
double res = (double) 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 = "doubleUnaryOpProvider")
static void FIRST_NONZEROReduceDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
double ra = (double) 0;
}
assertReductionArraysEquals(r, ra, a,
Double512VectorTests::FIRST_NONZEROReduce, Double512VectorTests::FIRST_NONZEROReduceAll);
}
+
static double FIRST_NONZEROReduceMasked(double[] a, int idx, boolean[] mask) {
double res = (double) 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 = "doubleUnaryOpMaskProvider")
static void FIRST_NONZEROReduceDouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
assertReductionArraysEqualsMasked(r, ra, a, mask,
Double512VectorTests::FIRST_NONZEROReduceMasked, Double512VectorTests::FIRST_NONZEROReduceAllMasked);
}
-
-
-
-
@Test(dataProvider = "doubleUnaryOpProvider")
static void withDouble512VectorTests(IntFunction<double []> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (double)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
}
+
static boolean testIS_DEFAULT(double a) {
return bits(a)==0;
}
@Test(dataProvider = "doubleTestOpProvider")
Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
}
}
}
}
+
static boolean testIS_NEGATIVE(double a) {
return bits(a)<0;
}
@Test(dataProvider = "doubleTestOpProvider")
}
}
}
}
-
static boolean testIS_NAN(double a) {
return Double.isNaN(a);
}
@Test(dataProvider = "doubleTestOpProvider")
}
}
}
}
-
static boolean testIS_INFINITE(double a) {
return Double.isInfinite(a);
}
@Test(dataProvider = "doubleTestOpProvider")
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void LTDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void ltDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void GTDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void EQDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void eqDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void NEDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void LEDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void GEDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
-
-
-
-
-
-
-
@Test(dataProvider = "doubleCompareOpProvider")
static void LTDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
}
}
}
-
@Test(dataProvider = "doubleCompareOpMaskProvider")
static void LTDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa,
IntFunction<double[]> fb, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (double)((long)b[i]));
}
}
}
-
@Test(dataProvider = "doubleCompareOpMaskProvider")
static void LTDouble512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<double[]> fa,
IntFunction<double[]> fb, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
}
}
}
-
@Test(dataProvider = "doubleCompareOpMaskProvider")
static void EQDouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa,
IntFunction<double[]> fb, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (double)((long)b[i]));
}
}
}
-
@Test(dataProvider = "doubleCompareOpMaskProvider")
static void EQDouble512VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<double[]> fa,
IntFunction<double[]> fb, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] 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 = "doubleUnaryOpMaskProvider")
+ static void compressDouble512VectorTests(IntFunction<double[]> fa,
+ IntFunction<boolean[]> fm) {
+ double[] a = fa.apply(SPECIES.length());
+ double[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
+ av.compress(vmask).intoArray(r, i);
+ }
+ }
+
+ assertcompressArraysEquals(r, a, mask, SPECIES.length());
+ }
+
+ @Test(dataProvider = "doubleUnaryOpMaskProvider")
+ static void expandDouble512VectorTests(IntFunction<double[]> fa,
+ IntFunction<boolean[]> fm) {
+ double[] a = fa.apply(SPECIES.length());
+ double[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Double> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ DoubleVector av = DoubleVector.fromArray(SPECIES, a, i);
+ av.expand(vmask).intoArray(r, i);
+ }
+ }
+
+ assertexpandArraysEquals(r, a, mask, SPECIES.length());
+ }
+
@Test(dataProvider = "doubleUnaryOpProvider")
static void getDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a);
}
-
-
-
-
@Test(dataProvider = "doubleUnaryOpProvider")
static void ZeroDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = new double[a.length];
}
Assert.assertEquals(a, r);
}
-
-
-
static double[] sliceUnary(double[] a, int origin, int idx) {
double[] res = new double[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, Double512VectorTests::sliceUnary);
}
+
static double[] sliceBinary(double[] a, double[] b, int origin, int idx) {
double[] res = new double[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, Double512VectorTests::sliceBinary);
}
+
static double[] slice(double[] a, double[] b, int origin, boolean[] mask, int idx) {
double[] res = new double[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] : (double)0;
}
}
assertArraysEquals(r, a, b, origin, mask, Double512VectorTests::slice);
}
+
static double[] unsliceUnary(double[] a, int origin, int idx) {
double[] res = new double[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i < origin)
res[i] = (double)0;
}
}
assertArraysEquals(r, a, origin, Double512VectorTests::unsliceUnary);
}
+
static double[] unsliceBinary(double[] a, double[] b, int origin, int part, int idx) {
double[] res = new double[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if (part == 0) {
if (i < origin)
}
}
assertArraysEquals(r, a, b, origin, part, Double512VectorTests::unsliceBinary);
}
+
static double[] unslice(double[] a, double[] b, int origin, int part, boolean[] mask, int idx) {
double[] res = new double[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i+origin < SPECIES.length())
res[i] = b[idx+i+origin];
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::SIN, Double512VectorTests::strictSIN);
}
-
static double EXP(double a) {
return (double)(Math.exp((double)a));
}
static double strictEXP(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::EXP, Double512VectorTests::strictEXP);
}
-
static double LOG1P(double a) {
return (double)(Math.log1p((double)a));
}
static double strictLOG1P(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG1P, Double512VectorTests::strictLOG1P);
}
-
static double LOG(double a) {
return (double)(Math.log((double)a));
}
static double strictLOG(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG, Double512VectorTests::strictLOG);
}
-
static double LOG10(double a) {
return (double)(Math.log10((double)a));
}
static double strictLOG10(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::LOG10, Double512VectorTests::strictLOG10);
}
-
static double EXPM1(double a) {
return (double)(Math.expm1((double)a));
}
static double strictEXPM1(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::EXPM1, Double512VectorTests::strictEXPM1);
}
-
static double COS(double a) {
return (double)(Math.cos((double)a));
}
static double strictCOS(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::COS, Double512VectorTests::strictCOS);
}
-
static double TAN(double a) {
return (double)(Math.tan((double)a));
}
static double strictTAN(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::TAN, Double512VectorTests::strictTAN);
}
-
static double SINH(double a) {
return (double)(Math.sinh((double)a));
}
static double strictSINH(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::SINH, Double512VectorTests::strictSINH);
}
-
static double COSH(double a) {
return (double)(Math.cosh((double)a));
}
static double strictCOSH(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::COSH, Double512VectorTests::strictCOSH);
}
-
static double TANH(double a) {
return (double)(Math.tanh((double)a));
}
static double strictTANH(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::TANH, Double512VectorTests::strictTANH);
}
-
static double ASIN(double a) {
return (double)(Math.asin((double)a));
}
static double strictASIN(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ASIN, Double512VectorTests::strictASIN);
}
-
static double ACOS(double a) {
return (double)(Math.acos((double)a));
}
static double strictACOS(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ACOS, Double512VectorTests::strictACOS);
}
-
static double ATAN(double a) {
return (double)(Math.atan((double)a));
}
static double strictATAN(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::ATAN, Double512VectorTests::strictATAN);
}
-
static double CBRT(double a) {
return (double)(Math.cbrt((double)a));
}
static double strictCBRT(double a) {
}
assertArraysEqualsWithinOneUlp(r, a, Double512VectorTests::CBRT, Double512VectorTests::strictCBRT);
}
-
static double HYPOT(double a, double b) {
return (double)(Math.hypot((double)a, (double)b));
}
static double strictHYPOT(double a, double b) {
assertArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::HYPOT, Double512VectorTests::strictHYPOT);
}
-
static double POW(double a, double b) {
return (double)(Math.pow((double)a, (double)b));
}
static double strictPOW(double a, double b) {
}
assertArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::POW, Double512VectorTests::strictPOW);
}
+
static double pow(double a, double b) {
return (double)(Math.pow((double)a, (double)b));
}
static double strictpow(double a, double b) {
assertArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::pow, Double512VectorTests::strictpow);
}
-
static double ATAN2(double a, double b) {
return (double)(Math.atan2((double)a, (double)b));
}
static double strictATAN2(double a, double b) {
assertArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::ATAN2, Double512VectorTests::strictATAN2);
}
-
@Test(dataProvider = "doubleBinaryOpProvider")
static void POWDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::POW, Double512VectorTests::strictPOW);
}
+
@Test(dataProvider = "doubleBinaryOpProvider")
static void powDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Double512VectorTests::pow, Double512VectorTests::strictpow);
}
-
static double FMA(double a, double b, double c) {
return (double)(Math.fma(a, b, c));
}
+
static double fma(double a, double b, double c) {
return (double)(Math.fma(a, b, c));
}
-
@Test(dataProvider = "doubleTernaryOpProvider")
static void FMADouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb, IntFunction<double[]> fc) {
int count = INVOC_COUNT;
switch ("FMA") {
case "fma": case "lanewise_FMA":
}
}
assertArraysEquals(r, a, b, c, Double512VectorTests::FMA);
}
+
@Test(dataProvider = "doubleTernaryOpProvider")
static void fmaDouble512VectorTests(IntFunction<double[]> fa, IntFunction<double[]> fb, IntFunction<double[]> fc) {
int count = INVOC_COUNT;
switch ("fma") {
case "fma": case "lanewise_FMA":
}
assertArraysEquals(r, a, b, c, Double512VectorTests::fma);
}
-
@Test(dataProvider = "doubleTernaryOpMaskProvider")
static void FMADouble512VectorTestsMasked(IntFunction<double[]> fa, IntFunction<double[]> fb,
IntFunction<double[]> fc, IntFunction<boolean[]> fm) {
int count = INVOC_COUNT;
switch ("FMA") {
}
assertArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
}
-
-
-
-
@Test(dataProvider = "doubleTernaryOpProvider")
static void FMADouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, IntFunction<double[]> fc) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
double[] c = fc.apply(SPECIES.length());
av.lanewise(VectorOperators.FMA, b[i], cv).intoArray(r, i);
}
assertAltBroadcastArraysEquals(r, a, b, c, Double512VectorTests::FMA);
}
-
@Test(dataProvider = "doubleTernaryOpMaskProvider")
static void FMADouble512VectorTestsBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
IntFunction<double[]> fc, IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
assertAltBroadcastArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
}
-
-
-
@Test(dataProvider = "doubleTernaryOpProvider")
static void FMADouble512VectorTestsDoubleBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, IntFunction<double[]> fc) {
int count = INVOC_COUNT;
switch ("FMA") {
case "fma": case "lanewise_FMA":
av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Double512VectorTests::FMA);
}
+
@Test(dataProvider = "doubleTernaryOpProvider")
static void fmaDouble512VectorTestsDoubleBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb, IntFunction<double[]> fc) {
int count = INVOC_COUNT;
switch ("fma") {
case "fma": case "lanewise_FMA":
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Double512VectorTests::fma);
}
-
@Test(dataProvider = "doubleTernaryOpMaskProvider")
static void FMADouble512VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb,
IntFunction<double[]> fc, IntFunction<boolean[]> fm) {
int count = INVOC_COUNT;
switch ("FMA") {
}
assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Double512VectorTests::FMA);
}
-
-
-
static double NEG(double a) {
return (double)(-((double)a));
}
static double neg(double a) {
}
assertArraysEquals(r, a, mask, Double512VectorTests::ABS);
}
-
-
-
-
-
-
-
static double SQRT(double a) {
return (double)(Math.sqrt((double)a));
}
static double sqrt(double a) {
return (double)(Math.sqrt((double)a));
}
-
-
@Test(dataProvider = "doubleUnaryOpProvider")
static void SQRTDouble512VectorTests(IntFunction<double[]> fa) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, Double512VectorTests::sqrt);
}
-
-
@Test(dataProvider = "doubleUnaryOpMaskProvider")
static void SQRTMaskedDouble512VectorTests(IntFunction<double[]> fa,
IntFunction<boolean[]> fm) {
double[] a = fa.apply(SPECIES.length());
double[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, mask, Double512VectorTests::SQRT);
}
-
@Test(dataProvider = "doubleCompareOpProvider")
static void ltDouble512VectorTestsBroadcastSmokeTest(IntFunction<double[]> fa, IntFunction<double[]> fb) {
double[] a = fa.apply(SPECIES.length());
double[] b = fb.apply(SPECIES.length());
}
assertMaskReductionArraysEquals(r, a, Double512VectorTests::maskFirstTrue);
}
+ @Test(dataProvider = "maskProvider")
+ static void maskCompressDouble512VectorTestsSmokeTest(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 indexInRangeLongDouble512VectorTestsSmokeTest(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 loopBoundLongDouble512VectorTestsSmokeTest(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 ElementSizeDouble512VectorTestsSmokeTest() {
DoubleVector av = DoubleVector.zero(SPECIES);
int elsize = av.elementSize();
Assert.assertEquals(elsize, Double.SIZE);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
}
}
}
-
< prev index next >