--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java 2019-04-19 11:39:01.140243000 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java 2019-04-19 11:39:00.212634800 -0700 @@ -125,26 +125,26 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: *

{@code
-     * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
+     * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
      * }
* * @param species species of desired vector * @param a the byte array - * @param ix the offset into the array + * @param offset the offset into the array * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or - * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} + * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector fromByteArray(VectorSpecies species, byte[] a, int ix) { + public static IntVector fromByteArray(VectorSpecies species, byte[] a, int offset) { Objects.requireNonNull(a); - ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE); + offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), - a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET, - a, ix, species, + a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET, + a, offset, species, (c, idx, s) -> { ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder()); IntBuffer tb = bbc.asIntBuffer(); @@ -161,51 +161,48 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: *

{@code
-     * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
+     * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
      * }
* * @param species species of desired vector * @param a the byte array - * @param ix the offset into the array + * @param offset the offset into the array * @param m the mask * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException if {@code i < 0} or - * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} - * @throws IndexOutOfBoundsException if the offset is {@code < 0}, - * or {@code > a.length}, + * @throws IndexOutOfBoundsException if {@code offset < 0} or * 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)} + * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline - public static IntVector fromByteArray(VectorSpecies species, byte[] a, int ix, VectorMask m) { - return zero(species).blend(fromByteArray(species, a, ix), m); + public static IntVector fromByteArray(VectorSpecies species, byte[] a, int offset, VectorMask m) { + return zero(species).blend(fromByteArray(species, a, offset), m); } /** * Loads a vector from an array starting at offset. *

* For each vector lane, where {@code N} is the vector lane index, the - * array element at index {@code i + N} is placed into the + * array element at index {@code offset + N} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code i < 0}, or - * {@code i > a.length - this.length()} + * @throws IndexOutOfBoundsException if {@code offset < 0}, or + * {@code offset > a.length - species.length()} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector fromArray(VectorSpecies species, int[] a, int i){ + public static IntVector fromArray(VectorSpecies species, int[] a, int offset){ Objects.requireNonNull(a); - i = VectorIntrinsics.checkIndex(i, a.length, species.length()); + offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), - a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET, - a, i, species, + a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET, + a, offset, species, (c, idx, s) -> ((IntSpecies)s).op(n -> c[idx + n])); } @@ -215,22 +212,22 @@ *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the array element at - * index {@code i + N} is placed into the resulting vector at lane index + * index {@code offset + N} is placed into the resulting vector at lane index * {@code N}, otherwise the default element value is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @param m the mask * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code i < 0}, or + * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} - * is set {@code i > a.length - N} + * is set {@code offset > a.length - N} */ @ForceInline - public static IntVector fromArray(VectorSpecies species, int[] a, int i, VectorMask m) { - return zero(species).blend(fromArray(species, a, i), m); + public static IntVector fromArray(VectorSpecies species, int[] a, int offset, VectorMask m) { + return zero(species).blend(fromArray(species, a, offset), m); } /** @@ -238,37 +235,37 @@ * map. *

* For each vector lane, where {@code N} is the vector lane index, the - * array element at index {@code i + indexMap[j + N]} is placed into the + * array element at index {@code a_offset + indexMap[i_offset + N]} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > indexMap.length - species.length()}, * or for any vector lane index {@code N} the result of - * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} + * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector fromArray(VectorSpecies species, int[] a, int i, int[] indexMap, int j) { + public static IntVector fromArray(VectorSpecies species, int[] a, int a_offset, int[] indexMap, int i_offset) { Objects.requireNonNull(a); Objects.requireNonNull(indexMap); - // Index vector: vix[0:n] = k -> i + indexMap[j + k] - IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, j).add(i); + // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k] + IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset); vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorIntrinsics.loadWithMap((Class) species.boxType(), int.class, species.length(), IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_INT_BASE_OFFSET, vix, - a, i, indexMap, j, species, + a, a_offset, indexMap, i_offset, species, (int[] c, int idx, int[] iMap, int idy, VectorSpecies s) -> ((IntSpecies)s).op(n -> c[idx + iMap[idy+n]])); } @@ -279,29 +276,29 @@ *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the array element at - * index {@code i + indexMap[j + N]} is placed into the resulting vector + * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector * at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param m the mask * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > indexMap.length - species.length()}, * 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 N} is set the result of {@code a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector fromArray(VectorSpecies species, int[] a, int i, VectorMask m, int[] indexMap, int j) { + public static IntVector fromArray(VectorSpecies species, int[] a, int a_offset, VectorMask m, int[] indexMap, int i_offset) { // @@@ This can result in out of bounds errors for unset mask lanes - return zero(species).blend(fromArray(species, a, i, indexMap, j), m); + return zero(species).blend(fromArray(species, a, a_offset, indexMap, i_offset), m); } @@ -314,31 +311,31 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows: *

{@code
-     *   return this.fromByteBuffer(b, i, this.maskAllTrue())
+     *   return fromByteBuffer(b, offset, VectorMask.allTrue())
      * }
* * @param species species of desired vector * @param bb the byte buffer - * @param ix the offset into the byte buffer + * @param offset the offset into the byte buffer * @return a vector loaded from a byte buffer * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > b.limit()}, * or if there are fewer than - * {@code this.length() * this.elementSize() / Byte.SIZE} bytes + * {@code species.length() * species.elementSize() / Byte.SIZE} bytes * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int ix) { + public static IntVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } - ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE); + offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), - U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix, - bb, ix, species, + U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset, + bb, offset, species, (c, idx, s) -> { ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder()); IntBuffer tb = bbc.asIntBuffer(); @@ -356,77 +353,77 @@ * the returned vector is loaded with a mask from a primitive array * obtained from the primitive buffer. * The following pseudocode expresses the behaviour, where - * {@coce EBuffer} is the primitive buffer type, {@code e} is the - * primitive element type, and {@code ESpecies} is the primitive + * {@code EBuffer} is the primitive buffer type, {@code e} is the + * primitive element type, and {@code ESpecies} is the primitive * species for {@code e}: *
{@code
      * EBuffer eb = b.duplicate().
-     *     order(ByteOrder.nativeOrder()).position(i).
+     *     order(ByteOrder.nativeOrder()).position(offset).
      *     asEBuffer();
-     * e[] es = new e[this.length()];
+     * e[] es = new e[species.length()];
      * for (int n = 0; n < t.length; n++) {
      *     if (m.isSet(n))
      *         es[n] = eb.get(n);
      * }
-     * Vector r = ((ESpecies)this).fromArray(es, 0, m);
+     * EVector r = EVector.fromArray(es, 0, m);
      * }
* * @param species species of desired vector * @param bb the byte buffer - * @param ix the offset into the byte buffer + * @param offset the offset into the byte buffer * @param m the mask * @return a vector loaded from a byte buffer * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > b.limit()}, * 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)} + * {@code offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline - public static IntVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int ix, VectorMask m) { - return zero(species).blend(fromByteBuffer(species, bb, ix), m); + public static IntVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int offset, VectorMask m) { + return zero(species).blend(fromByteBuffer(species, bb, offset), m); } /** * Returns a vector where all lane elements are set to the primitive * value {@code e}. * - * @param s species of the desired vector + * @param species species of the desired vector * @param e the value * @return a vector of vector where all lane elements are set to * the primitive value {@code e} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector broadcast(VectorSpecies s, int e) { + public static IntVector broadcast(VectorSpecies species, int e) { return VectorIntrinsics.broadcastCoerced( - (Class) s.boxType(), int.class, s.length(), - e, s, + (Class) species.boxType(), int.class, species.length(), + e, species, ((bits, sp) -> ((IntSpecies)sp).op(i -> (int)bits))); } /** - * Returns a vector where each lane element is set to a given - * primitive value. + * Returns a vector where each lane element is set to given + * primitive values. *

* For each vector lane, where {@code N} is the vector lane index, the * the primitive value at index {@code N} is placed into the resulting * vector at lane index {@code N}. * - * @param s species of the desired vector + * @param species species of the desired vector * @param es the given primitive values - * @return a vector where each lane element is set to a given primitive - * value - * @throws IndexOutOfBoundsException if {@code es.length < this.length()} + * @return a vector where each lane element is set to given primitive + * values + * @throws IndexOutOfBoundsException if {@code es.length < species.length()} */ @ForceInline @SuppressWarnings("unchecked") - public static IntVector scalars(VectorSpecies s, int... es) { + public static IntVector scalars(VectorSpecies species, int... es) { Objects.requireNonNull(es); - int ix = VectorIntrinsics.checkIndex(0, es.length, s.length()); - return VectorIntrinsics.load((Class) s.boxType(), int.class, s.length(), + int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); + return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), es, Unsafe.ARRAY_INT_BASE_OFFSET, - es, ix, s, + es, ix, species, (c, idx, sp) -> ((IntSpecies)sp).op(n -> c[idx + n])); } @@ -435,14 +432,14 @@ * value {@code e}, all other lane elements are set to the default * value. * - * @param s species of the desired vector + * @param species species of the desired vector * @param e the value * @return a vector where the first lane element is set to the primitive * value {@code e} */ @ForceInline - public static final IntVector single(VectorSpecies s, int e) { - return zero(s).with(0, e); + public static final IntVector single(VectorSpecies species, int e) { + return zero(species).with(0, e); } /** @@ -452,25 +449,28 @@ * The semantics are equivalent to calling * {@link ThreadLocalRandom#nextInt()} * - * @param s species of the desired vector + * @param species species of the desired vector * @return a vector where each lane elements is set to a randomly * generated primitive value */ - public static IntVector random(VectorSpecies s) { + public static IntVector random(VectorSpecies species) { ThreadLocalRandom r = ThreadLocalRandom.current(); - return ((IntSpecies)s).op(i -> r.nextInt()); + return ((IntSpecies)species).op(i -> r.nextInt()); } // Ops + /** + * {@inheritDoc} + */ @Override public abstract IntVector add(Vector v); /** * Adds this vector to the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive addition operation - * ({@code +}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive addition operation + * ({@code +}) to each lane. * * @param s the input scalar * @return the result of adding this vector to the broadcast of an input @@ -478,6 +478,9 @@ */ public abstract IntVector add(int s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector add(Vector v, VectorMask m); @@ -485,8 +488,8 @@ * Adds this vector to broadcast of an input scalar, * selecting lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive addition operation - * ({@code +}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive addition operation + * ({@code +}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -495,14 +498,17 @@ */ public abstract IntVector add(int s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector sub(Vector v); /** * Subtracts the broadcast of an input scalar from this vector. *

- * This is a vector binary operation where the primitive subtraction - * operation ({@code -}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive subtraction + * operation ({@code -}) to each lane. * * @param s the input scalar * @return the result of subtracting the broadcast of an input @@ -510,6 +516,9 @@ */ public abstract IntVector sub(int s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector sub(Vector v, VectorMask m); @@ -517,8 +526,8 @@ * Subtracts the broadcast of an input scalar from this vector, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive subtraction - * operation ({@code -}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive subtraction + * operation ({@code -}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -527,14 +536,17 @@ */ public abstract IntVector sub(int s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector mul(Vector v); /** * Multiplies this vector with the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive multiplication - * operation ({@code *}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive multiplication + * operation ({@code *}) to each lane. * * @param s the input scalar * @return the result of multiplying this vector with the broadcast of an @@ -542,6 +554,9 @@ */ public abstract IntVector mul(int s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector mul(Vector v, VectorMask m); @@ -549,8 +564,8 @@ * Multiplies this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive multiplication - * operation ({@code *}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive multiplication + * operation ({@code *}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -559,60 +574,87 @@ */ public abstract IntVector mul(int s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector neg(); + /** + * {@inheritDoc} + */ @Override public abstract IntVector neg(VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector abs(); + /** + * {@inheritDoc} + */ @Override public abstract IntVector abs(VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector min(Vector v); + /** + * {@inheritDoc} + */ @Override public abstract IntVector min(Vector v, VectorMask m); /** * Returns the minimum of this vector and the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements. + * This is a lane-wise binary operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to each lane. * * @param s the input scalar * @return the minimum of this vector and the broadcast of an input scalar */ public abstract IntVector min(int s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector max(Vector v); + /** + * {@inheritDoc} + */ @Override public abstract IntVector max(Vector v, VectorMask m); /** * Returns the maximum of this vector and the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements. + * This is a lane-wise binary operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to each lane. * * @param s the input scalar * @return the maximum of this vector and the broadcast of an input scalar */ public abstract IntVector max(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask equal(Vector v); /** * Tests if this vector is equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive equals - * operation ({@code ==}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive equals + * operation ({@code ==}) each lane. * * @param s the input scalar * @return the result mask of testing if this vector is equal to the @@ -620,14 +662,17 @@ */ public abstract VectorMask equal(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask notEqual(Vector v); /** * Tests if this vector is not equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive not equals - * operation ({@code !=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive not equals + * operation ({@code !=}) to each lane. * * @param s the input scalar * @return the result mask of testing if this vector is not equal to the @@ -635,14 +680,17 @@ */ public abstract VectorMask notEqual(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask lessThan(Vector v); /** * Tests if this vector is less than the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive less than - * operation ({@code <}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive less than + * operation ({@code <}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is less than the @@ -650,14 +698,17 @@ */ public abstract VectorMask lessThan(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask lessThanEq(Vector v); /** * Tests if this vector is less or equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive less than - * or equal to operation ({@code <=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive less than + * or equal to operation ({@code <=}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is less than or equal @@ -665,14 +716,17 @@ */ public abstract VectorMask lessThanEq(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask greaterThan(Vector v); /** * Tests if this vector is greater than the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive greater than - * operation ({@code >}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive greater than + * operation ({@code >}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is greater than the @@ -680,6 +734,9 @@ */ public abstract VectorMask greaterThan(int s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask greaterThanEq(Vector v); @@ -687,8 +744,8 @@ * Tests if this vector is greater than or equal to the broadcast of an * input scalar. *

- * This is a vector binary test operation where the primitive greater than - * or equal to operation ({@code >=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive greater than + * or equal to operation ({@code >=}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is greater than or @@ -696,6 +753,9 @@ */ public abstract VectorMask greaterThanEq(int s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector blend(Vector v, VectorMask m); @@ -716,25 +776,46 @@ */ public abstract IntVector blend(int s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector rearrange(Vector v, VectorShuffle s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector rearrange(VectorShuffle m); + /** + * {@inheritDoc} + */ @Override public abstract IntVector reshape(VectorSpecies s); + /** + * {@inheritDoc} + */ @Override public abstract IntVector rotateEL(int i); + /** + * {@inheritDoc} + */ @Override public abstract IntVector rotateER(int i); + /** + * {@inheritDoc} + */ @Override public abstract IntVector shiftEL(int i); + /** + * {@inheritDoc} + */ @Override public abstract IntVector shiftER(int i); @@ -743,8 +824,8 @@ /** * Bitwise ANDs this vector with an input vector. *

- * This is a vector binary operation where the primitive bitwise AND - * operation ({@code &}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise AND + * operation ({@code &}) to each lane. * * @param v the input vector * @return the bitwise AND of this vector with the input vector @@ -754,8 +835,8 @@ /** * Bitwise ANDs this vector with the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive bitwise AND - * operation ({@code &}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise AND + * operation ({@code &}) to each lane. * * @param s the input scalar * @return the bitwise AND of this vector with the broadcast of an input @@ -767,8 +848,8 @@ * Bitwise ANDs this vector with an input vector, selecting lane elements * controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise AND - * operation ({@code &}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise AND + * operation ({@code &}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -780,8 +861,8 @@ * Bitwise ANDs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise AND - * operation ({@code &}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise AND + * operation ({@code &}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -793,8 +874,8 @@ /** * Bitwise ORs this vector with an input vector. *

- * This is a vector binary operation where the primitive bitwise OR - * operation ({@code |}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise OR + * operation ({@code |}) to each lane. * * @param v the input vector * @return the bitwise OR of this vector with the input vector @@ -804,8 +885,8 @@ /** * Bitwise ORs this vector with the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive bitwise OR - * operation ({@code |}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise OR + * operation ({@code |}) to each lane. * * @param s the input scalar * @return the bitwise OR of this vector with the broadcast of an input @@ -817,8 +898,8 @@ * Bitwise ORs this vector with an input vector, selecting lane elements * controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise OR - * operation ({@code |}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise OR + * operation ({@code |}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -830,8 +911,8 @@ * Bitwise ORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise OR - * operation ({@code |}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise OR + * operation ({@code |}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -843,8 +924,8 @@ /** * Bitwise XORs this vector with an input vector. *

- * This is a vector binary operation where the primitive bitwise XOR - * operation ({@code ^}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise XOR + * operation ({@code ^}) to each lane. * * @param v the input vector * @return the bitwise XOR of this vector with the input vector @@ -854,8 +935,8 @@ /** * Bitwise XORs this vector with the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive bitwise XOR - * operation ({@code ^}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise XOR + * operation ({@code ^}) to each lane. * * @param s the input scalar * @return the bitwise XOR of this vector with the broadcast of an input @@ -867,8 +948,8 @@ * Bitwise XORs this vector with an input vector, selecting lane elements * controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise XOR - * operation ({@code ^}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise XOR + * operation ({@code ^}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -880,8 +961,8 @@ * Bitwise XORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive bitwise XOR - * operation ({@code ^}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive bitwise XOR + * operation ({@code ^}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -893,8 +974,8 @@ /** * Bitwise NOTs this vector. *

- * This is a vector unary operation where the primitive bitwise NOT - * operation ({@code ~}) is applied to lane elements. + * This is a lane-wise unary operation which applies the primitive bitwise NOT + * operation ({@code ~}) to each lane. * * @return the bitwise NOT of this vector */ @@ -903,8 +984,8 @@ /** * Bitwise NOTs this vector, selecting lane elements controlled by a mask. *

- * This is a vector unary operation where the primitive bitwise NOT - * operation ({@code ~}) is applied to lane elements. + * This is a lane-wise unary operation which applies the primitive bitwise NOT + * operation ({@code ~}) to each lane. * * @param m the mask controlling lane selection * @return the bitwise NOT of this vector @@ -914,8 +995,8 @@ /** * Logically left shifts this vector by the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive logical left shift - * operation ({@code <<}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical left shift + * operation ({@code <<}) to each lane. * * @param s the input scalar; the number of the bits to left shift * @return the result of logically left shifting left this vector by the @@ -927,8 +1008,8 @@ * Logically left shifts this vector by the broadcast of an input scalar, * selecting lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive logical left shift - * operation ({@code <<}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical left shift + * operation ({@code <<}) to each lane. * * @param s the input scalar; the number of the bits to left shift * @param m the mask controlling lane selection @@ -940,8 +1021,8 @@ /** * Logically left shifts this vector by an input vector. *

- * This is a vector binary operation where the primitive logical left shift - * operation ({@code <<}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical left shift + * operation ({@code <<}) to each lane. * * @param v the input vector * @return the result of logically left shifting this vector by the input @@ -953,8 +1034,8 @@ * Logically left shifts this vector by an input vector, selecting lane * elements controlled by a mask. *

- * This is a vector binary operation where the primitive logical left shift - * operation ({@code <<}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical left shift + * operation ({@code <<}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -971,8 +1052,8 @@ * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar. *

- * This is a vector binary operation where the primitive logical right shift - * operation ({@code >>>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical right shift + * operation ({@code >>>}) to each lane. * * @param s the input scalar; the number of the bits to right shift * @return the result of logically right shifting this vector by the @@ -985,8 +1066,8 @@ * broadcast of an input scalar, selecting lane elements controlled by a * mask. *

- * This is a vector binary operation where the primitive logical right shift - * operation ({@code >>>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical right shift + * operation ({@code >>>}) to each lane. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection @@ -999,8 +1080,8 @@ * Logically right shifts (or unsigned right shifts) this vector by an * input vector. *

- * This is a vector binary operation where the primitive logical right shift - * operation ({@code >>>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical right shift + * operation ({@code >>>}) to each lane. * * @param v the input vector * @return the result of logically right shifting this vector by the @@ -1012,8 +1093,8 @@ * Logically right shifts (or unsigned right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive logical right shift - * operation ({@code >>>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive logical right shift + * operation ({@code >>>}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -1028,8 +1109,8 @@ * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar. *

- * This is a vector binary operation where the primitive arithmetic right - * shift operation ({@code >>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive arithmetic right + * shift operation ({@code >>}) to each lane. * * @param s the input scalar; the number of the bits to right shift * @return the result of arithmetically right shifting this vector by the @@ -1042,8 +1123,8 @@ * broadcast of an input scalar, selecting lane elements controlled by a * mask. *

- * This is a vector binary operation where the primitive arithmetic right - * shift operation ({@code >>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive arithmetic right + * shift operation ({@code >>}) to each lane. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection @@ -1056,8 +1137,8 @@ * Arithmetically right shifts (or signed right shifts) this vector by an * input vector. *

- * This is a vector binary operation where the primitive arithmetic right - * shift operation ({@code >>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive arithmetic right + * shift operation ({@code >>}) to each lane. * * @param v the input vector * @return the result of arithmetically right shifting this vector by the @@ -1069,8 +1150,8 @@ * Arithmetically right shifts (or signed right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive arithmetic right - * shift operation ({@code >>}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive arithmetic right + * shift operation ({@code >>}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -1084,8 +1165,8 @@ /** * Rotates left this vector by the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@link Integer#rotateLeft} is applied to lane elements and where + * This is a lane-wise binary operation which applies the operation + * {@link Integer#rotateLeft} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). @@ -1103,8 +1184,8 @@ * Rotates left this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the operation - * {@link Integer#rotateLeft} is applied to lane elements and where + * This is a lane-wise binary operation which applies the operation + * {@link Integer#rotateLeft} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). @@ -1122,8 +1203,8 @@ /** * Rotates right this vector by the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@link Integer#rotateRight} is applied to lane elements and where + * This is a lane-wise binary operation which applies the operation + * {@link Integer#rotateRight} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). @@ -1141,8 +1222,8 @@ * Rotates right this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the operation - * {@link Integer#rotateRight} is applied to lane elements and where + * This is a lane-wise binary operation which applies the operation + * {@link Integer#rotateRight} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). @@ -1157,15 +1238,27 @@ return shiftR(s, m).or(shiftL(-s, m), m); } + /** + * {@inheritDoc} + */ @Override public abstract void intoByteArray(byte[] a, int ix); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteArray(byte[] a, int ix, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask m); @@ -1174,8 +1267,8 @@ /** * Adds all lane elements of this vector. *

- * This is an associative vector reduction operation where the addition - * operation ({@code +}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the addition + * operation ({@code +}) to lane elements, * and the identity value is {@code 0}. * * @return the addition of all the lane elements of this vector @@ -1186,8 +1279,8 @@ * Adds all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the addition - * operation ({@code +}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the addition + * operation ({@code +}) to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection @@ -1198,8 +1291,8 @@ /** * Multiplies all lane elements of this vector. *

- * This is an associative vector reduction operation where the - * multiplication operation ({@code *}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the + * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1}. * * @return the multiplication of all the lane elements of this vector @@ -1210,8 +1303,8 @@ * Multiplies all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the - * multiplication operation ({@code *}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the + * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1}. * * @param m the mask controlling lane selection @@ -1222,8 +1315,8 @@ /** * Returns the minimum lane element of this vector. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to lane elements, * and the identity value is * {@link Integer#MAX_VALUE}. * @@ -1235,8 +1328,8 @@ * Returns the minimum lane element of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to lane elements, * and the identity value is * {@link Integer#MAX_VALUE}. * @@ -1248,8 +1341,8 @@ /** * Returns the maximum lane element of this vector. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to lane elements, * and the identity value is * {@link Integer#MIN_VALUE}. * @@ -1261,8 +1354,8 @@ * Returns the maximum lane element of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to lane elements, * and the identity value is * {@link Integer#MIN_VALUE}. * @@ -1274,8 +1367,8 @@ /** * Logically ORs all lane elements of this vector. *

- * This is an associative vector reduction operation where the logical OR - * operation ({@code |}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical OR + * operation ({@code |}) to lane elements, * and the identity value is {@code 0}. * * @return the logical OR all the lane elements of this vector @@ -1286,8 +1379,8 @@ * Logically ORs all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the logical OR - * operation ({@code |}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical OR + * operation ({@code |}) to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection @@ -1298,8 +1391,8 @@ /** * Logically ANDs all lane elements of this vector. *

- * This is an associative vector reduction operation where the logical AND - * operation ({@code |}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical AND + * operation ({@code |}) to lane elements, * and the identity value is {@code -1}. * * @return the logical AND all the lane elements of this vector @@ -1310,8 +1403,8 @@ * Logically ANDs all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the logical AND - * operation ({@code |}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical AND + * operation ({@code |}) to lane elements, * and the identity value is {@code -1}. * * @param m the mask controlling lane selection @@ -1322,8 +1415,8 @@ /** * Logically XORs all lane elements of this vector. *

- * This is an associative vector reduction operation where the logical XOR - * operation ({@code ^}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical XOR + * operation ({@code ^}) to lane elements, * and the identity value is {@code 0}. * * @return the logical XOR all the lane elements of this vector @@ -1334,8 +1427,8 @@ * Logically XORs all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the logical XOR - * operation ({@code ^}) is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the logical XOR + * operation ({@code ^}) to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection @@ -1353,7 +1446,7 @@ * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ - public abstract int get(int i); + public abstract int lane(int i); /** * Replaces the lane element of this vector at lane index {@code i} with @@ -1400,30 +1493,30 @@ *

* For each vector lane, where {@code N} is the vector lane index, * the lane element at index {@code N} is stored into the array at index - * {@code i + N}. + * {@code offset + N}. * * @param a the array - * @param i the offset into the array - * @throws IndexOutOfBoundsException if {@code i < 0}, or - * {@code i > a.length - this.length()} + * @param offset the offset into the array + * @throws IndexOutOfBoundsException if {@code offset < 0}, or + * {@code offset > a.length - this.length()} */ - public abstract void intoArray(int[] a, int i); + public abstract void intoArray(int[] a, int offset); /** * Stores this vector into an array starting at offset and using a mask. *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the lane element at - * index {@code N} is stored into the array index {@code i + N}. + * index {@code N} is stored into the array index {@code offset + N}. * * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @param m the mask - * @throws IndexOutOfBoundsException if {@code i < 0}, or + * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} - * is set {@code i >= a.length - N} + * is set {@code offset >= a.length - N} */ - public abstract void intoArray(int[] a, int i, VectorMask m); + public abstract void intoArray(int[] a, int offset, VectorMask m); /** * Stores this vector into an array using indexes obtained from an index @@ -1431,20 +1524,20 @@ *

* For each vector lane, where {@code N} is the vector lane index, the * lane element at index {@code N} is stored into the array at index - * {@code i + indexMap[j + N]}. + * {@code a_offset + indexMap[i_offset + N]}. * * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param indexMap the index map - * @param j the offset into the index map - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @param i_offset the offset into the index map + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > 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} + * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ - public abstract void intoArray(int[] a, int i, int[] indexMap, int j); + public abstract void intoArray(int[] a, int a_offset, int[] indexMap, int i_offset); /** * Stores this vector into an array using indexes obtained from an index @@ -1453,24 +1546,27 @@ * For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the lane element at * index {@code N} is stored into the array at index - * {@code i + indexMap[j + N]}. + * {@code a_offset + indexMap[i_offset + N]}. * * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param m the mask * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * {@code i_offset > indexMap.length - this.length()}, * 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 N} is set the result of {@code a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ - public abstract void intoArray(int[] a, int i, VectorMask m, int[] indexMap, int j); + public abstract void intoArray(int[] a, int a_offset, VectorMask m, int[] indexMap, int i_offset); // Species + /** + * {@inheritDoc} + */ @Override public abstract VectorSpecies species();