< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.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


1361 
1362     /**
1363      * Finds a species for an element type of {@code int} and shape.
1364      *
1365      * @param s the shape
1366      * @param <S> the type of shape
1367      * @return a species for an element type of {@code int} and shape
1368      * @throws IllegalArgumentException if no such species exists for the shape
1369      */
1370     @SuppressWarnings("unchecked")
1371     public static <S extends Shape> IntSpecies<S> species(S s) {
1372         Objects.requireNonNull(s);
1373         if (s == Shapes.S_64_BIT) {
1374             return (IntSpecies<S>) Int64Vector.SPECIES;
1375         } else if (s == Shapes.S_128_BIT) {
1376             return (IntSpecies<S>) Int128Vector.SPECIES;
1377         } else if (s == Shapes.S_256_BIT) {
1378             return (IntSpecies<S>) Int256Vector.SPECIES;
1379         } else if (s == Shapes.S_512_BIT) {
1380             return (IntSpecies<S>) Int512Vector.SPECIES;


1381         } else {
1382             throw new IllegalArgumentException("Bad shape: " + s);
1383         }
1384     }
1385 }


1361 
1362     /**
1363      * Finds a species for an element type of {@code int} and shape.
1364      *
1365      * @param s the shape
1366      * @param <S> the type of shape
1367      * @return a species for an element type of {@code int} and shape
1368      * @throws IllegalArgumentException if no such species exists for the shape
1369      */
1370     @SuppressWarnings("unchecked")
1371     public static <S extends Shape> IntSpecies<S> species(S s) {
1372         Objects.requireNonNull(s);
1373         if (s == Shapes.S_64_BIT) {
1374             return (IntSpecies<S>) Int64Vector.SPECIES;
1375         } else if (s == Shapes.S_128_BIT) {
1376             return (IntSpecies<S>) Int128Vector.SPECIES;
1377         } else if (s == Shapes.S_256_BIT) {
1378             return (IntSpecies<S>) Int256Vector.SPECIES;
1379         } else if (s == Shapes.S_512_BIT) {
1380             return (IntSpecies<S>) Int512Vector.SPECIES;
1381         } else if (s == Shapes.S_Scalable_BIT) {
1382             return (IntSpecies<S>) IntScalableVector.SPECIES;
1383         } else {
1384             throw new IllegalArgumentException("Bad shape: " + s);
1385         }
1386     }
1387 }
< prev index next >