< prev index next > test/jdk/jdk/incubator/vector/Float128VectorTests.java
Print this page
FloatVector.SPECIES_128;
static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
- private static final float CONST_SHIFT = Float.SIZE / 2;
static final int BUFFER_REPS = Integer.getInteger("jdk.incubator.vector.test.buffer-vectors", 25000 / 128);
interface FUnOp {
float apply(float 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(float[] r, float[] 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], (float)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], (float)0, "at index #" + idx);
+ }
+ }
+ }
+
+ static void assertexpandArraysEquals(float[] r, float[] 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], (float)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], (float)0, "at index #" + idx);
+ }
+ }
+ }
+
static void assertSelectFromArraysEquals(float[] r, float[] a, float[] 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 int bits(float e) {
return Float.floatToIntBits(e);
}
static final List<IntFunction<float[]>> FLOAT_GENERATORS = List.of(
return new Object[] {fa, fs, fm};
}))).
toArray(Object[][]::new);
}
-
static final List<IntFunction<float[]>> FLOAT_COMPARE_GENERATORS = List.of(
withToString("float[i]", (int s) -> {
return fill(s * BUFFER_REPS,
i -> (float)i);
}),
static final IntFunction<long[]> lfr = (vl) -> {
int length = BUFFER_REPS * vl;
return new long[length];
};
-
static boolean eq(float a, float b) {
return a == b;
}
static boolean neq(float a, float b) {
static boolean ge(float a, float b) {
return a >= b;
}
-
static float firstNonZero(float a, float b) {
return Float.compare(a, (float) 0) != 0 ? a : b;
}
@Test
}
}
assertArraysEquals(r, a, b, Float128VectorTests::ADD);
}
+
static float add(float a, float b) {
return (float)(a + b);
}
@Test(dataProvider = "floatBinaryOpProvider")
av.add(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Float128VectorTests::add);
}
+
static float SUB(float a, float b) {
return (float)(a - b);
}
@Test(dataProvider = "floatBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Float128VectorTests::SUB);
}
+
static float sub(float a, float b) {
return (float)(a - b);
}
@Test(dataProvider = "floatBinaryOpProvider")
av.sub(bv, vmask).intoArray(r, i);
}
assertArraysEquals(r, a, b, mask, Float128VectorTests::sub);
}
+
static float MUL(float a, float b) {
return (float)(a * b);
}
@Test(dataProvider = "floatBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Float128VectorTests::MUL);
}
+
static float mul(float a, float b) {
return (float)(a * b);
}
@Test(dataProvider = "floatBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Float128VectorTests::DIV);
}
+
static float div(float a, float b) {
return (float)(a / b);
}
@Test(dataProvider = "floatBinaryOpProvider")
}
assertArraysEquals(r, a, b, Float128VectorTests::div);
}
-
-
@Test(dataProvider = "floatBinaryOpMaskProvider")
static void DIVFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, mask, Float128VectorTests::div);
}
-
-
static float FIRST_NONZERO(float a, float b) {
return (float)(Double.doubleToLongBits(a)!=0?a:b);
}
@Test(dataProvider = "floatBinaryOpProvider")
}
assertArraysEquals(r, a, b, mask, Float128VectorTests::FIRST_NONZERO);
}
-
-
-
-
-
-
-
-
@Test(dataProvider = "floatBinaryOpProvider")
static void addFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::mul);
}
-
@Test(dataProvider = "floatBinaryOpProvider")
static void divFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, Float128VectorTests::div);
}
-
-
@Test(dataProvider = "floatBinaryOpMaskProvider")
static void divFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a, b, mask, Float128VectorTests::div);
}
-
-
-
-
-
-
-
-
-
@Test(dataProvider = "floatBinaryOpProvider")
static void ADDFloat128VectorTestsBroadcastLongSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertBroadcastLongArraysEquals(r, a, b, mask, Float128VectorTests::ADD);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
static float MIN(float a, float b) {
return (float)(Math.min(a, b));
}
@Test(dataProvider = "floatBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Float128VectorTests::MIN);
}
+
static float min(float a, float b) {
return (float)(Math.min(a, b));
}
@Test(dataProvider = "floatBinaryOpProvider")
av.min(bv).intoArray(r, i);
}
assertArraysEquals(r, a, b, Float128VectorTests::min);
}
+
static float MAX(float a, float b) {
return (float)(Math.max(a, b));
}
@Test(dataProvider = "floatBinaryOpProvider")
}
}
assertArraysEquals(r, a, b, Float128VectorTests::MAX);
}
+
static float max(float a, float b) {
return (float)(Math.max(a, b));
}
@Test(dataProvider = "floatBinaryOpProvider")
}
assertBroadcastArraysEquals(r, a, b, Float128VectorTests::max);
}
-
-
-
-
-
-
-
-
-
-
-
static float ADDReduce(float[] a, int idx) {
float res = 0;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res += a[i];
}
res += ADDReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpProvider")
static void ADDReduceFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
float ra = 0;
}
assertReductionArraysEquals(r, ra, a,
Float128VectorTests::ADDReduce, Float128VectorTests::ADDReduceAll);
}
+
static float ADDReduceMasked(float[] a, int idx, boolean[] mask) {
float 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 = "floatUnaryOpMaskProvider")
static void ADDReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Float128VectorTests::ADDReduceMasked, Float128VectorTests::ADDReduceAllMasked);
}
+
static float MULReduce(float[] a, int idx) {
float res = 1;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res *= a[i];
}
res *= MULReduce(a, i);
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpProvider")
static void MULReduceFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
float ra = 1;
}
assertReductionArraysEquals(r, ra, a,
Float128VectorTests::MULReduce, Float128VectorTests::MULReduceAll);
}
+
static float MULReduceMasked(float[] a, int idx, boolean[] mask) {
float 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 = "floatUnaryOpMaskProvider")
static void MULReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Float128VectorTests::MULReduceMasked, Float128VectorTests::MULReduceAllMasked);
}
+
static float MINReduce(float[] a, int idx) {
float res = Float.POSITIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (float) Math.min(res, a[i]);
}
res = (float) Math.min(res, MINReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpProvider")
static void MINReduceFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
float ra = Float.POSITIVE_INFINITY;
}
assertReductionArraysEquals(r, ra, a,
Float128VectorTests::MINReduce, Float128VectorTests::MINReduceAll);
}
+
static float MINReduceMasked(float[] a, int idx, boolean[] mask) {
float res = Float.POSITIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (float) Math.min(res, a[i]);
res = (float) Math.min(res, MINReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpMaskProvider")
static void MINReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Float128VectorTests::MINReduceMasked, Float128VectorTests::MINReduceAllMasked);
}
+
static float MAXReduce(float[] a, int idx) {
float res = Float.NEGATIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
res = (float) Math.max(res, a[i]);
}
res = (float) Math.max(res, MAXReduce(a, i));
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpProvider")
static void MAXReduceFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
float ra = Float.NEGATIVE_INFINITY;
}
assertReductionArraysEquals(r, ra, a,
Float128VectorTests::MAXReduce, Float128VectorTests::MAXReduceAll);
}
+
static float MAXReduceMasked(float[] a, int idx, boolean[] mask) {
float res = Float.NEGATIVE_INFINITY;
for (int i = idx; i < (idx + SPECIES.length()); i++) {
if (mask[i % SPECIES.length()])
res = (float) Math.max(res, a[i]);
res = (float) Math.max(res, MAXReduceMasked(a, i, mask));
}
return res;
}
+
@Test(dataProvider = "floatUnaryOpMaskProvider")
static void MAXReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
}
assertReductionArraysEqualsMasked(r, ra, a, mask,
Float128VectorTests::MAXReduceMasked, Float128VectorTests::MAXReduceAllMasked);
}
+
static float FIRST_NONZEROReduce(float[] a, int idx) {
float res = (float) 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 = "floatUnaryOpProvider")
static void FIRST_NONZEROReduceFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
float ra = (float) 0;
}
assertReductionArraysEquals(r, ra, a,
Float128VectorTests::FIRST_NONZEROReduce, Float128VectorTests::FIRST_NONZEROReduceAll);
}
+
static float FIRST_NONZEROReduceMasked(float[] a, int idx, boolean[] mask) {
float res = (float) 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 = "floatUnaryOpMaskProvider")
static void FIRST_NONZEROReduceFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
boolean[] mask = fm.apply(SPECIES.length());
assertReductionArraysEqualsMasked(r, ra, a, mask,
Float128VectorTests::FIRST_NONZEROReduceMasked, Float128VectorTests::FIRST_NONZEROReduceAllMasked);
}
-
-
-
-
@Test(dataProvider = "floatUnaryOpProvider")
static void withFloat128VectorTests(IntFunction<float []> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
for (int i = 0, j = 0; i < a.length; i += SPECIES.length()) {
assertInsertArraysEquals(r, a, (float)(65535+i), (j++ & (SPECIES.length()-1)), i , i + SPECIES.length());
}
}
+
static boolean testIS_DEFAULT(float a) {
return bits(a)==0;
}
@Test(dataProvider = "floatTestOpProvider")
Assert.assertEquals(mv.laneIsSet(j), vmask.laneIsSet(j) && testIS_DEFAULT(a[i + j]));
}
}
}
}
+
static boolean testIS_NEGATIVE(float a) {
return bits(a)<0;
}
@Test(dataProvider = "floatTestOpProvider")
}
}
}
}
-
static boolean testIS_NAN(float a) {
return Float.isNaN(a);
}
@Test(dataProvider = "floatTestOpProvider")
}
}
}
}
-
static boolean testIS_INFINITE(float a) {
return Float.isInfinite(a);
}
@Test(dataProvider = "floatTestOpProvider")
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void LTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void ltFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void GTFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void EQFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void eqFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void NEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void LEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void GEFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
}
}
}
-
-
-
-
-
-
-
-
-
@Test(dataProvider = "floatCompareOpProvider")
static void LTFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] < b[i]);
}
}
}
-
@Test(dataProvider = "floatCompareOpMaskProvider")
static void LTFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] < (float)((long)b[i]));
}
}
}
-
@Test(dataProvider = "floatCompareOpMaskProvider")
static void LTFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] == b[i]);
}
}
}
-
@Test(dataProvider = "floatCompareOpMaskProvider")
static void EQFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa,
IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
Assert.assertEquals(mv.laneIsSet(j), a[i + j] == (float)((long)b[i]));
}
}
}
-
@Test(dataProvider = "floatCompareOpMaskProvider")
static void EQFloat128VectorTestsBroadcastLongMaskedSmokeTest(IntFunction<float[]> fa,
IntFunction<float[]> fb, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] 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 = "floatUnaryOpMaskProvider")
+ static void compressFloat128VectorTests(IntFunction<float[]> fa,
+ IntFunction<boolean[]> fm) {
+ float[] a = fa.apply(SPECIES.length());
+ float[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ FloatVector av = FloatVector.fromArray(SPECIES, a, i);
+ av.compress(vmask).intoArray(r, i);
+ }
+ }
+
+ assertcompressArraysEquals(r, a, mask, SPECIES.length());
+ }
+
+ @Test(dataProvider = "floatUnaryOpMaskProvider")
+ static void expandFloat128VectorTests(IntFunction<float[]> fa,
+ IntFunction<boolean[]> fm) {
+ float[] a = fa.apply(SPECIES.length());
+ float[] r = fr.apply(SPECIES.length());
+ boolean[] mask = fm.apply(SPECIES.length());
+ VectorMask<Float> vmask = VectorMask.fromArray(SPECIES, mask, 0);
+
+ for (int ic = 0; ic < INVOC_COUNT; ic++) {
+ for (int i = 0; i < a.length; i += SPECIES.length()) {
+ FloatVector av = FloatVector.fromArray(SPECIES, a, i);
+ av.expand(vmask).intoArray(r, i);
+ }
+ }
+
+ assertexpandArraysEquals(r, a, mask, SPECIES.length());
+ }
+
@Test(dataProvider = "floatUnaryOpProvider")
static void getFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEquals(r, a);
}
-
-
-
-
@Test(dataProvider = "floatUnaryOpProvider")
static void ZeroFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = new float[a.length];
}
Assert.assertEquals(a, r);
}
-
-
-
static float[] sliceUnary(float[] a, int origin, int idx) {
float[] res = new float[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, Float128VectorTests::sliceUnary);
}
+
static float[] sliceBinary(float[] a, float[] b, int origin, int idx) {
float[] res = new float[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, Float128VectorTests::sliceBinary);
}
+
static float[] slice(float[] a, float[] b, int origin, boolean[] mask, int idx) {
float[] res = new float[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] : (float)0;
}
}
assertArraysEquals(r, a, b, origin, mask, Float128VectorTests::slice);
}
+
static float[] unsliceUnary(float[] a, int origin, int idx) {
float[] res = new float[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if(i < origin)
res[i] = (float)0;
}
}
assertArraysEquals(r, a, origin, Float128VectorTests::unsliceUnary);
}
+
static float[] unsliceBinary(float[] a, float[] b, int origin, int part, int idx) {
float[] res = new float[SPECIES.length()];
for (int i = 0, j = 0; i < SPECIES.length(); i++){
if (part == 0) {
if (i < origin)
}
}
assertArraysEquals(r, a, b, origin, part, Float128VectorTests::unsliceBinary);
}
+
static float[] unslice(float[] a, float[] b, int origin, int part, boolean[] mask, int idx) {
float[] res = new float[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, Float128VectorTests::SIN, Float128VectorTests::strictSIN);
}
-
static float EXP(float a) {
return (float)(Math.exp((double)a));
}
static float strictEXP(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXP, Float128VectorTests::strictEXP);
}
-
static float LOG1P(float a) {
return (float)(Math.log1p((double)a));
}
static float strictLOG1P(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG1P, Float128VectorTests::strictLOG1P);
}
-
static float LOG(float a) {
return (float)(Math.log((double)a));
}
static float strictLOG(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG, Float128VectorTests::strictLOG);
}
-
static float LOG10(float a) {
return (float)(Math.log10((double)a));
}
static float strictLOG10(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::LOG10, Float128VectorTests::strictLOG10);
}
-
static float EXPM1(float a) {
return (float)(Math.expm1((double)a));
}
static float strictEXPM1(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::EXPM1, Float128VectorTests::strictEXPM1);
}
-
static float COS(float a) {
return (float)(Math.cos((double)a));
}
static float strictCOS(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COS, Float128VectorTests::strictCOS);
}
-
static float TAN(float a) {
return (float)(Math.tan((double)a));
}
static float strictTAN(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TAN, Float128VectorTests::strictTAN);
}
-
static float SINH(float a) {
return (float)(Math.sinh((double)a));
}
static float strictSINH(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::SINH, Float128VectorTests::strictSINH);
}
-
static float COSH(float a) {
return (float)(Math.cosh((double)a));
}
static float strictCOSH(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::COSH, Float128VectorTests::strictCOSH);
}
-
static float TANH(float a) {
return (float)(Math.tanh((double)a));
}
static float strictTANH(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::TANH, Float128VectorTests::strictTANH);
}
-
static float ASIN(float a) {
return (float)(Math.asin((double)a));
}
static float strictASIN(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ASIN, Float128VectorTests::strictASIN);
}
-
static float ACOS(float a) {
return (float)(Math.acos((double)a));
}
static float strictACOS(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ACOS, Float128VectorTests::strictACOS);
}
-
static float ATAN(float a) {
return (float)(Math.atan((double)a));
}
static float strictATAN(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::ATAN, Float128VectorTests::strictATAN);
}
-
static float CBRT(float a) {
return (float)(Math.cbrt((double)a));
}
static float strictCBRT(float a) {
}
assertArraysEqualsWithinOneUlp(r, a, Float128VectorTests::CBRT, Float128VectorTests::strictCBRT);
}
-
static float HYPOT(float a, float b) {
return (float)(Math.hypot((double)a, (double)b));
}
static float strictHYPOT(float a, float b) {
assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::HYPOT, Float128VectorTests::strictHYPOT);
}
-
static float POW(float a, float b) {
return (float)(Math.pow((double)a, (double)b));
}
static float strictPOW(float a, float b) {
}
assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
}
+
static float pow(float a, float b) {
return (float)(Math.pow((double)a, (double)b));
}
static float strictpow(float a, float b) {
assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::pow, Float128VectorTests::strictpow);
}
-
static float ATAN2(float a, float b) {
return (float)(Math.atan2((double)a, (double)b));
}
static float strictATAN2(float a, float b) {
assertArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::ATAN2, Float128VectorTests::strictATAN2);
}
-
@Test(dataProvider = "floatBinaryOpProvider")
static void POWFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::POW, Float128VectorTests::strictPOW);
}
+
@Test(dataProvider = "floatBinaryOpProvider")
static void powFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::pow, Float128VectorTests::strictpow);
}
-
static float FMA(float a, float b, float c) {
return (float)(Math.fma(a, b, c));
}
static float fma(float a, float b, float c) {
return (float)(Math.fma(a, b, c));
}
-
@Test(dataProvider = "floatTernaryOpProvider")
static void FMAFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
assertBroadcastArraysEqualsWithinOneUlp(r, a, b, Float128VectorTests::pow, Float128VectorTests::strictpow);
}
static float FMA(float a, float b, float c) {
return (float)(Math.fma(a, b, c));
}
+
static float fma(float a, float b, float c) {
return (float)(Math.fma(a, b, c));
}
@Test(dataProvider = "floatTernaryOpProvider")
static void FMAFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
}
}
assertArraysEquals(r, a, b, c, Float128VectorTests::FMA);
}
+
@Test(dataProvider = "floatTernaryOpProvider")
static void fmaFloat128VectorTests(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, c, Float128VectorTests::fma);
}
-
@Test(dataProvider = "floatTernaryOpMaskProvider")
static void FMAFloat128VectorTestsMasked(IntFunction<float[]> fa, IntFunction<float[]> fb,
IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
}
-
-
-
-
@Test(dataProvider = "floatTernaryOpProvider")
static void FMAFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
av.lanewise(VectorOperators.FMA, b[i], cv).intoArray(r, i);
}
assertAltBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
}
-
@Test(dataProvider = "floatTernaryOpMaskProvider")
static void FMAFloat128VectorTestsBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertAltBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
}
-
-
-
@Test(dataProvider = "floatTernaryOpProvider")
static void FMAFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
av.lanewise(VectorOperators.FMA, b[i], c[i]).intoArray(r, i);
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::FMA);
}
+
@Test(dataProvider = "floatTernaryOpProvider")
static void fmaFloat128VectorTestsDoubleBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb, IntFunction<float[]> fc) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
float[] c = fc.apply(SPECIES.length());
}
assertDoubleBroadcastArraysEquals(r, a, b, c, Float128VectorTests::fma);
}
-
@Test(dataProvider = "floatTernaryOpMaskProvider")
static void FMAFloat128VectorTestsDoubleBroadcastMaskedSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb,
IntFunction<float[]> fc, IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertDoubleBroadcastArraysEquals(r, a, b, c, mask, Float128VectorTests::FMA);
}
-
-
-
static float NEG(float a) {
return (float)(-((float)a));
}
static float neg(float a) {
}
assertArraysEquals(r, a, mask, Float128VectorTests::ABS);
}
-
-
-
-
-
-
-
static float SQRT(float a) {
return (float)(Math.sqrt((double)a));
}
static float sqrt(float a) {
return (float)(Math.sqrt((double)a));
}
-
-
@Test(dataProvider = "floatUnaryOpProvider")
static void SQRTFloat128VectorTests(IntFunction<float[]> fa) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, Float128VectorTests::sqrt);
}
-
-
@Test(dataProvider = "floatUnaryOpMaskProvider")
static void SQRTMaskedFloat128VectorTests(IntFunction<float[]> fa,
IntFunction<boolean[]> fm) {
float[] a = fa.apply(SPECIES.length());
float[] r = fr.apply(SPECIES.length());
}
assertArraysEquals(r, a, mask, Float128VectorTests::SQRT);
}
-
@Test(dataProvider = "floatCompareOpProvider")
static void ltFloat128VectorTestsBroadcastSmokeTest(IntFunction<float[]> fa, IntFunction<float[]> fb) {
float[] a = fa.apply(SPECIES.length());
float[] b = fb.apply(SPECIES.length());
}
assertMaskReductionArraysEquals(r, a, Float128VectorTests::maskFirstTrue);
}
+ @Test(dataProvider = "maskProvider")
+ static void maskCompressFloat128VectorTestsSmokeTest(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 indexInRangeLongFloat128VectorTestsSmokeTest(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 loopBoundLongFloat128VectorTestsSmokeTest(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 ElementSizeFloat128VectorTestsSmokeTest() {
FloatVector av = FloatVector.zero(SPECIES);
int elsize = av.elementSize();
Assert.assertEquals(elsize, Float.SIZE);
for (int ic = 0; ic < INVOC_COUNT; ic++) {
Assert.assertEquals(SPECIES.maskAll(true).toLong(), -1L >>> (64 - SPECIES.length()));
}
}
}
-
< prev index next >