< prev index next >

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

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

@@ -56,31 +56,31 @@
         $type$ apply(int i, $type$ a);
     }
 
     abstract $abstractvectortype$ uOp(FUnOp f);
 
-    abstract $abstractvectortype$ uOp(Mask<$Boxtype$> m, FUnOp f);
+    abstract $abstractvectortype$ uOp(VectorMask<$Boxtype$> m, FUnOp f);
 
     // Binary operator
 
     interface FBinOp {
         $type$ apply(int i, $type$ a, $type$ b);
     }
 
     abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, FBinOp f);
 
-    abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, Mask<$Boxtype$> m, FBinOp f);
+    abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m, FBinOp f);
 
     // Trinary operator
 
     interface FTriOp {
         $type$ apply(int i, $type$ a, $type$ b, $type$ c);
     }
 
     abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f);
 
-    abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m, FTriOp f);
+    abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m, FTriOp f);
 
     // Reduction operator
 
     abstract $type$ rOp($type$ v, FBinOp f);
 

@@ -88,21 +88,21 @@
 
     interface FBinTest {
         boolean apply(int i, $type$ a, $type$ b);
     }
 
-    abstract Mask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f);
+    abstract VectorMask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f);
 
     // Foreach
 
     interface FUnCon {
         void apply(int i, $type$ a);
     }
 
     abstract void forEach(FUnCon f);
 
-    abstract void forEach(Mask<$Boxtype$> m, FUnCon f);
+    abstract void forEach(VectorMask<$Boxtype$> m, FUnCon f);
 
     // Static factories
 
     /**
      * Returns a vector where all lane elements are set to the default

@@ -111,11 +111,11 @@
      * @param species species of desired vector
      * @return a zero vector of given species
      */
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ zero(Species<$Boxtype$> species) {
+    public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
 #if[FP]
         return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
                                                  $Type$.$type$To$Bitstype$Bits(0.0f), species,
                                                  ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
 #else[FP]

@@ -131,11 +131,11 @@
      * Bytes are composed into primitive lane elements according to the
      * native byte order of the underlying platform
      * <p>
      * This method behaves as if it returns the result of calling the
      * byte buffer, offset, and mask accepting
-     * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows:
+     * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
      * <pre>{@code
      * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
      * }</pre>
      *
      * @param species species of desired vector

@@ -145,11 +145,11 @@
      * @throws IndexOutOfBoundsException if {@code i < 0} or
      * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
      */
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix) {
+    public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix) {
         Objects.requireNonNull(a);
         ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
                                      a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
                                      a, ix, species,

@@ -167,11 +167,11 @@
      * Bytes are composed into primitive lane elements according to the
      * native byte order of the underlying platform.
      * <p>
      * This method behaves as if it returns the result of calling the
      * byte buffer, offset, and mask accepting
-     * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows:
+     * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
      * <pre>{@code
      * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
      * }</pre>
      *
      * @param species species of desired vector

@@ -186,11 +186,11 @@
      * for any vector lane index {@code N} where the mask at lane {@code N}
      * is set
      * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
      */
     @ForceInline
-    public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix, Mask<$Boxtype$> m) {
+    public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix, VectorMask<$Boxtype$> m) {
         return zero(species).blend(fromByteArray(species, a, ix), m);
     }
 
     /**
      * Loads a vector from an array starting at offset.

@@ -206,11 +206,11 @@
      * @throws IndexOutOfBoundsException if {@code i < 0}, or
      * {@code i > a.length - this.length()}
      */
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i){
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i){
         Objects.requireNonNull(a);
         i = VectorIntrinsics.checkIndex(i, a.length, species.length());
         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
                                      a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
                                      a, i, species,

@@ -235,11 +235,11 @@
      * @throws IndexOutOfBoundsException if {@code i < 0}, or
      * for any vector lane index {@code N} where the mask at lane {@code N}
      * is set {@code i > a.length - N}
      */
     @ForceInline
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m) {
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m) {
         return zero(species).blend(fromArray(species, a, i), m);
     }
 
     /**
      * Loads a vector from an array using indexes obtained from an index

@@ -261,17 +261,17 @@
      * {@code j > indexMap.length - this.length()},
      * or for any vector lane index {@code N} the result of
      * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
      */
 #if[byteOrShort]
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
         return (($Type$Species)species).op(n -> a[i + indexMap[j + n]]);
     }
 #else[byteOrShort]
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
         Objects.requireNonNull(a);
         Objects.requireNonNull(indexMap);
 
 #if[longOrDouble]
         if (species.length() == 1) {

@@ -285,11 +285,11 @@
         vix = VectorIntrinsics.checkIndex(vix, a.length);
 
         return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
                                             IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
                                             a, i, indexMap, j, species,
-                                            ($type$[] c, int idx, int[] iMap, int idy, Species<$Boxtype$> s) ->
+                                            ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
                                                 (($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
         }
 
 #end[byteOrShort]
     /**

@@ -315,17 +315,17 @@
      * or for any vector lane index {@code N} where the mask at lane
      * {@code N} is set the result of {@code i + indexMap[j + N]} is
      * {@code < 0} or {@code >= a.length}
      */
 #if[byteOrShort]
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
         return (($Type$Species)species).op(m, n -> a[i + indexMap[j + n]]);
     }
 #else[byteOrShort]
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
+    public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
         // @@@ This can result in out of bounds errors for unset mask lanes
         return zero(species).blend(fromArray(species, a, i, indexMap, j), m);
     }
 
 #end[byteOrShort]

@@ -337,11 +337,11 @@
      * Bytes are composed into primitive lane elements according to the
      * native byte order of the underlying platform.
      * <p>
      * This method behaves as if it returns the result of calling the
      * byte buffer, offset, and mask accepting
-     * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask)} method} as follows:
+     * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask)} method} as follows:
      * <pre>{@code
      *   return this.fromByteBuffer(b, i, this.maskAllTrue())
      * }</pre>
      *
      * @param species species of desired vector

