< prev index next >

test/jdk/jdk/incubator/vector/Double64VectorTests.java

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level

*** 25,36 **** * @test * @modules jdk.incubator.vector * @run testng/othervm -ea -esa Double64VectorTests */ ! import jdk.incubator.vector.Vector.Shape; ! import jdk.incubator.vector.Vector.Species; import jdk.incubator.vector.Vector; import jdk.incubator.vector.DoubleVector; import org.testng.Assert; --- 25,38 ---- * @test * @modules jdk.incubator.vector * @run testng/othervm -ea -esa Double64VectorTests */ ! import jdk.incubator.vector.VectorShape; ! import jdk.incubator.vector.VectorSpecies; ! import jdk.incubator.vector.VectorShuffle; ! import jdk.incubator.vector.VectorMask; import jdk.incubator.vector.Vector; import jdk.incubator.vector.DoubleVector; import org.testng.Assert;
*** 46,56 **** import java.util.stream.Stream; @Test public class Double64VectorTests extends AbstractVectorTest { ! static final Species<Double> SPECIES = DoubleVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); interface FUnOp { --- 48,58 ---- import java.util.stream.Stream; @Test public class Double64VectorTests extends AbstractVectorTest { ! static final VectorSpecies<Double> SPECIES = DoubleVector.SPECIES_64; static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100); interface FUnOp {
*** 560,570 **** IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 562,572 ---- IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 600,610 **** IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 602,612 ---- IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 643,653 **** IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 645,655 ---- IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 684,694 **** IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 686,696 ---- IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 969,979 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.lessThan(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] < b[i + j]); } --- 971,981 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.lessThan(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] < b[i + j]); }
*** 989,999 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.greaterThan(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] > b[i + j]); } --- 991,1001 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.greaterThan(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] > b[i + j]); }
*** 1009,1019 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.equal(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] == b[i + j]); } --- 1011,1021 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.equal(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] == b[i + j]); }
*** 1029,1039 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.notEqual(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] != b[i + j]); } --- 1031,1041 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.notEqual(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] != b[i + j]); }
*** 1049,1059 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.lessThanEq(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] <= b[i + j]); } --- 1051,1061 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.lessThanEq(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] <= b[i + j]); }
*** 1069,1079 **** 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! Vector.Mask<Double> mv = av.greaterThanEq(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] >= b[i + j]); } --- 1071,1081 ---- 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); ! VectorMask<Double> mv = av.greaterThanEq(bv); // Check results as part of computation. for (int j = 0; j < SPECIES.length(); j++) { Assert.assertEquals(mv.getElement(j), a[i + j] >= b[i + j]); }
*** 1091,1101 **** IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 1093,1103 ---- IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 1114,1124 **** double[] r = fr.apply(SPECIES.length()); 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.rearrange(DoubleVector.shuffleFromArray(SPECIES, order, i)).intoArray(r, i); } } assertRearrangeArraysEquals(a, r, order, SPECIES.length()); } --- 1116,1126 ---- double[] r = fr.apply(SPECIES.length()); 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.rearrange(VectorShuffle.fromArray(SPECIES, order, i)).intoArray(r, i); } } assertRearrangeArraysEquals(a, r, order, SPECIES.length()); }
*** 1754,1764 **** double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] c = fc.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i); --- 1756,1766 ---- double[] a = fa.apply(SPECIES.length()); double[] b = fb.apply(SPECIES.length()); double[] c = fc.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! VectorMask<Double> vmask = VectorMask.fromValues(SPECIES, mask); 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); DoubleVector bv = DoubleVector.fromArray(SPECIES, b, i);
*** 1794,1804 **** static void negMaskedDouble64VectorTests(IntFunction<double[]> fa, IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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.neg(vmask).intoArray(r, i); --- 1796,1806 ---- static void negMaskedDouble64VectorTests(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.fromValues(SPECIES, mask); 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.neg(vmask).intoArray(r, i);
*** 1831,1841 **** static void absMaskedDouble64VectorTests(IntFunction<double[]> fa, IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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.abs(vmask).intoArray(r, i); --- 1833,1843 ---- static void absMaskedDouble64VectorTests(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.fromValues(SPECIES, mask); 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.abs(vmask).intoArray(r, i);
*** 1876,1886 **** static void sqrtMaskedDouble64VectorTests(IntFunction<double[]> fa, IntFunction<boolean[]> fm) { double[] a = fa.apply(SPECIES.length()); double[] r = fr.apply(SPECIES.length()); boolean[] mask = fm.apply(SPECIES.length()); ! Vector.Mask<Double> vmask = DoubleVector.maskFromValues(SPECIES, mask); 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.sqrt(vmask).intoArray(r, i); --- 1878,1888 ---- static void sqrtMaskedDouble64VectorTests(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.fromValues(SPECIES, mask); 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.sqrt(vmask).intoArray(r, i);
< prev index next >