60 public static final VectorSpecies<Byte> BSPEC256 = ByteVector.SPECIES_256;
61 public static final VectorSpecies<Short> SSPEC256 = ShortVector.SPECIES_256;
62 public static final VectorSpecies<Integer> ISPEC256 = IntVector.SPECIES_256;
63 public static final VectorSpecies<Long> LSPEC256 = LongVector.SPECIES_256;
64 public static final VectorSpecies<Float> FSPEC256 = FloatVector.SPECIES_256;
65 public static final VectorSpecies<Double> DSPEC256 = DoubleVector.SPECIES_256;
66
67 public static final VectorSpecies<Byte> BSPEC512 = ByteVector.SPECIES_512;
68 public static final VectorSpecies<Short> SSPEC512 = ShortVector.SPECIES_512;
69 public static final VectorSpecies<Integer> ISPEC512 = IntVector.SPECIES_512;
70 public static final VectorSpecies<Long> LSPEC512 = LongVector.SPECIES_512;
71 public static final VectorSpecies<Float> FSPEC512 = FloatVector.SPECIES_512;
72 public static final VectorSpecies<Double> DSPEC512 = DoubleVector.SPECIES_512;
73
74 public static final String REINTERPRET_NODE = IRNode.VECTOR_REINTERPRET;
75
76 public static void runMainHelper(Class<?> testClass, Stream<VectorSpeciesPair> testMethods, String... flags) {
77 var test = new TestFramework(testClass);
78 test.setDefaultWarmup(1);
79 test.addHelperClasses(VectorReshapeHelper.class);
80 test.addFlags("--add-modules=jdk.incubator.vector", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "--enable-preview");
81 test.addFlags(flags);
82 String testMethodNames = testMethods
83 .filter(p -> p.isp().length() <= VectorSpecies.ofLargestShape(p.isp().elementType()).length())
84 .filter(p -> p.osp().length() <= VectorSpecies.ofLargestShape(p.osp().elementType()).length())
85 .map(VectorSpeciesPair::format)
86 .collect(Collectors.joining(","));
87 test.addFlags("-DTest=" + testMethodNames);
88 test.start();
89 }
90
91 @ForceInline
92 public static <T, U> void vectorCast(VectorOperators.Conversion<T, U> cop,
93 VectorSpecies<T> isp, VectorSpecies<U> osp, Object input, Object output) {
94 var outputVector = readVector(isp, input)
95 .convertShape(cop, osp, 0);
96 writeVector(osp, outputVector, output);
97 }
98
99 public static <T, U> void runCastHelper(VectorOperators.Conversion<T, U> castOp,
100 VectorSpecies<T> isp, VectorSpecies<U> osp) throws Throwable {
|
60 public static final VectorSpecies<Byte> BSPEC256 = ByteVector.SPECIES_256;
61 public static final VectorSpecies<Short> SSPEC256 = ShortVector.SPECIES_256;
62 public static final VectorSpecies<Integer> ISPEC256 = IntVector.SPECIES_256;
63 public static final VectorSpecies<Long> LSPEC256 = LongVector.SPECIES_256;
64 public static final VectorSpecies<Float> FSPEC256 = FloatVector.SPECIES_256;
65 public static final VectorSpecies<Double> DSPEC256 = DoubleVector.SPECIES_256;
66
67 public static final VectorSpecies<Byte> BSPEC512 = ByteVector.SPECIES_512;
68 public static final VectorSpecies<Short> SSPEC512 = ShortVector.SPECIES_512;
69 public static final VectorSpecies<Integer> ISPEC512 = IntVector.SPECIES_512;
70 public static final VectorSpecies<Long> LSPEC512 = LongVector.SPECIES_512;
71 public static final VectorSpecies<Float> FSPEC512 = FloatVector.SPECIES_512;
72 public static final VectorSpecies<Double> DSPEC512 = DoubleVector.SPECIES_512;
73
74 public static final String REINTERPRET_NODE = IRNode.VECTOR_REINTERPRET;
75
76 public static void runMainHelper(Class<?> testClass, Stream<VectorSpeciesPair> testMethods, String... flags) {
77 var test = new TestFramework(testClass);
78 test.setDefaultWarmup(1);
79 test.addHelperClasses(VectorReshapeHelper.class);
80 test.addFlags("--add-modules=jdk.incubator.vector", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
81 test.addFlags(flags);
82 String testMethodNames = testMethods
83 .filter(p -> p.isp().length() <= VectorSpecies.ofLargestShape(p.isp().elementType()).length())
84 .filter(p -> p.osp().length() <= VectorSpecies.ofLargestShape(p.osp().elementType()).length())
85 .map(VectorSpeciesPair::format)
86 .collect(Collectors.joining(","));
87 test.addFlags("-DTest=" + testMethodNames);
88 test.start();
89 }
90
91 @ForceInline
92 public static <T, U> void vectorCast(VectorOperators.Conversion<T, U> cop,
93 VectorSpecies<T> isp, VectorSpecies<U> osp, Object input, Object output) {
94 var outputVector = readVector(isp, input)
95 .convertShape(cop, osp, 0);
96 writeVector(osp, outputVector, output);
97 }
98
99 public static <T, U> void runCastHelper(VectorOperators.Conversion<T, U> castOp,
100 VectorSpecies<T> isp, VectorSpecies<U> osp) throws Throwable {
|