< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template

Print this page
rev 52233 : Add scalable shapes for Arm Scalable Vector Extension.
Summary: Add scalable vector shapes to support Arm SVE better.
Reviewed-by: duke


2144 
2145     /**
2146      * Finds a species for an element type of {@code $type$} and shape.
2147      *
2148      * @param s the shape
2149      * @param <S> the type of shape
2150      * @return a species for an element type of {@code $type$} and shape
2151      * @throws IllegalArgumentException if no such species exists for the shape
2152      */
2153     @SuppressWarnings("unchecked")
2154     public static <S extends Shape> $Type$Species<S> species(S s) {
2155         Objects.requireNonNull(s);
2156         if (s == Shapes.S_64_BIT) {
2157             return ($Type$Species<S>) $Type$64Vector.SPECIES;
2158         } else if (s == Shapes.S_128_BIT) {
2159             return ($Type$Species<S>) $Type$128Vector.SPECIES;
2160         } else if (s == Shapes.S_256_BIT) {
2161             return ($Type$Species<S>) $Type$256Vector.SPECIES;
2162         } else if (s == Shapes.S_512_BIT) {
2163             return ($Type$Species<S>) $Type$512Vector.SPECIES;


2164         } else {
2165             throw new IllegalArgumentException("Bad shape: " + s);
2166         }
2167     }
2168 }


2144 
2145     /**
2146      * Finds a species for an element type of {@code $type$} and shape.
2147      *
2148      * @param s the shape
2149      * @param <S> the type of shape
2150      * @return a species for an element type of {@code $type$} and shape
2151      * @throws IllegalArgumentException if no such species exists for the shape
2152      */
2153     @SuppressWarnings("unchecked")
2154     public static <S extends Shape> $Type$Species<S> species(S s) {
2155         Objects.requireNonNull(s);
2156         if (s == Shapes.S_64_BIT) {
2157             return ($Type$Species<S>) $Type$64Vector.SPECIES;
2158         } else if (s == Shapes.S_128_BIT) {
2159             return ($Type$Species<S>) $Type$128Vector.SPECIES;
2160         } else if (s == Shapes.S_256_BIT) {
2161             return ($Type$Species<S>) $Type$256Vector.SPECIES;
2162         } else if (s == Shapes.S_512_BIT) {
2163             return ($Type$Species<S>) $Type$512Vector.SPECIES;
2164         } else if (s == Shapes.S_Scalable_BIT) {
2165             return ($Type$Species<S>) $Type$ScalableVector.SPECIES;
2166         } else {
2167             throw new IllegalArgumentException("Bad shape: " + s);
2168         }
2169     }
2170 }
< prev index next >