< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java

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


1111 
1112     /**
1113      * Finds a species for an element type of {@code short} and shape.
1114      *
1115      * @param s the shape
1116      * @param <S> the type of shape
1117      * @return a species for an element type of {@code short} and shape
1118      * @throws IllegalArgumentException if no such species exists for the shape
1119      */
1120     @SuppressWarnings("unchecked")
1121     public static <S extends Shape> ShortSpecies<S> species(S s) {
1122         Objects.requireNonNull(s);
1123         if (s == Shapes.S_64_BIT) {
1124             return (ShortSpecies<S>) Short64Vector.SPECIES;
1125         } else if (s == Shapes.S_128_BIT) {
1126             return (ShortSpecies<S>) Short128Vector.SPECIES;
1127         } else if (s == Shapes.S_256_BIT) {
1128             return (ShortSpecies<S>) Short256Vector.SPECIES;
1129         } else if (s == Shapes.S_512_BIT) {
1130             return (ShortSpecies<S>) Short512Vector.SPECIES;


1131         } else {
1132             throw new IllegalArgumentException("Bad shape: " + s);
1133         }
1134     }
1135 }


1111 
1112     /**
1113      * Finds a species for an element type of {@code short} and shape.
1114      *
1115      * @param s the shape
1116      * @param <S> the type of shape
1117      * @return a species for an element type of {@code short} and shape
1118      * @throws IllegalArgumentException if no such species exists for the shape
1119      */
1120     @SuppressWarnings("unchecked")
1121     public static <S extends Shape> ShortSpecies<S> species(S s) {
1122         Objects.requireNonNull(s);
1123         if (s == Shapes.S_64_BIT) {
1124             return (ShortSpecies<S>) Short64Vector.SPECIES;
1125         } else if (s == Shapes.S_128_BIT) {
1126             return (ShortSpecies<S>) Short128Vector.SPECIES;
1127         } else if (s == Shapes.S_256_BIT) {
1128             return (ShortSpecies<S>) Short256Vector.SPECIES;
1129         } else if (s == Shapes.S_512_BIT) {
1130             return (ShortSpecies<S>) Short512Vector.SPECIES;
1131         } else if (s == Shapes.S_Scalable_BIT) {
1132             return (ShortSpecies<S>) ShortScalableVector.SPECIES;
1133         } else {
1134             throw new IllegalArgumentException("Bad shape: " + s);
1135         }
1136     }
1137 }
< prev index next >