@@ -354,11 +354,11 @@
      * {@code this.length() * this.elementSize() / Byte.SIZE} bytes
      * remaining in the byte buffer from the given offset
      */
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix) {
+    public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix) {
         if (bb.order() != ByteOrder.nativeOrder()) {
             throw new IllegalArgumentException();
         }
         ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
         return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),

@@ -406,11 +406,11 @@
      * for any vector lane index {@code N} where the mask at lane {@code N}
      * is set
      * {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
      */
     @ForceInline
-    public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix, Mask<$Boxtype$> m) {
+    public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix, VectorMask<$Boxtype$> m) {
         return zero(species).blend(fromByteBuffer(species, bb, ix), m);
     }
 
     /**
      * Returns a vector where all lane elements are set to the primitive

@@ -422,20 +422,20 @@
      * the primitive value {@code e}
      */
 #if[FP]
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ broadcast(Species<$Boxtype$> s, $type$ e) {
+    public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
         return VectorIntrinsics.broadcastCoerced(
             (Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
             $Type$.$type$To$Bitstype$Bits(e), s,
             ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
     }
 #else[FP]
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ broadcast(Species<$Boxtype$> s, $type$ e) {
+    public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
         return VectorIntrinsics.broadcastCoerced(
             (Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
             e, s,
             ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
     }

@@ -455,11 +455,11 @@
      * value
      * @throws IndexOutOfBoundsException if {@code es.length < this.length()}
      */
     @ForceInline
     @SuppressWarnings("unchecked")
-    public static $abstractvectortype$ scalars(Species<$Boxtype$> s, $type$... es) {
+    public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> s, $type$... es) {
         Objects.requireNonNull(es);
         int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
         return VectorIntrinsics.load((Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
                                      es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
                                      es, ix, s,

@@ -475,11 +475,11 @@
      * @param e the value
      * @return a vector where the first lane element is set to the primitive
      * value {@code e}
      */
     @ForceInline
-    public static final $abstractvectortype$ single(Species<$Boxtype$> s, $type$ e) {
+    public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> s, $type$ e) {
         return zero(s).with(0, e);
     }
 
     /**
      * Returns a vector where each lane element is set to a randomly

@@ -495,252 +495,28 @@
      * @param s species of the desired vector
      * @return a vector where each lane elements is set to a randomly
      * generated primitive value
      */
 #if[intOrLong]
-    public static $abstractvectortype$ random(Species<$Boxtype$> s) {
+    public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
         ThreadLocalRandom r = ThreadLocalRandom.current();
         return (($Type$Species)s).op(i -> r.next$Type$());
     }
 #else[intOrLong]
 #if[FP]
-    public static $abstractvectortype$ random(Species<$Boxtype$> s) {
+    public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
         ThreadLocalRandom r = ThreadLocalRandom.current();
         return (($Type$Species)s).op(i -> r.next$Type$());
     }
 #else[FP]
-    public static $abstractvectortype$ random(Species<$Boxtype$> s) {
+    public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
         ThreadLocalRandom r = ThreadLocalRandom.current();
         return (($Type$Species)s).op(i -> ($type$) r.nextInt());
     }
 #end[FP]
 #end[intOrLong]
 
-    /**
-     * Returns a mask where each lane is set or unset according to given
-     * {@code boolean} values
-     * <p>
-     * For each mask lane, where {@code N} is the mask lane index,
-     * if the given {@code boolean} value at index {@code N} is {@code true}
-     * then the mask lane at index {@code N} is set, otherwise it is unset.
-     *
-     * @param species mask species
-     * @param bits the given {@code boolean} values
-     * @return a mask where each lane is set or unset according to the given {@code boolean} value
-     * @throws IndexOutOfBoundsException if {@code bits.length < species.length()}
-     */
-    @ForceInline
-    public static Mask<$Boxtype$> maskFromValues(Species<$Boxtype$> species, boolean... bits) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return new $Type$MaxVector.$Type$MaxMask(bits);
-        switch (species.bitSize()) {
-            case 64: return new $Type$64Vector.$Type$64Mask(bits);
-            case 128: return new $Type$128Vector.$Type$128Mask(bits);
-            case 256: return new $Type$256Vector.$Type$256Mask(bits);
-            case 512: return new $Type$512Vector.$Type$512Mask(bits);
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    // @@@ This is a bad implementation -- makes lambdas capturing -- fix this
-    static Mask<$Boxtype$> trueMask(Species<$Boxtype$> species) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return $Type$MaxVector.$Type$MaxMask.TRUE_MASK;
-        switch (species.bitSize()) {
-            case 64: return $Type$64Vector.$Type$64Mask.TRUE_MASK;
-            case 128: return $Type$128Vector.$Type$128Mask.TRUE_MASK;
-            case 256: return $Type$256Vector.$Type$256Mask.TRUE_MASK;
-            case 512: return $Type$512Vector.$Type$512Mask.TRUE_MASK;
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    static Mask<$Boxtype$> falseMask(Species<$Boxtype$> species) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return $Type$MaxVector.$Type$MaxMask.FALSE_MASK;
-        switch (species.bitSize()) {
-            case 64: return $Type$64Vector.$Type$64Mask.FALSE_MASK;
-            case 128: return $Type$128Vector.$Type$128Mask.FALSE_MASK;
-            case 256: return $Type$256Vector.$Type$256Mask.FALSE_MASK;
-            case 512: return $Type$512Vector.$Type$512Mask.FALSE_MASK;
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    /**
-     * Loads a mask from a {@code boolean} array starting at an offset.
-     * <p>
-     * For each mask lane, where {@code N} is the mask lane index,
-     * if the array element at index {@code ix + N} is {@code true} then the
-     * mask lane at index {@code N} is set, otherwise it is unset.
-     *
-     * @param species mask species
-     * @param bits the {@code boolean} array
-     * @param ix the offset into the array
-     * @return the mask loaded from a {@code boolean} array
-     * @throws IndexOutOfBoundsException if {@code ix < 0}, or
-     * {@code ix > bits.length - species.length()}
-     */
-    @ForceInline
-    @SuppressWarnings("unchecked")
-    public static Mask<$Boxtype$> maskFromArray(Species<$Boxtype$> species, boolean[] bits, int ix) {
-        Objects.requireNonNull(bits);
-        ix = VectorIntrinsics.checkIndex(ix, bits.length, species.length());
-        return VectorIntrinsics.load((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
-                                     bits, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
-                                     bits, ix, species,
-                                     (c, idx, s) -> (Mask<$Boxtype$>) (($Type$Species)s).opm(n -> c[idx + n]));
-    }
-
-    /**
-     * Returns a mask where all lanes are set.
-     *
-     * @param species mask species
-     * @return a mask where all lanes are set
-     */
-    @ForceInline
-    @SuppressWarnings("unchecked")
-    public static Mask<$Boxtype$> maskAllTrue(Species<$Boxtype$> species) {
-        return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
-                                                 ($bitstype$)-1,  species,
-                                                 ((z, s) -> trueMask(s)));
-    }
-
-    /**
-     * Returns a mask where all lanes are unset.
-     *
-     * @param species mask species
-     * @return a mask where all lanes are unset
-     */
-    @ForceInline
-    @SuppressWarnings("unchecked")
-    public static Mask<$Boxtype$> maskAllFalse(Species<$Boxtype$> species) {
-        return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
-                                                 0, species, 
-                                                 ((z, s) -> falseMask(s)));
-    }
-
-    /**
-     * Returns a shuffle of mapped indexes where each lane element is
-     * the result of applying a mapping function to the corresponding lane
-     * index.
-     * <p>
-     * Care should be taken to ensure Shuffle values produced from this
-     * method are consumed as constants to ensure optimal generation of
-     * code.  For example, values held in static final fields or values
-     * held in loop constant local variables.
-     * <p>
-     * This method behaves as if a shuffle is created from an array of
-     * mapped indexes as follows:
-     * <pre>{@code
-     *   int[] a = new int[species.length()];
-     *   for (int i = 0; i < a.length; i++) {
-     *       a[i] = f.applyAsInt(i);
-     *   }
-     *   return this.shuffleFromValues(a);
-     * }</pre>
-     *
-     * @param species shuffle species
-     * @param f the lane index mapping function
-     * @return a shuffle of mapped indexes
-     */
-    @ForceInline
-    public static Shuffle<$Boxtype$> shuffle(Species<$Boxtype$> species, IntUnaryOperator f) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return new $Type$MaxVector.$Type$MaxShuffle(f);
-        switch (species.bitSize()) {
-            case 64: return new $Type$64Vector.$Type$64Shuffle(f);
-            case 128: return new $Type$128Vector.$Type$128Shuffle(f);
-            case 256: return new $Type$256Vector.$Type$256Shuffle(f);
-            case 512: return new $Type$512Vector.$Type$512Shuffle(f);
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    /**
-     * Returns a shuffle where each lane element is the value of its
-     * corresponding lane index.
-     * <p>
-     * This method behaves as if a shuffle is created from an identity
-     * index mapping function as follows:
-     * <pre>{@code
-     *   return this.shuffle(i -> i);
-     * }</pre>
-     *
-     * @param species shuffle species
-     * @return a shuffle of lane indexes
-     */
-    @ForceInline
-    public static Shuffle<$Boxtype$> shuffleIota(Species<$Boxtype$> species) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return new $Type$MaxVector.$Type$MaxShuffle(AbstractShuffle.IDENTITY);
-        switch (species.bitSize()) {
-            case 64: return new $Type$64Vector.$Type$64Shuffle(AbstractShuffle.IDENTITY);
-            case 128: return new $Type$128Vector.$Type$128Shuffle(AbstractShuffle.IDENTITY);
-            case 256: return new $Type$256Vector.$Type$256Shuffle(AbstractShuffle.IDENTITY);
-            case 512: return new $Type$512Vector.$Type$512Shuffle(AbstractShuffle.IDENTITY);
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    /**
-     * Returns a shuffle where each lane element is set to a given
-     * {@code int} value logically AND'ed by the species length minus one.
-     * <p>
-     * For each shuffle lane, where {@code N} is the shuffle lane index, the
-     * the {@code int} value at index {@code N} logically AND'ed by
-     * {@code species.length() - 1} is placed into the resulting shuffle at
-     * lane index {@code N}.
-     *
-     * @param species shuffle species
-     * @param ixs the given {@code int} values
-     * @return a shuffle where each lane element is set to a given
-     * {@code int} value
-     * @throws IndexOutOfBoundsException if the number of int values is
-     * {@code < species.length()}
-     */
-    @ForceInline
-    public static Shuffle<$Boxtype$> shuffleFromValues(Species<$Boxtype$> species, int... ixs) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return new $Type$MaxVector.$Type$MaxShuffle(ixs);
-        switch (species.bitSize()) {
-            case 64: return new $Type$64Vector.$Type$64Shuffle(ixs);
-            case 128: return new $Type$128Vector.$Type$128Shuffle(ixs);
-            case 256: return new $Type$256Vector.$Type$256Shuffle(ixs);
-            case 512: return new $Type$512Vector.$Type$512Shuffle(ixs);
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
-    /**
-     * Loads a shuffle from an {@code int} array starting at an offset.
-     * <p>
-     * For each shuffle lane, where {@code N} is the shuffle lane index, the
-     * array element at index {@code i + N} logically AND'ed by
-     * {@code species.length() - 1} is placed into the resulting shuffle at lane
-     * index {@code N}.
-     *
-     * @param species shuffle species
-     * @param ixs the {@code int} array
-     * @param i the offset into the array
-     * @return a shuffle loaded from the {@code int} array
-     * @throws IndexOutOfBoundsException if {@code i < 0}, or
-     * {@code i > a.length - species.length()}
-     */
-    @ForceInline
-    public static Shuffle<$Boxtype$> shuffleFromArray(Species<$Boxtype$> species, int[] ixs, int i) {
-        if (species.boxType() == $Type$MaxVector.class)
-            return new $Type$MaxVector.$Type$MaxShuffle(ixs, i);
-        switch (species.bitSize()) {
-            case 64: return new $Type$64Vector.$Type$64Shuffle(ixs, i);
-            case 128: return new $Type$128Vector.$Type$128Shuffle(ixs, i);
-            case 256: return new $Type$256Vector.$Type$256Shuffle(ixs, i);
-            case 512: return new $Type$512Vector.$Type$512Shuffle(ixs, i);
-            default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
-        }
-    }
-
     // Ops
 
     @Override
     public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
 

@@ -755,11 +531,11 @@
      * scalar
      */
     public abstract $abstractvectortype$ add($type$ s);
 
     @Override
-    public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Adds this vector to broadcast of an input scalar,
      * selecting lane elements controlled by a mask.
      * <p>

@@ -769,11 +545,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the result of adding this vector to the broadcast of an input
      * scalar
      */
-    public abstract $abstractvectortype$ add($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ add($type$ s, VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
 
     /**

@@ -787,11 +563,11 @@
      * scalar from this vector
      */
     public abstract $abstractvectortype$ sub($type$ s);
 
     @Override
-    public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Subtracts the broadcast of an input scalar from this vector, selecting
      * lane elements controlled by a mask.
      * <p>

@@ -801,11 +577,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the result of subtracting the broadcast of an input
      * scalar from this vector
      */
-    public abstract $abstractvectortype$ sub($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ sub($type$ s, VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
 
     /**

@@ -819,11 +595,11 @@
      * input scalar
      */
     public abstract $abstractvectortype$ mul($type$ s);
 
     @Override
-    public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Multiplies this vector with the broadcast of an input scalar, selecting
      * lane elements controlled by a mask.
      * <p>

@@ -833,29 +609,29 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the result of multiplying this vector with the broadcast of an
      * input scalar
      */
-    public abstract $abstractvectortype$ mul($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ mul($type$ s, VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ neg();
 
     @Override
-    public abstract $abstractvectortype$ neg(Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ neg(VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ abs();
 
     @Override
-    public abstract $abstractvectortype$ abs(Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ abs(VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
 
     @Override
-    public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Returns the minimum of this vector and the broadcast of an input scalar.
      * <p>
      * This is a vector binary operation where the operation

@@ -868,11 +644,11 @@
 
     @Override
     public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
 
     @Override
-    public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Returns the maximum of this vector and the broadcast of an input scalar.
      * <p>
      * This is a vector binary operation where the operation

@@ -882,11 +658,11 @@
      * @return the maximum of this vector and the broadcast of an input scalar
      */
     public abstract $abstractvectortype$ max($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> equal(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> equal(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is equal to the broadcast of an input scalar.
      * <p>
      * This is a vector binary test operation where the primitive equals

@@ -894,14 +670,14 @@
      *
      * @param s the input scalar
      * @return the result mask of testing if this vector is equal to the
      * broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> equal($type$ s);
+    public abstract VectorMask<$Boxtype$> equal($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is not equal to the broadcast of an input scalar.
      * <p>
      * This is a vector binary test operation where the primitive not equals

@@ -909,14 +685,14 @@
      *
      * @param s the input scalar
      * @return the result mask of testing if this vector is not equal to the
      * broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> notEqual($type$ s);
+    public abstract VectorMask<$Boxtype$> notEqual($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is less than the broadcast of an input scalar.
      * <p>
      * This is a vector binary test operation where the primitive less than

@@ -924,14 +700,14 @@
      *
      * @param s the input scalar
      * @return the mask result of testing if this vector is less than the
      * broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> lessThan($type$ s);
+    public abstract VectorMask<$Boxtype$> lessThan($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is less or equal to the broadcast of an input scalar.
      * <p>
      * This is a vector binary test operation where the primitive less than

@@ -939,14 +715,14 @@
      *
      * @param s the input scalar
      * @return the mask result of testing if this vector is less than or equal
      * to the broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> lessThanEq($type$ s);
+    public abstract VectorMask<$Boxtype$> lessThanEq($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is greater than the broadcast of an input scalar.
      * <p>
      * This is a vector binary test operation where the primitive greater than

@@ -954,14 +730,14 @@
      *
      * @param s the input scalar
      * @return the mask result of testing if this vector is greater than the
      * broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> greaterThan($type$ s);
+    public abstract VectorMask<$Boxtype$> greaterThan($type$ s);
 
     @Override
-    public abstract Mask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
+    public abstract VectorMask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
 
     /**
      * Tests if this vector is greater than or equal to the broadcast of an
      * input scalar.
      * <p>

@@ -970,14 +746,14 @@
      *
      * @param s the input scalar
      * @return the mask result of testing if this vector is greater than or
      * equal to the broadcast of an input scalar
      */
-    public abstract Mask<$Boxtype$> greaterThanEq($type$ s);
+    public abstract VectorMask<$Boxtype$> greaterThanEq($type$ s);
 
     @Override
-    public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Blends the lane elements of this vector with those of the broadcast of an
      * input scalar, selecting lanes controlled by a mask.
      * <p>

@@ -990,21 +766,21 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the result of blending the lane elements of this vector with
      * those of the broadcast of an input scalar
      */
-    public abstract $abstractvectortype$ blend($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ blend($type$ s, VectorMask<$Boxtype$> m);
 
     @Override
     public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
-                                                      Shuffle<$Boxtype$> s, Mask<$Boxtype$> m);
+                                                      VectorShuffle<$Boxtype$> s, VectorMask<$Boxtype$> m);
 
     @Override
-    public abstract $abstractvectortype$ rearrange(Shuffle<$Boxtype$> m);
+    public abstract $abstractvectortype$ rearrange(VectorShuffle<$Boxtype$> m);
 
     @Override
-    public abstract $abstractvectortype$ reshape(Species<$Boxtype$> s);
+    public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
 
     @Override
     public abstract $abstractvectortype$ rotateEL(int i);
 
     @Override

@@ -1049,11 +825,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the result of dividing this vector by the input vector
      */
-    public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Divides this vector by the broadcast of an input scalar, selecting lane
      * elements controlled by a mask.
      * <p>

@@ -1063,11 +839,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the result of dividing this vector by the broadcast of an input
      * scalar
      */
-    public abstract $abstractvectortype$ div($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ div($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Calculates the square root of this vector.
      * <p>
      * This is a vector unary operation where the {@link Math#sqrt} operation

@@ -1085,11 +861,11 @@
      * is applied to lane elements.
      *
      * @param m the mask controlling lane selection
      * @return the square root of this vector
      */
-    public $abstractvectortype$ sqrt(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ sqrt(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
     }
 
     /**
      * Calculates the trigonometric tangent of this vector.

@@ -1116,11 +892,11 @@
      * described in {@link $abstractvectortype$#tan}
      *
      * @param m the mask controlling lane selection
      * @return the tangent of this vector
      */
-    public $abstractvectortype$ tan(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ tan(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
     }
 
     /**
      * Calculates the hyperbolic tangent of this vector.

@@ -1147,11 +923,11 @@
      * described in {@link $abstractvectortype$#tanh}
      *
      * @param m the mask controlling lane selection
      * @return the hyperbolic tangent of this vector
      */
-    public $abstractvectortype$ tanh(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ tanh(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
     }
 
     /**
      * Calculates the trigonometric sine of this vector.

@@ -1178,11 +954,11 @@
      * described in {@link $abstractvectortype$#sin}
      *
      * @param m the mask controlling lane selection
      * @return the sine of this vector
      */
-    public $abstractvectortype$ sin(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ sin(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
     }
 
     /**
      * Calculates the hyperbolic sine of this vector.

@@ -1209,11 +985,11 @@
      * described in {@link $abstractvectortype$#sinh}
      *
      * @param m the mask controlling lane selection
      * @return the hyperbolic sine of this vector
      */
-    public $abstractvectortype$ sinh(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ sinh(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
     }
 
     /**
      * Calculates the trigonometric cosine of this vector.

@@ -1240,11 +1016,11 @@
      * described in {@link $abstractvectortype$#cos}
      *
      * @param m the mask controlling lane selection
      * @return the cosine of this vector
      */
-    public $abstractvectortype$ cos(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ cos(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
     }
 
     /**
      * Calculates the hyperbolic cosine of this vector.

@@ -1271,11 +1047,11 @@
      * described in {@link $abstractvectortype$#cosh}
      *
      * @param m the mask controlling lane selection
      * @return the hyperbolic cosine of this vector
      */
-    public $abstractvectortype$ cosh(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ cosh(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
     }
 
     /**
      * Calculates the arc sine of this vector.

@@ -1302,11 +1078,11 @@
      * described in {@link $abstractvectortype$#asin}
      *
      * @param m the mask controlling lane selection
      * @return the arc sine of this vector
      */
-    public $abstractvectortype$ asin(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ asin(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
     }
 
     /**
      * Calculates the arc cosine of this vector.

@@ -1333,11 +1109,11 @@
      * described in {@link $abstractvectortype$#acos}
      *
      * @param m the mask controlling lane selection
      * @return the arc cosine of this vector
      */
-    public $abstractvectortype$ acos(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ acos(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
     }
 
     /**
      * Calculates the arc tangent of this vector.

@@ -1364,11 +1140,11 @@
      * described in {@link $abstractvectortype$#atan}
      *
      * @param m the mask controlling lane selection
      * @return the arc tangent of this vector
      */
-    public $abstractvectortype$ atan(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ atan(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.atan((double) a));
     }
 
     /**
      * Calculates the arc tangent of this vector divided by an input vector.

@@ -1414,11 +1190,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the arc tangent of this vector divided by the input vector
      */
-    public $abstractvectortype$ atan2(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ atan2(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
     }
 
     /**
      * Calculates the arc tangent of this vector divided by the broadcast of an

@@ -1429,11 +1205,11 @@
      *
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the arc tangent of this vector over the input vector
      */
-    public abstract $abstractvectortype$ atan2($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ atan2($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Calculates the cube root of this vector.
      * <p>
      * This is a vector unary operation with same semantic definition as

@@ -1458,11 +1234,11 @@
      * described in {@link $abstractvectortype$#cbrt}
      *
      * @param m the mask controlling lane selection
      * @return the cube root of this vector
      */
-    public $abstractvectortype$ cbrt(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ cbrt(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
     }
 
     /**
      * Calculates the natural logarithm of this vector.

@@ -1489,11 +1265,11 @@
      * described in {@link $abstractvectortype$#log}
      *
      * @param m the mask controlling lane selection
      * @return the natural logarithm of this vector
      */
-    public $abstractvectortype$ log(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ log(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.log((double) a));
     }
 
     /**
      * Calculates the base 10 logarithm of this vector.

@@ -1520,11 +1296,11 @@
      * described in {@link $abstractvectortype$#log10}
      *
      * @param m the mask controlling lane selection
      * @return the base 10 logarithm of this vector
      */
-    public $abstractvectortype$ log10(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ log10(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.log10((double) a));
     }
 
     /**
      * Calculates the natural logarithm of the sum of this vector and the

@@ -1554,11 +1330,11 @@
      *
      * @param m the mask controlling lane selection
      * @return the natural logarithm of the sum of this vector and the broadcast
      * of {@code 1}
      */
-    public $abstractvectortype$ log1p(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ log1p(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.log1p((double) a));
     }
 
     /**
      * Calculates this vector raised to the power of an input vector.

@@ -1605,11 +1381,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return this vector raised to the power of an input vector
      */
-    public $abstractvectortype$ pow(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ pow(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) Math.pow((double) a, (double) b));
     }
 
     /**
      * Calculates this vector raised to the power of the broadcast of an input

@@ -1621,11 +1397,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return this vector raised to the power of the broadcast of an input
      * scalar.
      */
-    public abstract $abstractvectortype$ pow($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ pow($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Calculates the broadcast of Euler's number {@code e} raised to the power
      * of this vector.
      * <p>

@@ -1653,11 +1429,11 @@
      *
      * @param m the mask controlling lane selection
      * @return the broadcast of Euler's number {@code e} raised to the power of
      * this vector
      */
-    public $abstractvectortype$ exp(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ exp(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.exp((double) a));
     }
 
     /**
      * Calculates the broadcast of Euler's number {@code e} raised to the power

@@ -1698,11 +1474,11 @@
      *
      * @param m the mask controlling lane selection
      * @return the broadcast of Euler's number {@code e} raised to the power of
      * this vector minus the broadcast of {@code -1}
      */
-    public $abstractvectortype$ expm1(Mask<$Boxtype$> m) {
+    public $abstractvectortype$ expm1(VectorMask<$Boxtype$> m) {
         return uOp(m, (i, a) -> ($type$) Math.expm1((double) a));
     }
 
     /**
      * Calculates the product of this vector and a first input vector summed

@@ -1757,11 +1533,11 @@
      * @param v2 the second input vector
      * @param m the mask controlling lane selection
      * @return the product of this vector and the first input vector summed with
      * the second input vector
      */
-    public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
         return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
     }
 
     /**
      * Calculates the product of this vector and the broadcast of a first input

@@ -1779,11 +1555,11 @@
      * @param s2 the second input scalar
      * @param m the mask controlling lane selection
      * @return the product of this vector and the broadcast of a first input
      * scalar summed with the broadcast of a second input scalar
      */
-    public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, VectorMask<$Boxtype$> m);
 
     /**
      * Calculates square root of the sum of the squares of this vector and an
      * input vector.
      * More specifically as if the following (ignoring any differences in

@@ -1846,11 +1622,11 @@
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return square root of the sum of the squares of this vector and an input
      * vector
      */
-    public $abstractvectortype$ hypot(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ hypot(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
     }
 
     /**
      * Calculates square root of the sum of the squares of this vector and the

@@ -1868,11 +1644,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return square root of the sum of the squares of this vector and the
      * broadcast of an input scalar
      */
-    public abstract $abstractvectortype$ hypot($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ hypot($type$ s, VectorMask<$Boxtype$> m);
 #end[FP]
 
 #if[BITWISE]
 
     /**

@@ -1907,11 +1683,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the bitwise AND of this vector with the input vector
      */
-    public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise ANDs this vector with the broadcast of an input scalar, selecting
      * lane elements controlled by a mask.
      * <p>

@@ -1921,11 +1697,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the bitwise AND of this vector with the broadcast of an input
      * scalar
      */
-    public abstract $abstractvectortype$ and($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ and($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise ORs this vector with an input vector.
      * <p>
      * This is a vector binary operation where the primitive bitwise OR

@@ -1957,11 +1733,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the bitwise OR of this vector with the input vector
      */
-    public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise ORs this vector with the broadcast of an input scalar, selecting
      * lane elements controlled by a mask.
      * <p>

@@ -1971,11 +1747,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the bitwise OR of this vector with the broadcast of an input
      * scalar
      */
-    public abstract $abstractvectortype$ or($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ or($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise XORs this vector with an input vector.
      * <p>
      * This is a vector binary operation where the primitive bitwise XOR

@@ -2007,11 +1783,11 @@
      *
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the bitwise XOR of this vector with the input vector
      */
-    public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise XORs this vector with the broadcast of an input scalar, selecting
      * lane elements controlled by a mask.
      * <p>

@@ -2021,11 +1797,11 @@
      * @param s the input scalar
      * @param m the mask controlling lane selection
      * @return the bitwise XOR of this vector with the broadcast of an input
      * scalar
      */
-    public abstract $abstractvectortype$ xor($type$ s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ xor($type$ s, VectorMask<$Boxtype$> m);
 
     /**
      * Bitwise NOTs this vector.
      * <p>
      * This is a vector unary operation where the primitive bitwise NOT

@@ -2042,11 +1818,11 @@
      * operation ({@code ~}) is applied to lane elements.
      *
      * @param m the mask controlling lane selection
      * @return the bitwise NOT of this vector
      */
-    public abstract $abstractvectortype$ not(Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
 
 #if[byte]
     /**
      * Logically left shifts this vector by the broadcast of an input scalar.
      * <p>

@@ -2140,11 +1916,11 @@
      * @param m the mask controlling lane selection
      * @return the result of logically left shifting this vector by the
      * broadcast of an input scalar
      */
 #end[intOrLong]
-    public abstract $abstractvectortype$ shiftL(int s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ shiftL(int s, VectorMask<$Boxtype$> m);
 
 #if[intOrLong]
     /**
      * Logically left shifts this vector by an input vector.
      * <p>

@@ -2167,11 +1943,11 @@
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the result of logically left shifting this vector by the input
      * vector
      */
-    public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) (a << b));
     }
 #end[intOrLong]
 
     // logical, or unsigned, shift right

@@ -2276,11 +2052,11 @@
      * @param m the mask controlling lane selection
      * @return the result of logically right shifting this vector by the
      * broadcast of an input scalar
      */
 #end[intOrLong]
-    public abstract $abstractvectortype$ shiftR(int s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ shiftR(int s, VectorMask<$Boxtype$> m);
 
 #if[intOrLong]
     /**
      * Logically right shifts (or unsigned right shifts) this vector by an
      * input vector.

@@ -2304,11 +2080,11 @@
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the result of logically right shifting this vector by the
      * input vector
      */
-    public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
     }
 #end[intOrLong]
 
 #if[byte]

@@ -2411,11 +2187,11 @@
      * @param m the mask controlling lane selection
      * @return the result of arithmetically right shifting this vector by the
      * broadcast of an input scalar
      */
 #end[intOrLong]
-    public abstract $abstractvectortype$ aShiftR(int s, Mask<$Boxtype$> m);
+    public abstract $abstractvectortype$ aShiftR(int s, VectorMask<$Boxtype$> m);
 
 #if[intOrLong]
     /**
      * Arithmetically right shifts (or signed right shifts) this vector by an
      * input vector.

@@ -2439,11 +2215,11 @@
      * @param v the input vector
      * @param m the mask controlling lane selection
      * @return the result of arithmetically right shifting this vector by the
      * input vector
      */
-    public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
+    public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
         return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
     }
 
     /**
      * Rotates left this vector by the broadcast of an input scalar.

@@ -2477,11 +2253,11 @@
      * @param m the mask controlling lane selection
      * @return the result of rotating left this vector by the broadcast of an
      * input scalar
      */
     @ForceInline
-    public final $abstractvectortype$ rotateL(int s, Mask<$Boxtype$> m) {
+    public final $abstractvectortype$ rotateL(int s, VectorMask<$Boxtype$> m) {
         return shiftL(s, m).or(shiftR(-s, m), m);
     }
 
     /**
      * Rotates right this vector by the broadcast of an input scalar.

@@ -2515,27 +2291,27 @@
      * @param m the mask controlling lane selection
      * @return the result of rotating right this vector by the broadcast of an
      * input scalar
      */
     @ForceInline
-    public final $abstractvectortype$ rotateR(int s, Mask<$Boxtype$> m) {
+    public final $abstractvectortype$ rotateR(int s, VectorMask<$Boxtype$> m) {
         return shiftR(s, m).or(shiftL(-s, m), m);
     }
 #end[intOrLong]
 #end[BITWISE]
 
     @Override
     public abstract void intoByteArray(byte[] a, int ix);
 
     @Override
-    public abstract void intoByteArray(byte[] a, int ix, Mask<$Boxtype$> m);
+    public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
 
     @Override
     public abstract void intoByteBuffer(ByteBuffer bb, int ix);
 
     @Override
-    public abstract void intoByteBuffer(ByteBuffer bb, int ix, Mask<$Boxtype$> m);
+    public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<$Boxtype$> m);
 
 
     // Type specific horizontal reductions
     /**
      * Adds all lane elements of this vector.

@@ -2587,11 +2363,11 @@
 #end[FP]
      *
      * @param m the mask controlling lane selection
      * @return the addition of the selected lane elements of this vector
      */
-    public abstract $type$ addAll(Mask<$Boxtype$> m);
+    public abstract $type$ addAll(VectorMask<$Boxtype$> m);
 
     /**
      * Multiplies all lane elements of this vector.
      * <p>
 #if[FP]

@@ -2639,11 +2415,11 @@
 #end[FP]
      *
      * @param m the mask controlling lane selection
      * @return the multiplication of all the lane elements of this vector
      */
-    public abstract $type$ mulAll(Mask<$Boxtype$> m);
+    public abstract $type$ mulAll(VectorMask<$Boxtype$> m);
 
     /**
      * Returns the minimum lane element of this vector.
      * <p>
      * This is an associative vector reduction operation where the operation

@@ -2673,11 +2449,11 @@
 #end[FP]
      *
      * @param m the mask controlling lane selection
      * @return the minimum lane element of this vector
      */
-    public abstract $type$ minAll(Mask<$Boxtype$> m);
+    public abstract $type$ minAll(VectorMask<$Boxtype$> m);
 
     /**
      * Returns the maximum lane element of this vector.
      * <p>
      * This is an associative vector reduction operation where the operation

@@ -2707,11 +2483,11 @@
 #end[FP]
      *
      * @param m the mask controlling lane selection
      * @return the maximum lane element of this vector
      */
-    public abstract $type$ maxAll(Mask<$Boxtype$> m);
+    public abstract $type$ maxAll(VectorMask<$Boxtype$> m);
 
 #if[BITWISE]
     /**
      * Logically ORs all lane elements of this vector.
      * <p>

@@ -2732,11 +2508,11 @@
      * and the identity value is {@code 0}.
      *
      * @param m the mask controlling lane selection
      * @return the logical OR all the lane elements of this vector
      */
-    public abstract $type$ orAll(Mask<$Boxtype$> m);
+    public abstract $type$ orAll(VectorMask<$Boxtype$> m);
 
     /**
      * Logically ANDs all lane elements of this vector.
      * <p>
      * This is an associative vector reduction operation where the logical AND

@@ -2756,11 +2532,11 @@
      * and the identity value is {@code -1}.
      *
      * @param m the mask controlling lane selection
      * @return the logical AND all the lane elements of this vector
      */
-    public abstract $type$ andAll(Mask<$Boxtype$> m);
+    public abstract $type$ andAll(VectorMask<$Boxtype$> m);
 
     /**
      * Logically XORs all lane elements of this vector.
      * <p>
      * This is an associative vector reduction operation where the logical XOR

@@ -2780,11 +2556,11 @@
      * and the identity value is {@code 0}.
      *
      * @param m the mask controlling lane selection
      * @return the logical XOR all the lane elements of this vector
      */
-    public abstract $type$ xorAll(Mask<$Boxtype$> m);
+    public abstract $type$ xorAll(VectorMask<$Boxtype$> m);
 #end[BITWISE]
 
     // Type specific accessors
 
     /**

@@ -2863,11 +2639,11 @@
      * @param m the mask
      * @throws IndexOutOfBoundsException if {@code i < 0}, or
      * for any vector lane index {@code N} where the mask at lane {@code N}
      * is set {@code i >= a.length - N}
      */
-    public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m);
+    public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m);
 
     /**
      * Stores this vector into an array using indexes obtained from an index
      * map.
      * <p>

@@ -2915,72 +2691,61 @@
      * or for any vector lane index {@code N} where the mask at lane
      * {@code N} is set the result of {@code i + indexMap[j + N]} is
      * {@code < 0} or {@code >= a.length}
      */
 #if[byteOrShort]
-    public void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
+    public void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
         forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
     }
 #else[byteOrShort]
-    public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j);
+    public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j);
 #end[byteOrShort]
     // Species
 
     @Override
-    public abstract Species<$Boxtype$> species();
+    public abstract VectorSpecies<$Boxtype$> species();
 
     /**
-     * Class representing {@link $abstractvectortype$}'s of the same {@link Vector.Shape Shape}.
+     * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
      */
-    static final class $Type$Species extends Vector.AbstractSpecies<$Boxtype$> {
+    static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
         final Function<$type$[], $Type$Vector> vectorFactory;
-        final Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory;
 
-        private $Type$Species(Vector.Shape shape,
+        private $Type$Species(VectorShape shape,
                           Class<?> boxType,
                           Class<?> maskType,
                           Function<$type$[], $Type$Vector> vectorFactory,
-                          Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory) {
-            super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType);
+                          Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
+                          Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
+                          fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
+            super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType, maskFactory,
+                  shuffleFromArrayFactory, shuffleFromOpFactory);
             this.vectorFactory = vectorFactory;
-            this.maskFactory = maskFactory;
         }
 
         interface FOp {
             $type$ apply(int i);
         }
 
-        interface FOpm {
-            boolean apply(int i);
-        }
-
         $Type$Vector op(FOp f) {
             $type$[] res = new $type$[length()];
             for (int i = 0; i < length(); i++) {
                 res[i] = f.apply(i);
             }
             return vectorFactory.apply(res);
         }
 
-        $Type$Vector op(Vector.Mask<$Boxtype$> o, FOp f) {
+        $Type$Vector op(VectorMask<$Boxtype$> o, FOp f) {
             $type$[] res = new $type$[length()];
             boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits();
             for (int i = 0; i < length(); i++) {
                 if (mbits[i]) {
                     res[i] = f.apply(i);
                 }
             }
             return vectorFactory.apply(res);
         }
-
-        Vector.Mask<$Boxtype$> opm(IntVector.IntSpecies.FOpm f) {
-            boolean[] res = new boolean[length()];
-            for (int i = 0; i < length(); i++) {
-                res[i] = (boolean)f.apply(i);
-            }
-            return maskFactory.apply(res);
-        }
     }
 
     /**
      * Finds the preferred species for an element type of {@code $type$}.
      * <p>

@@ -2990,21 +2755,21 @@
      * shuffles created from such species will be shape compatible.
      *
      * @return the preferred species for an element type of {@code $type$}
      */
     private static $Type$Species preferredSpecies() {
-        return ($Type$Species) Species.ofPreferred($type$.class);
+        return ($Type$Species) VectorSpecies.ofPreferred($type$.class);
     }
 
     /**
      * Finds a species for an element type of {@code $type$} and shape.
      *
      * @param s the shape
      * @return a species for an element type of {@code $type$} and shape
      * @throws IllegalArgumentException if no such species exists for the shape
      */
-    static $Type$Species species(Vector.Shape s) {
+    static $Type$Species species(VectorShape s) {
         Objects.requireNonNull(s);
         switch (s) {
             case S_64_BIT: return ($Type$Species) SPECIES_64;
             case S_128_BIT: return ($Type$Species) SPECIES_128;
             case S_256_BIT: return ($Type$Species) SPECIES_256;

@@ -3012,31 +2777,36 @@
             case S_Max_BIT: return ($Type$Species) SPECIES_MAX;
             default: throw new IllegalArgumentException("Bad shape: " + s);
         }
     }
 
-    /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_64_BIT Shape.S_64_BIT}. */
-    public static final Species<$Boxtype$> SPECIES_64 = new $Type$Species(Shape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class,
-                                                                     $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new);
-
-    /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_128_BIT Shape.S_128_BIT}. */
-    public static final Species<$Boxtype$> SPECIES_128 = new $Type$Species(Shape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class,
-                                                                      $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new);
-
-    /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_256_BIT Shape.S_256_BIT}. */
-    public static final Species<$Boxtype$> SPECIES_256 = new $Type$Species(Shape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class,
-                                                                      $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new);
-
-    /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_512_BIT Shape.S_512_BIT}. */
-    public static final Species<$Boxtype$> SPECIES_512 = new $Type$Species(Shape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class,
-                                                                      $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new);
-
-    /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_Max_BIT Shape.S_Max_BIT}. */
-    public static final Species<$Boxtype$> SPECIES_MAX = new $Type$Species(Shape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class,
-                                                                      $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new);
+    /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_64_BIT VectorShape.S_64_BIT}. */
+    public static final VectorSpecies<$Boxtype$> SPECIES_64 = new $Type$Species(VectorShape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class,
+                                                                     $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new,
+                                                                     $Type$64Vector.$Type$64Shuffle::new, $Type$64Vector.$Type$64Shuffle::new);
+
+    /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */
+    public static final VectorSpecies<$Boxtype$> SPECIES_128 = new $Type$Species(VectorShape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class,
+                                                                      $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new,
+                                                                      $Type$128Vector.$Type$128Shuffle::new, $Type$128Vector.$Type$128Shuffle::new);
+
+    /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */
+    public static final VectorSpecies<$Boxtype$> SPECIES_256 = new $Type$Species(VectorShape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class,
+                                                                      $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new,
+                                                                      $Type$256Vector.$Type$256Shuffle::new, $Type$256Vector.$Type$256Shuffle::new);
+
+    /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */
+    public static final VectorSpecies<$Boxtype$> SPECIES_512 = new $Type$Species(VectorShape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class,
+                                                                      $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new,
+                                                                      $Type$512Vector.$Type$512Shuffle::new, $Type$512Vector.$Type$512Shuffle::new);
+
+    /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */
+    public static final VectorSpecies<$Boxtype$> SPECIES_MAX = new $Type$Species(VectorShape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class,
+                                                                      $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new,
+                                                                      $Type$MaxVector.$Type$MaxShuffle::new, $Type$MaxVector.$Type$MaxShuffle::new);
 
     /**
      * Preferred species for {@link $Type$Vector}s.
      * A preferred species is a species of maximal bit size for the platform.
      */
-    public static final Species<$Boxtype$> SPECIES_PREFERRED = (Species<$Boxtype$>) preferredSpecies();
+    public static final VectorSpecies<$Boxtype$> SPECIES_PREFERRED = (VectorSpecies<$Boxtype$>) preferredSpecies();
 }
< prev index next >