< prev index next >

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

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

*** 123,152 **** * 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(VectorSpecies<Integer>, ByteBuffer, int, VectorMask) method} as follows: * <pre>{@code ! * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue()); * }</pre> * * @param species species of desired vector * @param a the byte array ! * @param ix 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)} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromByteArray(VectorSpecies<Integer> species, byte[] a, int ix) { Objects.requireNonNull(a); ! ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), ! a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET, ! a, ix, species, (c, idx, s) -> { ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder()); IntBuffer tb = bbc.asIntBuffer(); return ((IntSpecies)s).op(i -> tb.get()); }); --- 123,152 ---- * 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(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: * <pre>{@code ! * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue()); * }</pre> * * @param species species of desired vector * @param a the byte array ! * @param offset the offset into the array * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or ! * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromByteArray(VectorSpecies<Integer> species, byte[] a, int offset) { Objects.requireNonNull(a); ! offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), ! 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(); return ((IntSpecies)s).op(i -> tb.get()); });
*** 159,309 **** * 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(VectorSpecies<Integer>, ByteBuffer, int, VectorMask) method} as follows: * <pre>{@code ! * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m); * }</pre> * * @param species species of desired vector * @param a the byte array ! * @param ix 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}, * 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 IntVector fromByteArray(VectorSpecies<Integer> species, byte[] a, int ix, VectorMask<Integer> m) { ! return zero(species).blend(fromByteArray(species, a, ix), m); } /** * Loads a vector from an array starting at offset. * <p> * For each vector lane, where {@code N} is the vector lane index, the ! * array element at index {@code i + 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 * @return the vector loaded from an array ! * @throws IndexOutOfBoundsException if {@code i < 0}, or ! * {@code i > a.length - this.length()} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int i){ Objects.requireNonNull(a); ! i = VectorIntrinsics.checkIndex(i, a.length, species.length()); return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), ! a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET, ! a, i, species, (c, idx, s) -> ((IntSpecies)s).op(n -> c[idx + n])); } /** * Loads a vector from an array starting at offset and using a mask. * <p> * 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 * {@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 m the mask * @return the vector loaded from an array ! * @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 IntVector fromArray(VectorSpecies<Integer> species, int[] a, int i, VectorMask<Integer> m) { ! return zero(species).blend(fromArray(species, a, i), m); } /** * Loads a vector from an array using indexes obtained from an index * map. * <p> * 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 * 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 * 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 * @return the vector loaded from an array ! * @throws IndexOutOfBoundsException if {@code j < 0}, or ! * {@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} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int i, int[] indexMap, int j) { 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); vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorIntrinsics.loadWithMap((Class<IntVector>) species.boxType(), int.class, species.length(), IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_INT_BASE_OFFSET, vix, ! a, i, indexMap, j, species, (int[] c, int idx, int[] iMap, int idy, VectorSpecies<Integer> s) -> ((IntSpecies)s).op(n -> c[idx + iMap[idy+n]])); } /** * Loads a vector from an array using indexes obtained from an index * map and using a mask. * <p> * 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 * 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 * 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 * @return the vector loaded from an array ! * @throws IndexOutOfBoundsException if {@code j < 0}, or ! * {@code j > 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 < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int i, VectorMask<Integer> 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); } /** * Loads a vector from a {@link ByteBuffer byte buffer} starting at an --- 159,306 ---- * 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(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: * <pre>{@code ! * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m); * }</pre> * * @param species species of desired vector * @param a the byte array ! * @param offset the offset into the array * @param m the mask * @return a vector loaded from a byte array ! * @throws IndexOutOfBoundsException if {@code offset < 0} or * for any vector lane index {@code N} where the mask at lane {@code N} * is set ! * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline ! public static IntVector fromByteArray(VectorSpecies<Integer> species, byte[] a, int offset, VectorMask<Integer> m) { ! return zero(species).blend(fromByteArray(species, a, offset), m); } /** * Loads a vector from an array starting at offset. * <p> * For each vector lane, where {@code N} is the vector lane index, 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 offset the offset into the array * @return the vector loaded from an array ! * @throws IndexOutOfBoundsException if {@code offset < 0}, or ! * {@code offset > a.length - species.length()} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int offset){ Objects.requireNonNull(a); ! offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), ! a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET, ! a, offset, species, (c, idx, s) -> ((IntSpecies)s).op(n -> c[idx + n])); } /** * Loads a vector from an array starting at offset and using a mask. * <p> * 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 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 offset the offset into the array * @param m the mask * @return the vector loaded from an array ! * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} ! * is set {@code offset > a.length - N} */ @ForceInline ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int offset, VectorMask<Integer> m) { ! return zero(species).blend(fromArray(species, a, offset), m); } /** * Loads a vector from an array using indexes obtained from an index * map. * <p> * For each vector lane, where {@code N} is the vector lane index, 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 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 i_offset the offset into the index map * @return the vector loaded from an array ! * @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 a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int a_offset, int[] indexMap, int i_offset) { Objects.requireNonNull(a); Objects.requireNonNull(indexMap); ! // 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<IntVector>) species.boxType(), int.class, species.length(), IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_INT_BASE_OFFSET, vix, ! a, a_offset, indexMap, i_offset, species, (int[] c, int idx, int[] iMap, int idy, VectorSpecies<Integer> s) -> ((IntSpecies)s).op(n -> c[idx + iMap[idy+n]])); } /** * Loads a vector from an array using indexes obtained from an index * map and using a mask. * <p> * 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 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 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 i_offset the offset into the index map * @return the vector loaded from an array ! * @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 a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromArray(VectorSpecies<Integer> species, int[] a, int a_offset, VectorMask<Integer> 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, a_offset, indexMap, i_offset), m); } /** * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
*** 312,346 **** * 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(VectorSpecies<Integer>, ByteBuffer, int, VectorMask)} method} as follows: * <pre>{@code ! * return this.fromByteBuffer(b, i, this.maskAllTrue()) * }</pre> * * @param species species of desired vector * @param bb the byte buffer ! * @param ix 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 * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromByteBuffer(VectorSpecies<Integer> 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<IntVector>) species.boxType(), int.class, species.length(), ! U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix, ! bb, ix, species, (c, idx, s) -> { ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder()); IntBuffer tb = bbc.asIntBuffer(); return ((IntSpecies)s).op(i -> tb.get()); }); --- 309,343 ---- * 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(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows: * <pre>{@code ! * return fromByteBuffer(b, offset, VectorMask.allTrue()) * }</pre> * * @param species species of desired vector * @param bb 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 species.length() * species.elementSize() / Byte.SIZE} bytes * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector fromByteBuffer(VectorSpecies<Integer> species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } ! offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), ! 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(); return ((IntSpecies)s).op(i -> tb.get()); });
*** 354,478 **** * {@link java.nio.Buffer buffer} for the primitive element type, * according to the native byte order of the underlying platform, and * 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<S>} is the primitive * species for {@code e}: * <pre>{@code * EBuffer eb = b.duplicate(). ! * order(ByteOrder.nativeOrder()).position(i). * asEBuffer(); ! * e[] es = new e[this.length()]; * for (int n = 0; n < t.length; n++) { * if (m.isSet(n)) * es[n] = eb.get(n); * } ! * Vector<E> r = ((ESpecies<S>)this).fromArray(es, 0, m); * }</pre> * * @param species species of desired vector * @param bb the byte buffer ! * @param ix 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)} */ @ForceInline ! public static IntVector fromByteBuffer(VectorSpecies<Integer> species, ByteBuffer bb, int ix, VectorMask<Integer> m) { ! return zero(species).blend(fromByteBuffer(species, bb, ix), m); } /** * Returns a vector where all lane elements are set to the primitive * value {@code e}. * ! * @param s 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<Integer> s, int e) { return VectorIntrinsics.broadcastCoerced( ! (Class<IntVector>) s.boxType(), int.class, s.length(), ! e, s, ((bits, sp) -> ((IntSpecies)sp).op(i -> (int)bits))); } /** ! * Returns a vector where each lane element is set to a given ! * primitive value. * <p> * 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 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()} */ @ForceInline @SuppressWarnings("unchecked") ! public static IntVector scalars(VectorSpecies<Integer> s, int... es) { Objects.requireNonNull(es); ! int ix = VectorIntrinsics.checkIndex(0, es.length, s.length()); ! return VectorIntrinsics.load((Class<IntVector>) s.boxType(), int.class, s.length(), es, Unsafe.ARRAY_INT_BASE_OFFSET, ! es, ix, s, (c, idx, sp) -> ((IntSpecies)sp).op(n -> c[idx + n])); } /** * Returns a vector where the first lane element is set to the primtive * value {@code e}, all other lane elements are set to the default * value. * ! * @param s 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<Integer> s, int e) { ! return zero(s).with(0, e); } /** * Returns a vector where each lane element is set to a randomly * generated primitive value. * * The semantics are equivalent to calling * {@link ThreadLocalRandom#nextInt()} * ! * @param s 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<Integer> s) { ThreadLocalRandom r = ThreadLocalRandom.current(); ! return ((IntSpecies)s).op(i -> r.nextInt()); } // Ops @Override public abstract IntVector add(Vector<Integer> v); /** * Adds this vector to the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive addition operation ! * ({@code +}) is applied to lane elements. * * @param s the input scalar * @return the result of adding this vector to the broadcast of an input * scalar */ --- 351,475 ---- * {@link java.nio.Buffer buffer} for the primitive element type, * according to the native byte order of the underlying platform, and * the returned vector is loaded with a mask from a primitive array * obtained from the primitive buffer. * The following pseudocode expresses the behaviour, where ! * {@code EBuffer} is the primitive buffer type, {@code e} is the ! * primitive element type, and {@code ESpecies} is the primitive * species for {@code e}: * <pre>{@code * EBuffer eb = b.duplicate(). ! * order(ByteOrder.nativeOrder()).position(offset). * asEBuffer(); ! * e[] es = new e[species.length()]; * for (int n = 0; n < t.length; n++) { * if (m.isSet(n)) * es[n] = eb.get(n); * } ! * EVector r = EVector.fromArray(es, 0, m); * }</pre> * * @param species species of desired vector * @param bb 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 offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline ! public static IntVector fromByteBuffer(VectorSpecies<Integer> species, ByteBuffer bb, int offset, VectorMask<Integer> 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 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<Integer> species, int e) { return VectorIntrinsics.broadcastCoerced( ! (Class<IntVector>) 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 given ! * primitive values. * <p> * 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 species species of the desired vector * @param es the given primitive values ! * @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<Integer> species, int... es) { Objects.requireNonNull(es); ! int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); ! return VectorIntrinsics.load((Class<IntVector>) species.boxType(), int.class, species.length(), es, Unsafe.ARRAY_INT_BASE_OFFSET, ! es, ix, species, (c, idx, sp) -> ((IntSpecies)sp).op(n -> c[idx + n])); } /** * Returns a vector where the first lane element is set to the primtive * value {@code e}, all other lane elements are set to the default * value. * ! * @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<Integer> species, int e) { ! return zero(species).with(0, e); } /** * Returns a vector where each lane element is set to a randomly * generated primitive value. * * The semantics are equivalent to calling * {@link ThreadLocalRandom#nextInt()} * ! * @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<Integer> species) { ThreadLocalRandom r = ThreadLocalRandom.current(); ! return ((IntSpecies)species).op(i -> r.nextInt()); } // Ops @Override public abstract IntVector add(Vector<Integer> v); /** * Adds this vector to the broadcast of an input scalar. * <p> ! * 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 * scalar */
*** 483,494 **** /** * Adds this vector to broadcast of an input scalar, * selecting lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive addition operation ! * ({@code +}) is applied to lane elements. * * @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 --- 480,491 ---- /** * Adds this vector to broadcast of an input scalar, * selecting lane elements controlled by a mask. * <p> ! * 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 * @return the result of adding this vector to the broadcast of an input * scalar
*** 499,510 **** public abstract IntVector sub(Vector<Integer> v); /** * Subtracts the broadcast of an input scalar from this vector. * <p> ! * This is a vector binary operation where the primitive subtraction ! * operation ({@code -}) is applied to lane elements. * * @param s the input scalar * @return the result of subtracting the broadcast of an input * scalar from this vector */ --- 496,507 ---- public abstract IntVector sub(Vector<Integer> v); /** * Subtracts the broadcast of an input scalar from this vector. * <p> ! * 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 * scalar from this vector */
*** 515,526 **** /** * Subtracts the broadcast of an input scalar from this vector, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive subtraction ! * operation ({@code -}) is applied to lane elements. * * @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 --- 512,523 ---- /** * Subtracts the broadcast of an input scalar from this vector, selecting * lane elements controlled by a mask. * <p> ! * 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 * @return the result of subtracting the broadcast of an input * scalar from this vector
*** 531,542 **** public abstract IntVector mul(Vector<Integer> v); /** * Multiplies this vector with the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive multiplication ! * operation ({@code *}) is applied to lane elements. * * @param s the input scalar * @return the result of multiplying this vector with the broadcast of an * input scalar */ --- 528,539 ---- public abstract IntVector mul(Vector<Integer> v); /** * Multiplies this vector with the broadcast of an input scalar. * <p> ! * 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 * input scalar */
*** 547,558 **** /** * Multiplies this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive multiplication ! * operation ({@code *}) is applied to lane elements. * * @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 --- 544,555 ---- /** * Multiplies this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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 * @return the result of multiplying this vector with the broadcast of an * input scalar
*** 578,589 **** public abstract IntVector min(Vector<Integer> v, VectorMask<Integer> m); /** * Returns the minimum of this vector and the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the operation ! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements. * * @param s the input scalar * @return the minimum of this vector and the broadcast of an input scalar */ public abstract IntVector min(int s); --- 575,586 ---- public abstract IntVector min(Vector<Integer> v, VectorMask<Integer> m); /** * Returns the minimum of this vector and the broadcast of an input scalar. * <p> ! * 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);
*** 595,606 **** public abstract IntVector max(Vector<Integer> v, VectorMask<Integer> m); /** * Returns the maximum of this vector and the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the operation ! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements. * * @param s the input scalar * @return the maximum of this vector and the broadcast of an input scalar */ public abstract IntVector max(int s); --- 592,603 ---- public abstract IntVector max(Vector<Integer> v, VectorMask<Integer> m); /** * Returns the maximum of this vector and the broadcast of an input scalar. * <p> ! * 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);
*** 609,620 **** public abstract VectorMask<Integer> equal(Vector<Integer> 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 ! * operation ({@code ==}) is applied to lane elements. * * @param s the input scalar * @return the result mask of testing if this vector is equal to the * broadcast of an input scalar */ --- 606,617 ---- public abstract VectorMask<Integer> equal(Vector<Integer> v); /** * Tests if this vector is equal to the broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 624,635 **** public abstract VectorMask<Integer> notEqual(Vector<Integer> 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 ! * operation ({@code !=}) is applied to lane elements. * * @param s the input scalar * @return the result mask of testing if this vector is not equal to the * broadcast of an input scalar */ --- 621,632 ---- public abstract VectorMask<Integer> notEqual(Vector<Integer> v); /** * Tests if this vector is not equal to the broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 639,650 **** public abstract VectorMask<Integer> lessThan(Vector<Integer> 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 ! * operation ({@code <}) is applied to lane elements. * * @param s the input scalar * @return the mask result of testing if this vector is less than the * broadcast of an input scalar */ --- 636,647 ---- public abstract VectorMask<Integer> lessThan(Vector<Integer> v); /** * Tests if this vector is less than the broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 654,665 **** public abstract VectorMask<Integer> lessThanEq(Vector<Integer> 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 ! * or equal to operation ({@code <=}) is applied to lane elements. * * @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 */ --- 651,662 ---- public abstract VectorMask<Integer> lessThanEq(Vector<Integer> v); /** * Tests if this vector is less or equal to the broadcast of an input scalar. * <p> ! * 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 * to the broadcast of an input scalar */
*** 669,680 **** public abstract VectorMask<Integer> greaterThan(Vector<Integer> 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 ! * operation ({@code >}) is applied to lane elements. * * @param s the input scalar * @return the mask result of testing if this vector is greater than the * broadcast of an input scalar */ --- 666,677 ---- public abstract VectorMask<Integer> greaterThan(Vector<Integer> v); /** * Tests if this vector is greater than the broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 685,696 **** /** * Tests if this vector is greater than or equal to the broadcast of an * input scalar. * <p> ! * This is a vector binary test operation where the primitive greater than ! * or equal to operation ({@code >=}) is applied to lane elements. * * @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 */ --- 682,693 ---- /** * Tests if this vector is greater than or equal to the broadcast of an * input scalar. * <p> ! * 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 * equal to the broadcast of an input scalar */
*** 741,763 **** /** * Bitwise ANDs this vector with an input vector. * <p> ! * This is a vector binary operation where the primitive bitwise AND ! * operation ({@code &}) is applied to lane elements. * * @param v the input vector * @return the bitwise AND of this vector with the input vector */ public abstract IntVector and(Vector<Integer> v); /** * Bitwise ANDs this vector with the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive bitwise AND ! * operation ({@code &}) is applied to lane elements. * * @param s the input scalar * @return the bitwise AND of this vector with the broadcast of an input * scalar */ --- 738,760 ---- /** * Bitwise ANDs this vector with an input vector. * <p> ! * 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 */ public abstract IntVector and(Vector<Integer> v); /** * Bitwise ANDs this vector with the broadcast of an input scalar. * <p> ! * 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 * scalar */
*** 765,776 **** /** * Bitwise ANDs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise AND ! * operation ({@code &}) is applied to lane elements. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise AND of this vector with the input vector */ --- 762,773 ---- /** * Bitwise ANDs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the bitwise AND of this vector with the input vector */
*** 778,789 **** /** * Bitwise ANDs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise AND ! * operation ({@code &}) is applied to lane elements. * * @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 --- 775,786 ---- /** * Bitwise ANDs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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 * @return the bitwise AND of this vector with the broadcast of an input * scalar
*** 791,813 **** public abstract IntVector and(int s, VectorMask<Integer> m); /** * Bitwise ORs this vector with an input vector. * <p> ! * This is a vector binary operation where the primitive bitwise OR ! * operation ({@code |}) is applied to lane elements. * * @param v the input vector * @return the bitwise OR of this vector with the input vector */ public abstract IntVector or(Vector<Integer> v); /** * Bitwise ORs this vector with the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive bitwise OR ! * operation ({@code |}) is applied to lane elements. * * @param s the input scalar * @return the bitwise OR of this vector with the broadcast of an input * scalar */ --- 788,810 ---- public abstract IntVector and(int s, VectorMask<Integer> m); /** * Bitwise ORs this vector with an input vector. * <p> ! * 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 */ public abstract IntVector or(Vector<Integer> v); /** * Bitwise ORs this vector with the broadcast of an input scalar. * <p> ! * 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 * scalar */
*** 815,826 **** /** * Bitwise ORs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise OR ! * operation ({@code |}) is applied to lane elements. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise OR of this vector with the input vector */ --- 812,823 ---- /** * Bitwise ORs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the bitwise OR of this vector with the input vector */
*** 828,839 **** /** * Bitwise ORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise OR ! * operation ({@code |}) is applied to lane elements. * * @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 --- 825,836 ---- /** * Bitwise ORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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 * @return the bitwise OR of this vector with the broadcast of an input * scalar
*** 841,863 **** public abstract IntVector or(int s, VectorMask<Integer> m); /** * Bitwise XORs this vector with an input vector. * <p> ! * This is a vector binary operation where the primitive bitwise XOR ! * operation ({@code ^}) is applied to lane elements. * * @param v the input vector * @return the bitwise XOR of this vector with the input vector */ public abstract IntVector xor(Vector<Integer> v); /** * Bitwise XORs this vector with the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive bitwise XOR ! * operation ({@code ^}) is applied to lane elements. * * @param s the input scalar * @return the bitwise XOR of this vector with the broadcast of an input * scalar */ --- 838,860 ---- public abstract IntVector or(int s, VectorMask<Integer> m); /** * Bitwise XORs this vector with an input vector. * <p> ! * 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 */ public abstract IntVector xor(Vector<Integer> v); /** * Bitwise XORs this vector with the broadcast of an input scalar. * <p> ! * 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 * scalar */
*** 865,876 **** /** * Bitwise XORs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise XOR ! * operation ({@code ^}) is applied to lane elements. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise XOR of this vector with the input vector */ --- 862,873 ---- /** * Bitwise XORs this vector with an input vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the bitwise XOR of this vector with the input vector */
*** 878,889 **** /** * Bitwise XORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive bitwise XOR ! * operation ({@code ^}) is applied to lane elements. * * @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 --- 875,886 ---- /** * Bitwise XORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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 * @return the bitwise XOR of this vector with the broadcast of an input * scalar
*** 891,923 **** public abstract IntVector xor(int s, VectorMask<Integer> m); /** * Bitwise NOTs this vector. * <p> ! * This is a vector unary operation where the primitive bitwise NOT ! * operation ({@code ~}) is applied to lane elements. * * @return the bitwise NOT of this vector */ public abstract IntVector not(); /** * Bitwise NOTs this vector, selecting lane elements controlled by a mask. * <p> ! * This is a vector unary operation where the primitive bitwise NOT ! * operation ({@code ~}) is applied to lane elements. * * @param m the mask controlling lane selection * @return the bitwise NOT of this vector */ public abstract IntVector not(VectorMask<Integer> m); /** * Logically left shifts this vector by the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive logical left shift ! * operation ({@code <<}) is applied to lane elements. * * @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 * broadcast of an input scalar */ --- 888,920 ---- public abstract IntVector xor(int s, VectorMask<Integer> m); /** * Bitwise NOTs this vector. * <p> ! * 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 */ public abstract IntVector not(); /** * Bitwise NOTs this vector, selecting lane elements controlled by a mask. * <p> ! * 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 */ public abstract IntVector not(VectorMask<Integer> m); /** * Logically left shifts this vector by the broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 925,936 **** /** * Logically left shifts this vector by the broadcast of an input scalar, * selecting lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive logical left shift ! * operation ({@code <<}) is applied to lane elements. * * @param s the input scalar; the number of the bits to left shift * @param m the mask controlling lane selection * @return the result of logically left shifting this vector by the * broadcast of an input scalar --- 922,933 ---- /** * Logically left shifts this vector by the broadcast of an input scalar, * selecting lane elements controlled by a mask. * <p> ! * 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 * @return the result of logically left shifting this vector by the * broadcast of an input scalar
*** 938,949 **** public abstract IntVector shiftL(int s, VectorMask<Integer> m); /** * Logically left shifts this vector by an input vector. * <p> ! * This is a vector binary operation where the primitive logical left shift ! * operation ({@code <<}) is applied to lane elements. * * @param v the input vector * @return the result of logically left shifting this vector by the input * vector */ --- 935,946 ---- public abstract IntVector shiftL(int s, VectorMask<Integer> m); /** * Logically left shifts this vector by an input vector. * <p> ! * 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 * vector */
*** 951,962 **** /** * Logically left shifts this vector by an input vector, selecting lane * elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive logical left shift ! * operation ({@code <<}) is applied to lane elements. * * @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 --- 948,959 ---- /** * Logically left shifts this vector by an input vector, selecting lane * elements controlled by a mask. * <p> ! * 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 * @return the result of logically left shifting this vector by the input * vector
*** 969,980 **** /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive logical right shift ! * operation ({@code >>>}) is applied to lane elements. * * @param s the input scalar; the number of the bits to right shift * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ --- 966,977 ---- /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 983,994 **** /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. * <p> ! * This is a vector binary operation where the primitive logical right shift ! * operation ({@code >>>}) is applied to lane elements. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of logically right shifting this vector by the * broadcast of an input scalar --- 980,991 ---- /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. * <p> ! * 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 * @return the result of logically right shifting this vector by the * broadcast of an input scalar
*** 997,1008 **** /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector. * <p> ! * This is a vector binary operation where the primitive logical right shift ! * operation ({@code >>>}) is applied to lane elements. * * @param v the input vector * @return the result of logically right shifting this vector by the * input vector */ --- 994,1005 ---- /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector. * <p> ! * 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 * input vector */
*** 1010,1021 **** /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive logical right shift ! * operation ({@code >>>}) is applied to lane elements. * * @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 --- 1007,1018 ---- /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. * <p> ! * 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 * @return the result of logically right shifting this vector by the * input vector
*** 1026,1037 **** /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar. * <p> ! * This is a vector binary operation where the primitive arithmetic right ! * shift operation ({@code >>}) is applied to lane elements. * * @param s the input scalar; the number of the bits to right shift * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ --- 1023,1034 ---- /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar. * <p> ! * 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 * broadcast of an input scalar */
*** 1040,1051 **** /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. * <p> ! * This is a vector binary operation where the primitive arithmetic right ! * shift operation ({@code >>}) is applied to lane elements. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar --- 1037,1048 ---- /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. * <p> ! * 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 * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar
*** 1054,1065 **** /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector. * <p> ! * This is a vector binary operation where the primitive arithmetic right ! * shift operation ({@code >>}) is applied to lane elements. * * @param v the input vector * @return the result of arithmetically right shifting this vector by the * input vector */ --- 1051,1062 ---- /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector. * <p> ! * 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 * input vector */
*** 1067,1078 **** /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the primitive arithmetic right ! * shift operation ({@code >>}) is applied to lane elements. * * @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 --- 1064,1075 ---- /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. * <p> ! * 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 * @return the result of arithmetically right shifting this vector by the * input vector
*** 1082,1093 **** } /** * Rotates left this vector by the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the operation ! * {@link Integer#rotateLeft} is applied to lane elements 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). * * @param s the input scalar; the number of the bits to rotate left --- 1079,1090 ---- } /** * Rotates left this vector by the broadcast of an input scalar. * <p> ! * 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). * * @param s the input scalar; the number of the bits to rotate left
*** 1101,1112 **** /** * Rotates left this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the operation ! * {@link Integer#rotateLeft} is applied to lane elements 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). * * @param s the input scalar; the number of the bits to rotate left --- 1098,1109 ---- /** * Rotates left this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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). * * @param s the input scalar; the number of the bits to rotate left
*** 1120,1131 **** } /** * Rotates right this vector by the broadcast of an input scalar. * <p> ! * This is a vector binary operation where the operation ! * {@link Integer#rotateRight} is applied to lane elements 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). * * @param s the input scalar; the number of the bits to rotate right --- 1117,1128 ---- } /** * Rotates right this vector by the broadcast of an input scalar. * <p> ! * 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). * * @param s the input scalar; the number of the bits to rotate right
*** 1139,1150 **** /** * Rotates right this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * This is a vector binary operation where the operation ! * {@link Integer#rotateRight} is applied to lane elements 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). * * @param s the input scalar; the number of the bits to rotate right --- 1136,1147 ---- /** * Rotates right this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. * <p> ! * 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). * * @param s the input scalar; the number of the bits to rotate right
*** 1172,1231 **** // Type specific horizontal reductions /** * Adds all lane elements of this vector. * <p> ! * This is an associative vector reduction operation where the addition ! * operation ({@code +}) is applied to lane elements, * and the identity value is {@code 0}. * * @return the addition of all the lane elements of this vector */ public abstract int addAll(); /** * Adds all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the addition ! * operation ({@code +}) is applied to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection * @return the addition of the selected lane elements of this vector */ public abstract int addAll(VectorMask<Integer> m); /** * Multiplies all lane elements of this vector. * <p> ! * This is an associative vector reduction operation where the ! * multiplication operation ({@code *}) is applied to lane elements, * and the identity value is {@code 1}. * * @return the multiplication of all the lane elements of this vector */ public abstract int mulAll(); /** * Multiplies all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the ! * multiplication operation ({@code *}) is applied to lane elements, * and the identity value is {@code 1}. * * @param m the mask controlling lane selection * @return the multiplication of all the lane elements of this vector */ public abstract int mulAll(VectorMask<Integer> m); /** * Returns the minimum lane element of this vector. * <p> ! * This is an associative vector reduction operation where the operation ! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, * and the identity value is * {@link Integer#MAX_VALUE}. * * @return the minimum lane element of this vector */ --- 1169,1228 ---- // Type specific horizontal reductions /** * Adds all lane elements of this vector. * <p> ! * 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 */ public abstract int addAll(); /** * Adds all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the addition of the selected lane elements of this vector */ public abstract int addAll(VectorMask<Integer> m); /** * Multiplies all lane elements of this vector. * <p> ! * 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 */ public abstract int mulAll(); /** * Multiplies all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the multiplication of all the lane elements of this vector */ public abstract int mulAll(VectorMask<Integer> m); /** * Returns the minimum lane element of this vector. * <p> ! * 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}. * * @return the minimum lane element of this vector */
*** 1233,1244 **** /** * Returns the minimum lane element of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the operation ! * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, * and the identity value is * {@link Integer#MAX_VALUE}. * * @param m the mask controlling lane selection * @return the minimum lane element of this vector --- 1230,1241 ---- /** * Returns the minimum lane element of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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}. * * @param m the mask controlling lane selection * @return the minimum lane element of this vector
*** 1246,1257 **** public abstract int minAll(VectorMask<Integer> m); /** * Returns the maximum lane element of this vector. * <p> ! * This is an associative vector reduction operation where the operation ! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, * and the identity value is * {@link Integer#MIN_VALUE}. * * @return the maximum lane element of this vector */ --- 1243,1254 ---- public abstract int minAll(VectorMask<Integer> m); /** * Returns the maximum lane element of this vector. * <p> ! * 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}. * * @return the maximum lane element of this vector */
*** 1259,1270 **** /** * Returns the maximum lane element of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the operation ! * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, * and the identity value is * {@link Integer#MIN_VALUE}. * * @param m the mask controlling lane selection * @return the maximum lane element of this vector --- 1256,1267 ---- /** * Returns the maximum lane element of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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}. * * @param m the mask controlling lane selection * @return the maximum lane element of this vector
*** 1272,1343 **** public abstract int maxAll(VectorMask<Integer> m); /** * Logically ORs all lane elements of this vector. * <p> ! * This is an associative vector reduction operation where the logical OR ! * operation ({@code |}) is applied to lane elements, * and the identity value is {@code 0}. * * @return the logical OR all the lane elements of this vector */ public abstract int orAll(); /** * Logically ORs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the logical OR ! * operation ({@code |}) is applied to lane elements, * 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 int orAll(VectorMask<Integer> m); /** * Logically ANDs all lane elements of this vector. * <p> ! * This is an associative vector reduction operation where the logical AND ! * operation ({@code |}) is applied to lane elements, * and the identity value is {@code -1}. * * @return the logical AND all the lane elements of this vector */ public abstract int andAll(); /** * Logically ANDs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the logical AND ! * operation ({@code |}) is applied to lane elements, * 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 int andAll(VectorMask<Integer> m); /** * Logically XORs all lane elements of this vector. * <p> ! * This is an associative vector reduction operation where the logical XOR ! * operation ({@code ^}) is applied to lane elements, * and the identity value is {@code 0}. * * @return the logical XOR all the lane elements of this vector */ public abstract int xorAll(); /** * Logically XORs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * This is an associative vector reduction operation where the logical XOR ! * operation ({@code ^}) is applied to lane elements, * 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 */ --- 1269,1340 ---- public abstract int maxAll(VectorMask<Integer> m); /** * Logically ORs all lane elements of this vector. * <p> ! * 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 */ public abstract int orAll(); /** * Logically ORs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the logical OR all the lane elements of this vector */ public abstract int orAll(VectorMask<Integer> m); /** * Logically ANDs all lane elements of this vector. * <p> ! * 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 */ public abstract int andAll(); /** * Logically ANDs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the logical AND all the lane elements of this vector */ public abstract int andAll(VectorMask<Integer> m); /** * Logically XORs all lane elements of this vector. * <p> ! * 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 */ public abstract int xorAll(); /** * Logically XORs all lane elements of this vector, selecting lane elements * controlled by a mask. * <p> ! * 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 * @return the logical XOR all the lane elements of this vector */
*** 1351,1361 **** * @param i the lane index * @return the lane element at lane index {@code i} * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ ! public abstract int get(int i); /** * Replaces the lane element of this vector at lane index {@code i} with * value {@code e}. * <p> --- 1348,1358 ---- * @param i the lane index * @return the lane element at lane index {@code i} * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ ! public abstract int lane(int i); /** * Replaces the lane element of this vector at lane index {@code i} with * value {@code e}. * <p>
*** 1398,1476 **** /** * Stores this vector into an array starting at offset. * <p> * 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}. * * @param a the array ! * @param i the offset into the array ! * @throws IndexOutOfBoundsException if {@code i < 0}, or ! * {@code i > a.length - this.length()} */ ! public abstract void intoArray(int[] a, int i); /** * Stores this vector into an array starting at offset and using a mask. * <p> * 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}. * * @param a the array ! * @param i the offset into the array * @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(int[] a, int i, VectorMask<Integer> m); /** * Stores this vector into an array using indexes obtained from an index * map. * <p> * 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]}. * * @param a the array ! * @param i 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()}, * or for any vector lane index {@code N} the result of ! * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} */ ! public abstract void intoArray(int[] a, int i, int[] indexMap, int j); /** * Stores this vector into an array using indexes obtained from an index * map and using a mask. * <p> * 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]}. * * @param a the array ! * @param i 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 * @throws IndexOutOfBoundsException if {@code j < 0}, or ! * {@code j > 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 < 0} or {@code >= a.length} */ ! public abstract void intoArray(int[] a, int i, VectorMask<Integer> m, int[] indexMap, int j); // Species @Override public abstract VectorSpecies<Integer> species(); --- 1395,1473 ---- /** * Stores this vector into an array starting at offset. * <p> * 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 offset + N}. * * @param a the array ! * @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 offset); /** * Stores this vector into an array starting at offset and using a mask. * <p> * 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 offset + N}. * * @param a the array ! * @param offset the offset into the array * @param m the mask ! * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} ! * is set {@code offset >= a.length - N} */ ! public abstract void intoArray(int[] a, int offset, VectorMask<Integer> m); /** * Stores this vector into an array using indexes obtained from an index * map. * <p> * 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 a_offset + indexMap[i_offset + N]}. * * @param a the array ! * @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 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 a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ ! 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 * map and using a mask. * <p> * 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 a_offset + indexMap[i_offset + N]}. * * @param a the array ! * @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 i_offset the offset into the index map * @throws IndexOutOfBoundsException if {@code j < 0}, or ! * {@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 a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ ! public abstract void intoArray(int[] a, int a_offset, VectorMask<Integer> m, int[] indexMap, int i_offset); // Species @Override public abstract VectorSpecies<Integer> species();
< prev index next >