< prev index next >

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

Print this page

        

@@ -558,11 +558,11 @@
      *
      * @param i the number of lanes to rotate left
      * @return the result of rotating left lane elements of this vector by the
      * given number of lanes
      */
-    public abstract Vector<E> rotateEL(int i);
+    public abstract Vector<E> rotateLanesLeft(int i);
 
     /**
      * Rotates right the lane elements of this vector by the given number of
      * lanes, {@code i}, modulus the vector length.
      * <p>

@@ -574,11 +574,11 @@
      *
      * @param i the number of lanes to rotate left
      * @return the result of rotating right lane elements of this vector by the
      * given number of lanes
      */
-    public abstract Vector<E> rotateER(int i);
+    public abstract Vector<E> rotateLanesRight(int i);
 
     /**
      * Shift left the lane elements of this vector by the given number of
      * lanes, {@code i}, modulus the vector length.
      * <p>

@@ -590,11 +590,11 @@
      * @param i the number of lanes to shift left
      * @return the result of shifting left lane elements of this vector by the
      * given number of lanes
      * @throws IllegalArgumentException if {@code i} is {@code < 0}.
      */
-    public abstract Vector<E> shiftEL(int i);
+    public abstract Vector<E> shiftLanesLeft(int i);
 
     /**
      * Shift right the lane elements of this vector by the given number of
      * lanes, {@code i}, modulus the vector length.
      * <p>

@@ -606,11 +606,11 @@
      * @param i the number of lanes to shift right
      * @return the result of shifting right lane elements of this vector by the
      * given number of lanes
      * @throws IllegalArgumentException if {@code i} is {@code < 0}.
      */
-    public abstract Vector<E> shiftER(int i);
+    public abstract Vector<E> shiftLanesRight(int i);
 
     /**
      * Blends the lane elements of this vector with those of an input vector,
      * selecting lanes controlled by a mask.
      * <p>

@@ -934,6 +934,178 @@
         }
         else {
             throw new IllegalArgumentException("Bad vector type: " + c.getName());
         }
     }
+
+    /**
+     * Returns a mask of same species as {@code this} vector and where each lane is set or unset according to given
+     * {@code boolean} values.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorMask#fromValues(VectorSpecies, boolean...) fromValues()}
+     * method in VectorMask as follows:
+     * <pre> {@code
+     *     return VectorMask.fromValues(this.species(), bits);
+     * } </pre>
+     *
+     * @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 < this.species().length()}
+     */
+    @ForceInline
+    public final VectorMask<E> maskFromValues(boolean... bits) {
+        return VectorMask.fromValues(this.species(), bits);
+    }
+
+    /**
+     * Loads a mask of same species as {@code this} vector from a {@code boolean} array starting at an offset.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorMask#fromArray(VectorSpecies, boolean[], int) fromArray()}
+     * method in VectorMask as follows:
+     * <pre> {@code
+     *     return VectorMask.fromArray(this.species(), bits, offset);
+     * } </pre>
+     *
+     * @param bits the {@code boolean} array
+     * @param offset the offset into the array
+     * @return the mask loaded from a {@code boolean} array
+     * @throws IndexOutOfBoundsException if {@code offset < 0}, or
+     * {@code offset > bits.length - species.length()}
+     */
+    @ForceInline
+    public final VectorMask<E> maskFromArray(boolean[] bits, int offset) {
+        return VectorMask.fromArray(this.species(), bits, offset);
+    }
+
+    /**
+     * Returns a mask of same species as {@code this} vector and where all lanes are set.
+     *
+     * @return a mask where all lanes are set
+     */
+    @ForceInline
+    public final VectorMask<E> maskAllTrue() {
+        return VectorMask.maskAllTrue(this.species());
+    }
+
+    /**
+     * Returns a mask of same species as {@code this} vector and where all lanes are unset.
+     *
+     * @return a mask where all lanes are unset
+     */
+    @ForceInline
+    public final VectorMask<E> maskAllFalse() {
+        return VectorMask.maskAllFalse(this.species());
+    }
+
+    /**
+     * Returns a shuffle of same species as {@code this} vector and where each lane element is set to a given
+     * {@code int} value logically AND'ed by the species length minus one.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#fromValues(VectorSpecies, int...) fromValues()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return VectorShuffle.fromValues(this.species(), ixs);
+     * } </pre>
+     *
+     * @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 < this.species().length()}
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffleFromValues(int... ixs) {
+        return VectorShuffle.fromValues(this.species(), ixs);
+    }
+
+    /**
+     * Loads a shuffle of same species as {@code this} vector from an {@code int} array starting at an offset.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#fromArray(VectorSpecies, int[], int) fromArray()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return VectorShuffle.fromArray(this.species(), ixs, offset);
+     * } </pre>
+     *
+     * @param ixs the {@code int} array
+     * @param offset the offset into the array
+     * @return a shuffle loaded from the {@code int} array
+     * @throws IndexOutOfBoundsException if {@code offset < 0}, or
+     * {@code offset > ixs.length - this.species().length()}
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffleFromArray(int[] ixs, int offset) {
+        return VectorShuffle.fromArray(this.species(), ixs, offset);
+    }
+
+    /**
+     * Returns a shuffle of same species as {@code this} vector of mapped indexes where each lane element is
+     * the result of applying a mapping function to the corresponding lane
+     * index.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#shuffle(VectorSpecies, IntUnaryOperator) shuffle()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return AbstractShuffle.shuffle(this.species(), f);
+     * } </pre>
+     *
+     * @param f the lane index mapping function
+     * @return a shuffle of mapped indexes
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffle(IntUnaryOperator f) {
+        return AbstractShuffle.shuffle(this.species(), f);
+    }
+
+    /**
+     * Returns a shuffle of same species has {@code this} vector and where each lane element is the value of its
+     * corresponding lane index.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#shuffleIota(VectorSpecies) shuffleIota()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return VectorShuffle.shuffleIota(this.species());
+     * } </pre>
+     *
+     * @return a shuffle of lane indexes
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffleIota() {
+        return VectorShuffle.shuffleIota(this.species());
+    }
+
+    /**
+     * Returns a shuffle of same species has {@code this} vector and with lane elements set to sequential {@code int}
+     * values starting from {@code start}.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#shuffleIota(VectorSpecies, int) shuffleIota()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return VectorShuffle.shuffleIota(this.species(), start);
+     * } </pre>
+     *
+     * @param start starting value of sequence
+     * @return a shuffle of lane indexes
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffleIota(int start) {
+        return VectorShuffle.shuffleIota(this.species(), start);
+    }
+
+    /**
+     * Returns a shuffle of same species has {@code this} vector and with lane elements set to sequential {@code int}
+     * values starting from {@code start} and looping around species length.
+     * <p>
+     * This method behaves as if it returns the result of calling the static {@link VectorShuffle#shuffleOffset(VectorSpecies, int) shuffleOffset()}
+     * method in VectorShuffle as follows:
+     * <pre> {@code
+     *     return VectorShuffle.shuffleOffset(this.species(), start);
+     * } </pre>
+     *
+     * @param start starting value of sequence
+     * @return a shuffle of lane indexes
+     */
+    @ForceInline
+    public final VectorShuffle<E> shuffleOffset(int start) {
+        return VectorShuffle.shuffleOffset(this.species(), start);
+    }
 }
< prev index next >