< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template
Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level
*** 56,86 ****
$type$ apply(int i, $type$ a);
}
abstract $abstractvectortype$ uOp(FUnOp f);
! abstract $abstractvectortype$ uOp(Mask<$Boxtype$> m, FUnOp f);
// Binary operator
interface FBinOp {
$type$ apply(int i, $type$ a, $type$ b);
}
abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, FBinOp f);
! abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, Mask<$Boxtype$> m, FBinOp f);
// Trinary operator
interface FTriOp {
$type$ apply(int i, $type$ a, $type$ b, $type$ c);
}
abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f);
! abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m, FTriOp f);
// Reduction operator
abstract $type$ rOp($type$ v, FBinOp f);
--- 56,86 ----
$type$ apply(int i, $type$ a);
}
abstract $abstractvectortype$ uOp(FUnOp f);
! abstract $abstractvectortype$ uOp(VectorMask<$Boxtype$> m, FUnOp f);
// Binary operator
interface FBinOp {
$type$ apply(int i, $type$ a, $type$ b);
}
abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, FBinOp f);
! abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m, FBinOp f);
// Trinary operator
interface FTriOp {
$type$ apply(int i, $type$ a, $type$ b, $type$ c);
}
abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f);
! abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m, FTriOp f);
// Reduction operator
abstract $type$ rOp($type$ v, FBinOp f);
*** 88,108 ****
interface FBinTest {
boolean apply(int i, $type$ a, $type$ b);
}
! abstract Mask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f);
// Foreach
interface FUnCon {
void apply(int i, $type$ a);
}
abstract void forEach(FUnCon f);
! abstract void forEach(Mask<$Boxtype$> m, FUnCon f);
// Static factories
/**
* Returns a vector where all lane elements are set to the default
--- 88,108 ----
interface FBinTest {
boolean apply(int i, $type$ a, $type$ b);
}
! abstract VectorMask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f);
// Foreach
interface FUnCon {
void apply(int i, $type$ a);
}
abstract void forEach(FUnCon f);
! abstract void forEach(VectorMask<$Boxtype$> m, FUnCon f);
// Static factories
/**
* Returns a vector where all lane elements are set to the default
*** 111,121 ****
* @param species species of desired vector
* @return a zero vector of given species
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ zero(Species<$Boxtype$> species) {
#if[FP]
return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
$Type$.$type$To$Bitstype$Bits(0.0f), species,
((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
#else[FP]
--- 111,121 ----
* @param species species of desired vector
* @return a zero vector of given species
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
#if[FP]
return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
$Type$.$type$To$Bitstype$Bits(0.0f), species,
((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
#else[FP]
*** 131,141 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows:
* <pre>{@code
* return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
* }</pre>
*
* @param species species of desired vector
--- 131,141 ----
* 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<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
* return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
* }</pre>
*
* @param species species of desired vector
*** 145,155 ****
* @throws IndexOutOfBoundsException if {@code i < 0} or
* {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix) {
Objects.requireNonNull(a);
ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
a, ix, species,
--- 145,155 ----
* @throws IndexOutOfBoundsException if {@code i < 0} or
* {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix) {
Objects.requireNonNull(a);
ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
a, ix, species,
*** 167,177 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows:
* <pre>{@code
* return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
* }</pre>
*
* @param species species of desired vector
--- 167,177 ----
* 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<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
* <pre>{@code
* return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
* }</pre>
*
* @param species species of desired vector
*** 186,196 ****
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
* {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix, Mask<$Boxtype$> m) {
return zero(species).blend(fromByteArray(species, a, ix), m);
}
/**
* Loads a vector from an array starting at offset.
--- 186,196 ----
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
* {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix, VectorMask<$Boxtype$> m) {
return zero(species).blend(fromByteArray(species, a, ix), m);
}
/**
* Loads a vector from an array starting at offset.
*** 206,216 ****
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* {@code i > a.length - this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i){
Objects.requireNonNull(a);
i = VectorIntrinsics.checkIndex(i, a.length, species.length());
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
a, i, species,
--- 206,216 ----
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* {@code i > a.length - this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i){
Objects.requireNonNull(a);
i = VectorIntrinsics.checkIndex(i, a.length, species.length());
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
a, i, species,
*** 235,245 ****
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set {@code i > a.length - N}
*/
@ForceInline
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m) {
return zero(species).blend(fromArray(species, a, i), m);
}
/**
* Loads a vector from an array using indexes obtained from an index
--- 235,245 ----
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set {@code i > a.length - N}
*/
@ForceInline
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m) {
return zero(species).blend(fromArray(species, a, i), m);
}
/**
* Loads a vector from an array using indexes obtained from an index
*** 261,277 ****
* {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
* {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
return (($Type$Species)species).op(n -> a[i + indexMap[j + n]]);
}
#else[byteOrShort]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
Objects.requireNonNull(a);
Objects.requireNonNull(indexMap);
#if[longOrDouble]
if (species.length() == 1) {
--- 261,277 ----
* {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
* {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
return (($Type$Species)species).op(n -> a[i + indexMap[j + n]]);
}
#else[byteOrShort]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
Objects.requireNonNull(a);
Objects.requireNonNull(indexMap);
#if[longOrDouble]
if (species.length() == 1) {
*** 285,295 ****
vix = VectorIntrinsics.checkIndex(vix, a.length);
return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
a, i, indexMap, j, species,
! ($type$[] c, int idx, int[] iMap, int idy, Species<$Boxtype$> s) ->
(($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
}
#end[byteOrShort]
/**
--- 285,295 ----
vix = VectorIntrinsics.checkIndex(vix, a.length);
return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
a, i, indexMap, j, species,
! ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
(($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
}
#end[byteOrShort]
/**
*** 315,331 ****
* or for any vector lane index {@code N} where the mask at lane
* {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
return (($Type$Species)species).op(m, n -> a[i + indexMap[j + n]]);
}
#else[byteOrShort]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
// @@@ This can result in out of bounds errors for unset mask lanes
return zero(species).blend(fromArray(species, a, i, indexMap, j), m);
}
#end[byteOrShort]
--- 315,331 ----
* or for any vector lane index {@code N} where the mask at lane
* {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
return (($Type$Species)species).op(m, n -> a[i + indexMap[j + n]]);
}
#else[byteOrShort]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
// @@@ This can result in out of bounds errors for unset mask lanes
return zero(species).blend(fromArray(species, a, i, indexMap, j), m);
}
#end[byteOrShort]
*** 337,347 ****
* Bytes are composed into primitive lane elements according to the
* native byte order of the underlying platform.
* <p>
* This method behaves as if it returns the result of calling the
* byte buffer, offset, and mask accepting
! * {@link #fromByteBuffer(Species<$Boxtype$>, ByteBuffer, int, Mask)} method} as follows:
* <pre>{@code
* return this.fromByteBuffer(b, i, this.maskAllTrue())
* }</pre>
*
* @param species species of desired vector
--- 337,347 ----
* 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<$Boxtype$>, ByteBuffer, int, VectorMask)} method} as follows:
* <pre>{@code
* return this.fromByteBuffer(b, i, this.maskAllTrue())
* }</pre>
*
* @param species species of desired vector
*** 354,364 ****
* {@code this.length() * this.elementSize() / Byte.SIZE} bytes
* remaining in the byte buffer from the given offset
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix) {
if (bb.order() != ByteOrder.nativeOrder()) {
throw new IllegalArgumentException();
}
ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
--- 354,364 ----
* {@code this.length() * this.elementSize() / Byte.SIZE} bytes
* remaining in the byte buffer from the given offset
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix) {
if (bb.order() != ByteOrder.nativeOrder()) {
throw new IllegalArgumentException();
}
ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
*** 406,416 ****
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
* {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix, Mask<$Boxtype$> m) {
return zero(species).blend(fromByteBuffer(species, bb, ix), m);
}
/**
* Returns a vector where all lane elements are set to the primitive
--- 406,416 ----
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
* {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
! public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix, VectorMask<$Boxtype$> m) {
return zero(species).blend(fromByteBuffer(species, bb, ix), m);
}
/**
* Returns a vector where all lane elements are set to the primitive
*** 422,441 ****
* the primitive value {@code e}
*/
#if[FP]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ broadcast(Species<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
$Type$.$type$To$Bitstype$Bits(e), s,
((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
}
#else[FP]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ broadcast(Species<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
e, s,
((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
}
--- 422,441 ----
* the primitive value {@code e}
*/
#if[FP]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
$Type$.$type$To$Bitstype$Bits(e), s,
((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
}
#else[FP]
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
e, s,
((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
}
*** 455,465 ****
* value
* @throws IndexOutOfBoundsException if {@code es.length < this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ scalars(Species<$Boxtype$> s, $type$... es) {
Objects.requireNonNull(es);
int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
return VectorIntrinsics.load((Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
es, ix, s,
--- 455,465 ----
* value
* @throws IndexOutOfBoundsException if {@code es.length < this.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
! public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> s, $type$... es) {
Objects.requireNonNull(es);
int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
return VectorIntrinsics.load((Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
es, ix, s,
*** 475,485 ****
* @param e the value
* @return a vector where the first lane element is set to the primitive
* value {@code e}
*/
@ForceInline
! public static final $abstractvectortype$ single(Species<$Boxtype$> s, $type$ e) {
return zero(s).with(0, e);
}
/**
* Returns a vector where each lane element is set to a randomly
--- 475,485 ----
* @param e the value
* @return a vector where the first lane element is set to the primitive
* value {@code e}
*/
@ForceInline
! public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> s, $type$ e) {
return zero(s).with(0, e);
}
/**
* Returns a vector where each lane element is set to a randomly
*** 495,746 ****
* @param s species of the desired vector
* @return a vector where each lane elements is set to a randomly
* generated primitive value
*/
#if[intOrLong]
! public static $abstractvectortype$ random(Species<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> r.next$Type$());
}
#else[intOrLong]
#if[FP]
! public static $abstractvectortype$ random(Species<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> r.next$Type$());
}
#else[FP]
! public static $abstractvectortype$ random(Species<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> ($type$) r.nextInt());
}
#end[FP]
#end[intOrLong]
- /**
- * Returns a mask where each lane is set or unset according to given
- * {@code boolean} values
- * <p>
- * For each mask lane, where {@code N} is the mask lane index,
- * if the given {@code boolean} value at index {@code N} is {@code true}
- * then the mask lane at index {@code N} is set, otherwise it is unset.
- *
- * @param species mask species
- * @param bits the given {@code boolean} values
- * @return a mask where each lane is set or unset according to the given {@code boolean} value
- * @throws IndexOutOfBoundsException if {@code bits.length < species.length()}
- */
- @ForceInline
- public static Mask<$Boxtype$> maskFromValues(Species<$Boxtype$> species, boolean... bits) {
- if (species.boxType() == $Type$MaxVector.class)
- return new $Type$MaxVector.$Type$MaxMask(bits);
- switch (species.bitSize()) {
- case 64: return new $Type$64Vector.$Type$64Mask(bits);
- case 128: return new $Type$128Vector.$Type$128Mask(bits);
- case 256: return new $Type$256Vector.$Type$256Mask(bits);
- case 512: return new $Type$512Vector.$Type$512Mask(bits);
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- // @@@ This is a bad implementation -- makes lambdas capturing -- fix this
- static Mask<$Boxtype$> trueMask(Species<$Boxtype$> species) {
- if (species.boxType() == $Type$MaxVector.class)
- return $Type$MaxVector.$Type$MaxMask.TRUE_MASK;
- switch (species.bitSize()) {
- case 64: return $Type$64Vector.$Type$64Mask.TRUE_MASK;
- case 128: return $Type$128Vector.$Type$128Mask.TRUE_MASK;
- case 256: return $Type$256Vector.$Type$256Mask.TRUE_MASK;
- case 512: return $Type$512Vector.$Type$512Mask.TRUE_MASK;
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- static Mask<$Boxtype$> falseMask(Species<$Boxtype$> species) {
- if (species.boxType() == $Type$MaxVector.class)
- return $Type$MaxVector.$Type$MaxMask.FALSE_MASK;
- switch (species.bitSize()) {
- case 64: return $Type$64Vector.$Type$64Mask.FALSE_MASK;
- case 128: return $Type$128Vector.$Type$128Mask.FALSE_MASK;
- case 256: return $Type$256Vector.$Type$256Mask.FALSE_MASK;
- case 512: return $Type$512Vector.$Type$512Mask.FALSE_MASK;
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- /**
- * Loads a mask from a {@code boolean} array starting at an offset.
- * <p>
- * For each mask lane, where {@code N} is the mask lane index,
- * if the array element at index {@code ix + N} is {@code true} then the
- * mask lane at index {@code N} is set, otherwise it is unset.
- *
- * @param species mask species
- * @param bits the {@code boolean} array
- * @param ix the offset into the array
- * @return the mask loaded from a {@code boolean} array
- * @throws IndexOutOfBoundsException if {@code ix < 0}, or
- * {@code ix > bits.length - species.length()}
- */
- @ForceInline
- @SuppressWarnings("unchecked")
- public static Mask<$Boxtype$> maskFromArray(Species<$Boxtype$> species, boolean[] bits, int ix) {
- Objects.requireNonNull(bits);
- ix = VectorIntrinsics.checkIndex(ix, bits.length, species.length());
- return VectorIntrinsics.load((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
- bits, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
- bits, ix, species,
- (c, idx, s) -> (Mask<$Boxtype$>) (($Type$Species)s).opm(n -> c[idx + n]));
- }
-
- /**
- * Returns a mask where all lanes are set.
- *
- * @param species mask species
- * @return a mask where all lanes are set
- */
- @ForceInline
- @SuppressWarnings("unchecked")
- public static Mask<$Boxtype$> maskAllTrue(Species<$Boxtype$> species) {
- return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
- ($bitstype$)-1, species,
- ((z, s) -> trueMask(s)));
- }
-
- /**
- * Returns a mask where all lanes are unset.
- *
- * @param species mask species
- * @return a mask where all lanes are unset
- */
- @ForceInline
- @SuppressWarnings("unchecked")
- public static Mask<$Boxtype$> maskAllFalse(Species<$Boxtype$> species) {
- return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(),
- 0, species,
- ((z, s) -> falseMask(s)));
- }
-
- /**
- * Returns a shuffle of mapped indexes where each lane element is
- * the result of applying a mapping function to the corresponding lane
- * index.
- * <p>
- * Care should be taken to ensure Shuffle values produced from this
- * method are consumed as constants to ensure optimal generation of
- * code. For example, values held in static final fields or values
- * held in loop constant local variables.
- * <p>
- * This method behaves as if a shuffle is created from an array of
- * mapped indexes as follows:
- * <pre>{@code
- * int[] a = new int[species.length()];
- * for (int i = 0; i < a.length; i++) {
- * a[i] = f.applyAsInt(i);
- * }
- * return this.shuffleFromValues(a);
- * }</pre>
- *
- * @param species shuffle species
- * @param f the lane index mapping function
- * @return a shuffle of mapped indexes
- */
- @ForceInline
- public static Shuffle<$Boxtype$> shuffle(Species<$Boxtype$> species, IntUnaryOperator f) {
- if (species.boxType() == $Type$MaxVector.class)
- return new $Type$MaxVector.$Type$MaxShuffle(f);
- switch (species.bitSize()) {
- case 64: return new $Type$64Vector.$Type$64Shuffle(f);
- case 128: return new $Type$128Vector.$Type$128Shuffle(f);
- case 256: return new $Type$256Vector.$Type$256Shuffle(f);
- case 512: return new $Type$512Vector.$Type$512Shuffle(f);
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- /**
- * Returns a shuffle where each lane element is the value of its
- * corresponding lane index.
- * <p>
- * This method behaves as if a shuffle is created from an identity
- * index mapping function as follows:
- * <pre>{@code
- * return this.shuffle(i -> i);
- * }</pre>
- *
- * @param species shuffle species
- * @return a shuffle of lane indexes
- */
- @ForceInline
- public static Shuffle<$Boxtype$> shuffleIota(Species<$Boxtype$> species) {
- if (species.boxType() == $Type$MaxVector.class)
- return new $Type$MaxVector.$Type$MaxShuffle(AbstractShuffle.IDENTITY);
- switch (species.bitSize()) {
- case 64: return new $Type$64Vector.$Type$64Shuffle(AbstractShuffle.IDENTITY);
- case 128: return new $Type$128Vector.$Type$128Shuffle(AbstractShuffle.IDENTITY);
- case 256: return new $Type$256Vector.$Type$256Shuffle(AbstractShuffle.IDENTITY);
- case 512: return new $Type$512Vector.$Type$512Shuffle(AbstractShuffle.IDENTITY);
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- /**
- * Returns a shuffle where each lane element is set to a given
- * {@code int} value logically AND'ed by the species length minus one.
- * <p>
- * For each shuffle lane, where {@code N} is the shuffle lane index, the
- * the {@code int} value at index {@code N} logically AND'ed by
- * {@code species.length() - 1} is placed into the resulting shuffle at
- * lane index {@code N}.
- *
- * @param species shuffle species
- * @param ixs the given {@code int} values
- * @return a shuffle where each lane element is set to a given
- * {@code int} value
- * @throws IndexOutOfBoundsException if the number of int values is
- * {@code < species.length()}
- */
- @ForceInline
- public static Shuffle<$Boxtype$> shuffleFromValues(Species<$Boxtype$> species, int... ixs) {
- if (species.boxType() == $Type$MaxVector.class)
- return new $Type$MaxVector.$Type$MaxShuffle(ixs);
- switch (species.bitSize()) {
- case 64: return new $Type$64Vector.$Type$64Shuffle(ixs);
- case 128: return new $Type$128Vector.$Type$128Shuffle(ixs);
- case 256: return new $Type$256Vector.$Type$256Shuffle(ixs);
- case 512: return new $Type$512Vector.$Type$512Shuffle(ixs);
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
- /**
- * Loads a shuffle from an {@code int} array starting at an offset.
- * <p>
- * For each shuffle lane, where {@code N} is the shuffle lane index, the
- * array element at index {@code i + N} logically AND'ed by
- * {@code species.length() - 1} is placed into the resulting shuffle at lane
- * index {@code N}.
- *
- * @param species shuffle species
- * @param ixs the {@code int} array
- * @param i the offset into the array
- * @return a shuffle loaded from the {@code int} array
- * @throws IndexOutOfBoundsException if {@code i < 0}, or
- * {@code i > a.length - species.length()}
- */
- @ForceInline
- public static Shuffle<$Boxtype$> shuffleFromArray(Species<$Boxtype$> species, int[] ixs, int i) {
- if (species.boxType() == $Type$MaxVector.class)
- return new $Type$MaxVector.$Type$MaxShuffle(ixs, i);
- switch (species.bitSize()) {
- case 64: return new $Type$64Vector.$Type$64Shuffle(ixs, i);
- case 128: return new $Type$128Vector.$Type$128Shuffle(ixs, i);
- case 256: return new $Type$256Vector.$Type$256Shuffle(ixs, i);
- case 512: return new $Type$512Vector.$Type$512Shuffle(ixs, i);
- default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
- }
- }
-
// Ops
@Override
public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
--- 495,522 ----
* @param s species of the desired vector
* @return a vector where each lane elements is set to a randomly
* generated primitive value
*/
#if[intOrLong]
! public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> r.next$Type$());
}
#else[intOrLong]
#if[FP]
! public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> r.next$Type$());
}
#else[FP]
! public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
ThreadLocalRandom r = ThreadLocalRandom.current();
return (($Type$Species)s).op(i -> ($type$) r.nextInt());
}
#end[FP]
#end[intOrLong]
// Ops
@Override
public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
*** 755,765 ****
* scalar
*/
public abstract $abstractvectortype$ add($type$ s);
@Override
! public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Adds this vector to broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
--- 531,541 ----
* scalar
*/
public abstract $abstractvectortype$ add($type$ s);
@Override
! public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Adds this vector to broadcast of an input scalar,
* selecting lane elements controlled by a mask.
* <p>
*** 769,779 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of adding this vector to the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ add($type$ s, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
/**
--- 545,555 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of adding this vector to the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ add($type$ s, VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
/**
*** 787,797 ****
* scalar from this vector
*/
public abstract $abstractvectortype$ sub($type$ s);
@Override
! public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Subtracts the broadcast of an input scalar from this vector, selecting
* lane elements controlled by a mask.
* <p>
--- 563,573 ----
* scalar from this vector
*/
public abstract $abstractvectortype$ sub($type$ s);
@Override
! public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Subtracts the broadcast of an input scalar from this vector, selecting
* lane elements controlled by a mask.
* <p>
*** 801,811 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of subtracting the broadcast of an input
* scalar from this vector
*/
! public abstract $abstractvectortype$ sub($type$ s, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
/**
--- 577,587 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of subtracting the broadcast of an input
* scalar from this vector
*/
! public abstract $abstractvectortype$ sub($type$ s, VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
/**
*** 819,829 ****
* input scalar
*/
public abstract $abstractvectortype$ mul($type$ s);
@Override
! public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Multiplies this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
--- 595,605 ----
* input scalar
*/
public abstract $abstractvectortype$ mul($type$ s);
@Override
! public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Multiplies this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
*** 833,861 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of multiplying this vector with the broadcast of an
* input scalar
*/
! public abstract $abstractvectortype$ mul($type$ s, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ neg();
@Override
! public abstract $abstractvectortype$ neg(Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ abs();
@Override
! public abstract $abstractvectortype$ abs(Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
@Override
! public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Returns the minimum of this vector and the broadcast of an input scalar.
* <p>
* This is a vector binary operation where the operation
--- 609,637 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of multiplying this vector with the broadcast of an
* input scalar
*/
! public abstract $abstractvectortype$ mul($type$ s, VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ neg();
@Override
! public abstract $abstractvectortype$ neg(VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ abs();
@Override
! public abstract $abstractvectortype$ abs(VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
@Override
! public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Returns the minimum of this vector and the broadcast of an input scalar.
* <p>
* This is a vector binary operation where the operation
*** 868,878 ****
@Override
public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
@Override
! public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Returns the maximum of this vector and the broadcast of an input scalar.
* <p>
* This is a vector binary operation where the operation
--- 644,654 ----
@Override
public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
@Override
! public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Returns the maximum of this vector and the broadcast of an input scalar.
* <p>
* This is a vector binary operation where the operation
*** 882,892 ****
* @return the maximum of this vector and the broadcast of an input scalar
*/
public abstract $abstractvectortype$ max($type$ s);
@Override
! public abstract Mask<$Boxtype$> equal(Vector<$Boxtype$> v);
/**
* 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
--- 658,668 ----
* @return the maximum of this vector and the broadcast of an input scalar
*/
public abstract $abstractvectortype$ max($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> equal(Vector<$Boxtype$> v);
/**
* Tests if this vector is equal to the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive equals
*** 894,907 ****
*
* @param s the input scalar
* @return the result mask of testing if this vector is equal to the
* broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> equal($type$ s);
@Override
! public abstract Mask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
/**
* Tests if this vector is not equal to the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive not equals
--- 670,683 ----
*
* @param s the input scalar
* @return the result mask of testing if this vector is equal to the
* broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> equal($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
/**
* Tests if this vector is not equal to the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive not equals
*** 909,922 ****
*
* @param s the input scalar
* @return the result mask of testing if this vector is not equal to the
* broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> notEqual($type$ s);
@Override
! public abstract Mask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is less than the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive less than
--- 685,698 ----
*
* @param s the input scalar
* @return the result mask of testing if this vector is not equal to the
* broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> notEqual($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is less than the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive less than
*** 924,937 ****
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than the
* broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> lessThan($type$ s);
@Override
! public abstract Mask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is less or equal to the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive less than
--- 700,713 ----
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than the
* broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> lessThan($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is less or equal to the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive less than
*** 939,952 ****
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than or equal
* to the broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> lessThanEq($type$ s);
@Override
! public abstract Mask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive greater than
--- 715,728 ----
*
* @param s the input scalar
* @return the mask result of testing if this vector is less than or equal
* to the broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> lessThanEq($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than the broadcast of an input scalar.
* <p>
* This is a vector binary test operation where the primitive greater than
*** 954,967 ****
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than the
* broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> greaterThan($type$ s);
@Override
! public abstract Mask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than or equal to the broadcast of an
* input scalar.
* <p>
--- 730,743 ----
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than the
* broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> greaterThan($type$ s);
@Override
! public abstract VectorMask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than or equal to the broadcast of an
* input scalar.
* <p>
*** 970,983 ****
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than or
* equal to the broadcast of an input scalar
*/
! public abstract Mask<$Boxtype$> greaterThanEq($type$ s);
@Override
! public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Blends the lane elements of this vector with those of the broadcast of an
* input scalar, selecting lanes controlled by a mask.
* <p>
--- 746,759 ----
*
* @param s the input scalar
* @return the mask result of testing if this vector is greater than or
* equal to the broadcast of an input scalar
*/
! public abstract VectorMask<$Boxtype$> greaterThanEq($type$ s);
@Override
! public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Blends the lane elements of this vector with those of the broadcast of an
* input scalar, selecting lanes controlled by a mask.
* <p>
*** 990,1010 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of blending the lane elements of this vector with
* those of the broadcast of an input scalar
*/
! public abstract $abstractvectortype$ blend($type$ s, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
! Shuffle<$Boxtype$> s, Mask<$Boxtype$> m);
@Override
! public abstract $abstractvectortype$ rearrange(Shuffle<$Boxtype$> m);
@Override
! public abstract $abstractvectortype$ reshape(Species<$Boxtype$> s);
@Override
public abstract $abstractvectortype$ rotateEL(int i);
@Override
--- 766,786 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of blending the lane elements of this vector with
* those of the broadcast of an input scalar
*/
! public abstract $abstractvectortype$ blend($type$ s, VectorMask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
! VectorShuffle<$Boxtype$> s, VectorMask<$Boxtype$> m);
@Override
! public abstract $abstractvectortype$ rearrange(VectorShuffle<$Boxtype$> m);
@Override
! public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
@Override
public abstract $abstractvectortype$ rotateEL(int i);
@Override
*** 1049,1059 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of dividing this vector by the input vector
*/
! public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Divides this vector by the broadcast of an input scalar, selecting lane
* elements controlled by a mask.
* <p>
--- 825,835 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of dividing this vector by the input vector
*/
! public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Divides this vector by the broadcast of an input scalar, selecting lane
* elements controlled by a mask.
* <p>
*** 1063,1073 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of dividing this vector by the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ div($type$ s, Mask<$Boxtype$> m);
/**
* Calculates the square root of this vector.
* <p>
* This is a vector unary operation where the {@link Math#sqrt} operation
--- 839,849 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the result of dividing this vector by the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ div($type$ s, VectorMask<$Boxtype$> m);
/**
* Calculates the square root of this vector.
* <p>
* This is a vector unary operation where the {@link Math#sqrt} operation
*** 1085,1095 ****
* is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the square root of this vector
*/
! public $abstractvectortype$ sqrt(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
}
/**
* Calculates the trigonometric tangent of this vector.
--- 861,871 ----
* is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the square root of this vector
*/
! public $abstractvectortype$ sqrt(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
}
/**
* Calculates the trigonometric tangent of this vector.
*** 1116,1126 ****
* described in {@link $abstractvectortype$#tan}
*
* @param m the mask controlling lane selection
* @return the tangent of this vector
*/
! public $abstractvectortype$ tan(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
}
/**
* Calculates the hyperbolic tangent of this vector.
--- 892,902 ----
* described in {@link $abstractvectortype$#tan}
*
* @param m the mask controlling lane selection
* @return the tangent of this vector
*/
! public $abstractvectortype$ tan(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
}
/**
* Calculates the hyperbolic tangent of this vector.
*** 1147,1157 ****
* described in {@link $abstractvectortype$#tanh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic tangent of this vector
*/
! public $abstractvectortype$ tanh(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
}
/**
* Calculates the trigonometric sine of this vector.
--- 923,933 ----
* described in {@link $abstractvectortype$#tanh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic tangent of this vector
*/
! public $abstractvectortype$ tanh(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
}
/**
* Calculates the trigonometric sine of this vector.
*** 1178,1188 ****
* described in {@link $abstractvectortype$#sin}
*
* @param m the mask controlling lane selection
* @return the sine of this vector
*/
! public $abstractvectortype$ sin(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
}
/**
* Calculates the hyperbolic sine of this vector.
--- 954,964 ----
* described in {@link $abstractvectortype$#sin}
*
* @param m the mask controlling lane selection
* @return the sine of this vector
*/
! public $abstractvectortype$ sin(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
}
/**
* Calculates the hyperbolic sine of this vector.
*** 1209,1219 ****
* described in {@link $abstractvectortype$#sinh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic sine of this vector
*/
! public $abstractvectortype$ sinh(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
}
/**
* Calculates the trigonometric cosine of this vector.
--- 985,995 ----
* described in {@link $abstractvectortype$#sinh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic sine of this vector
*/
! public $abstractvectortype$ sinh(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
}
/**
* Calculates the trigonometric cosine of this vector.
*** 1240,1250 ****
* described in {@link $abstractvectortype$#cos}
*
* @param m the mask controlling lane selection
* @return the cosine of this vector
*/
! public $abstractvectortype$ cos(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
}
/**
* Calculates the hyperbolic cosine of this vector.
--- 1016,1026 ----
* described in {@link $abstractvectortype$#cos}
*
* @param m the mask controlling lane selection
* @return the cosine of this vector
*/
! public $abstractvectortype$ cos(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
}
/**
* Calculates the hyperbolic cosine of this vector.
*** 1271,1281 ****
* described in {@link $abstractvectortype$#cosh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic cosine of this vector
*/
! public $abstractvectortype$ cosh(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
}
/**
* Calculates the arc sine of this vector.
--- 1047,1057 ----
* described in {@link $abstractvectortype$#cosh}
*
* @param m the mask controlling lane selection
* @return the hyperbolic cosine of this vector
*/
! public $abstractvectortype$ cosh(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
}
/**
* Calculates the arc sine of this vector.
*** 1302,1312 ****
* described in {@link $abstractvectortype$#asin}
*
* @param m the mask controlling lane selection
* @return the arc sine of this vector
*/
! public $abstractvectortype$ asin(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
}
/**
* Calculates the arc cosine of this vector.
--- 1078,1088 ----
* described in {@link $abstractvectortype$#asin}
*
* @param m the mask controlling lane selection
* @return the arc sine of this vector
*/
! public $abstractvectortype$ asin(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
}
/**
* Calculates the arc cosine of this vector.
*** 1333,1343 ****
* described in {@link $abstractvectortype$#acos}
*
* @param m the mask controlling lane selection
* @return the arc cosine of this vector
*/
! public $abstractvectortype$ acos(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
}
/**
* Calculates the arc tangent of this vector.
--- 1109,1119 ----
* described in {@link $abstractvectortype$#acos}
*
* @param m the mask controlling lane selection
* @return the arc cosine of this vector
*/
! public $abstractvectortype$ acos(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
}
/**
* Calculates the arc tangent of this vector.
*** 1364,1374 ****
* described in {@link $abstractvectortype$#atan}
*
* @param m the mask controlling lane selection
* @return the arc tangent of this vector
*/
! public $abstractvectortype$ atan(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.atan((double) a));
}
/**
* Calculates the arc tangent of this vector divided by an input vector.
--- 1140,1150 ----
* described in {@link $abstractvectortype$#atan}
*
* @param m the mask controlling lane selection
* @return the arc tangent of this vector
*/
! public $abstractvectortype$ atan(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.atan((double) a));
}
/**
* Calculates the arc tangent of this vector divided by an input vector.
*** 1414,1424 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the arc tangent of this vector divided by the input vector
*/
! public $abstractvectortype$ atan2(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
}
/**
* Calculates the arc tangent of this vector divided by the broadcast of an
--- 1190,1200 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the arc tangent of this vector divided by the input vector
*/
! public $abstractvectortype$ atan2(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
}
/**
* Calculates the arc tangent of this vector divided by the broadcast of an
*** 1429,1439 ****
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the arc tangent of this vector over the input vector
*/
! public abstract $abstractvectortype$ atan2($type$ s, Mask<$Boxtype$> m);
/**
* Calculates the cube root of this vector.
* <p>
* This is a vector unary operation with same semantic definition as
--- 1205,1215 ----
*
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the arc tangent of this vector over the input vector
*/
! public abstract $abstractvectortype$ atan2($type$ s, VectorMask<$Boxtype$> m);
/**
* Calculates the cube root of this vector.
* <p>
* This is a vector unary operation with same semantic definition as
*** 1458,1468 ****
* described in {@link $abstractvectortype$#cbrt}
*
* @param m the mask controlling lane selection
* @return the cube root of this vector
*/
! public $abstractvectortype$ cbrt(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
}
/**
* Calculates the natural logarithm of this vector.
--- 1234,1244 ----
* described in {@link $abstractvectortype$#cbrt}
*
* @param m the mask controlling lane selection
* @return the cube root of this vector
*/
! public $abstractvectortype$ cbrt(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
}
/**
* Calculates the natural logarithm of this vector.
*** 1489,1499 ****
* described in {@link $abstractvectortype$#log}
*
* @param m the mask controlling lane selection
* @return the natural logarithm of this vector
*/
! public $abstractvectortype$ log(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log((double) a));
}
/**
* Calculates the base 10 logarithm of this vector.
--- 1265,1275 ----
* described in {@link $abstractvectortype$#log}
*
* @param m the mask controlling lane selection
* @return the natural logarithm of this vector
*/
! public $abstractvectortype$ log(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log((double) a));
}
/**
* Calculates the base 10 logarithm of this vector.
*** 1520,1530 ****
* described in {@link $abstractvectortype$#log10}
*
* @param m the mask controlling lane selection
* @return the base 10 logarithm of this vector
*/
! public $abstractvectortype$ log10(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log10((double) a));
}
/**
* Calculates the natural logarithm of the sum of this vector and the
--- 1296,1306 ----
* described in {@link $abstractvectortype$#log10}
*
* @param m the mask controlling lane selection
* @return the base 10 logarithm of this vector
*/
! public $abstractvectortype$ log10(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log10((double) a));
}
/**
* Calculates the natural logarithm of the sum of this vector and the
*** 1554,1564 ****
*
* @param m the mask controlling lane selection
* @return the natural logarithm of the sum of this vector and the broadcast
* of {@code 1}
*/
! public $abstractvectortype$ log1p(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log1p((double) a));
}
/**
* Calculates this vector raised to the power of an input vector.
--- 1330,1340 ----
*
* @param m the mask controlling lane selection
* @return the natural logarithm of the sum of this vector and the broadcast
* of {@code 1}
*/
! public $abstractvectortype$ log1p(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log1p((double) a));
}
/**
* Calculates this vector raised to the power of an input vector.
*** 1605,1615 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return this vector raised to the power of an input vector
*/
! public $abstractvectortype$ pow(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.pow((double) a, (double) b));
}
/**
* Calculates this vector raised to the power of the broadcast of an input
--- 1381,1391 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return this vector raised to the power of an input vector
*/
! public $abstractvectortype$ pow(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.pow((double) a, (double) b));
}
/**
* Calculates this vector raised to the power of the broadcast of an input
*** 1621,1631 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return this vector raised to the power of the broadcast of an input
* scalar.
*/
! public abstract $abstractvectortype$ pow($type$ s, Mask<$Boxtype$> m);
/**
* Calculates the broadcast of Euler's number {@code e} raised to the power
* of this vector.
* <p>
--- 1397,1407 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return this vector raised to the power of the broadcast of an input
* scalar.
*/
! public abstract $abstractvectortype$ pow($type$ s, VectorMask<$Boxtype$> m);
/**
* Calculates the broadcast of Euler's number {@code e} raised to the power
* of this vector.
* <p>
*** 1653,1663 ****
*
* @param m the mask controlling lane selection
* @return the broadcast of Euler's number {@code e} raised to the power of
* this vector
*/
! public $abstractvectortype$ exp(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.exp((double) a));
}
/**
* Calculates the broadcast of Euler's number {@code e} raised to the power
--- 1429,1439 ----
*
* @param m the mask controlling lane selection
* @return the broadcast of Euler's number {@code e} raised to the power of
* this vector
*/
! public $abstractvectortype$ exp(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.exp((double) a));
}
/**
* Calculates the broadcast of Euler's number {@code e} raised to the power
*** 1698,1708 ****
*
* @param m the mask controlling lane selection
* @return the broadcast of Euler's number {@code e} raised to the power of
* this vector minus the broadcast of {@code -1}
*/
! public $abstractvectortype$ expm1(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.expm1((double) a));
}
/**
* Calculates the product of this vector and a first input vector summed
--- 1474,1484 ----
*
* @param m the mask controlling lane selection
* @return the broadcast of Euler's number {@code e} raised to the power of
* this vector minus the broadcast of {@code -1}
*/
! public $abstractvectortype$ expm1(VectorMask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.expm1((double) a));
}
/**
* Calculates the product of this vector and a first input vector summed
*** 1757,1767 ****
* @param v2 the second input vector
* @param m the mask controlling lane selection
* @return the product of this vector and the first input vector summed with
* the second input vector
*/
! public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m) {
return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
}
/**
* Calculates the product of this vector and the broadcast of a first input
--- 1533,1543 ----
* @param v2 the second input vector
* @param m the mask controlling lane selection
* @return the product of this vector and the first input vector summed with
* the second input vector
*/
! public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
}
/**
* Calculates the product of this vector and the broadcast of a first input
*** 1779,1789 ****
* @param s2 the second input scalar
* @param m the mask controlling lane selection
* @return the product of this vector and the broadcast of a first input
* scalar summed with the broadcast of a second input scalar
*/
! public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, Mask<$Boxtype$> m);
/**
* Calculates square root of the sum of the squares of this vector and an
* input vector.
* More specifically as if the following (ignoring any differences in
--- 1555,1565 ----
* @param s2 the second input scalar
* @param m the mask controlling lane selection
* @return the product of this vector and the broadcast of a first input
* scalar summed with the broadcast of a second input scalar
*/
! public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, VectorMask<$Boxtype$> m);
/**
* Calculates square root of the sum of the squares of this vector and an
* input vector.
* More specifically as if the following (ignoring any differences in
*** 1846,1856 ****
* @param v the input vector
* @param m the mask controlling lane selection
* @return square root of the sum of the squares of this vector and an input
* vector
*/
! public $abstractvectortype$ hypot(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
}
/**
* Calculates square root of the sum of the squares of this vector and the
--- 1622,1632 ----
* @param v the input vector
* @param m the mask controlling lane selection
* @return square root of the sum of the squares of this vector and an input
* vector
*/
! public $abstractvectortype$ hypot(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
}
/**
* Calculates square root of the sum of the squares of this vector and the
*** 1868,1878 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return square root of the sum of the squares of this vector and the
* broadcast of an input scalar
*/
! public abstract $abstractvectortype$ hypot($type$ s, Mask<$Boxtype$> m);
#end[FP]
#if[BITWISE]
/**
--- 1644,1654 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return square root of the sum of the squares of this vector and the
* broadcast of an input scalar
*/
! public abstract $abstractvectortype$ hypot($type$ s, VectorMask<$Boxtype$> m);
#end[FP]
#if[BITWISE]
/**
*** 1907,1917 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the input vector
*/
! public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Bitwise ANDs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
--- 1683,1693 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the input vector
*/
! public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Bitwise ANDs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
*** 1921,1931 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ and($type$ s, Mask<$Boxtype$> m);
/**
* Bitwise ORs this vector with an input vector.
* <p>
* This is a vector binary operation where the primitive bitwise OR
--- 1697,1707 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise AND of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ and($type$ s, VectorMask<$Boxtype$> m);
/**
* Bitwise ORs this vector with an input vector.
* <p>
* This is a vector binary operation where the primitive bitwise OR
*** 1957,1967 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the input vector
*/
! public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Bitwise ORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
--- 1733,1743 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the input vector
*/
! public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Bitwise ORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
*** 1971,1981 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ or($type$ s, Mask<$Boxtype$> m);
/**
* Bitwise XORs this vector with an input vector.
* <p>
* This is a vector binary operation where the primitive bitwise XOR
--- 1747,1757 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise OR of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ or($type$ s, VectorMask<$Boxtype$> m);
/**
* Bitwise XORs this vector with an input vector.
* <p>
* This is a vector binary operation where the primitive bitwise XOR
*** 2007,2017 ****
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the input vector
*/
! public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Bitwise XORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
--- 1783,1793 ----
*
* @param v the input vector
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the input vector
*/
! public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
/**
* Bitwise XORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
* <p>
*** 2021,2031 ****
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ xor($type$ s, Mask<$Boxtype$> m);
/**
* Bitwise NOTs this vector.
* <p>
* This is a vector unary operation where the primitive bitwise NOT
--- 1797,1807 ----
* @param s the input scalar
* @param m the mask controlling lane selection
* @return the bitwise XOR of this vector with the broadcast of an input
* scalar
*/
! public abstract $abstractvectortype$ xor($type$ s, VectorMask<$Boxtype$> m);
/**
* Bitwise NOTs this vector.
* <p>
* This is a vector unary operation where the primitive bitwise NOT
*** 2042,2052 ****
* operation ({@code ~}) is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the bitwise NOT of this vector
*/
! public abstract $abstractvectortype$ not(Mask<$Boxtype$> m);
#if[byte]
/**
* Logically left shifts this vector by the broadcast of an input scalar.
* <p>
--- 1818,1828 ----
* operation ({@code ~}) is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the bitwise NOT of this vector
*/
! public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
#if[byte]
/**
* Logically left shifts this vector by the broadcast of an input scalar.
* <p>
*** 2140,2150 ****
* @param m the mask controlling lane selection
* @return the result of logically left shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ shiftL(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically left shifts this vector by an input vector.
* <p>
--- 1916,1926 ----
* @param m the mask controlling lane selection
* @return the result of logically left shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ shiftL(int s, VectorMask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically left shifts this vector by an input vector.
* <p>
*** 2167,2177 ****
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of logically left shifting this vector by the input
* vector
*/
! public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a << b));
}
#end[intOrLong]
// logical, or unsigned, shift right
--- 1943,1953 ----
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of logically left shifting this vector by the input
* vector
*/
! public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a << b));
}
#end[intOrLong]
// logical, or unsigned, shift right
*** 2276,2286 ****
* @param m the mask controlling lane selection
* @return the result of logically right shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ shiftR(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically right shifts (or unsigned right shifts) this vector by an
* input vector.
--- 2052,2062 ----
* @param m the mask controlling lane selection
* @return the result of logically right shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ shiftR(int s, VectorMask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically right shifts (or unsigned right shifts) this vector by an
* input vector.
*** 2304,2314 ****
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of logically right shifting this vector by the
* input vector
*/
! public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
}
#end[intOrLong]
#if[byte]
--- 2080,2090 ----
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of logically right shifting this vector by the
* input vector
*/
! public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
}
#end[intOrLong]
#if[byte]
*** 2411,2421 ****
* @param m the mask controlling lane selection
* @return the result of arithmetically right shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ aShiftR(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Arithmetically right shifts (or signed right shifts) this vector by an
* input vector.
--- 2187,2197 ----
* @param m the mask controlling lane selection
* @return the result of arithmetically right shifting this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
! public abstract $abstractvectortype$ aShiftR(int s, VectorMask<$Boxtype$> m);
#if[intOrLong]
/**
* Arithmetically right shifts (or signed right shifts) this vector by an
* input vector.
*** 2439,2449 ****
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of arithmetically right shifting this vector by the
* input vector
*/
! public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
}
/**
* Rotates left this vector by the broadcast of an input scalar.
--- 2215,2225 ----
* @param v the input vector
* @param m the mask controlling lane selection
* @return the result of arithmetically right shifting this vector by the
* input vector
*/
! public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
}
/**
* Rotates left this vector by the broadcast of an input scalar.
*** 2477,2487 ****
* @param m the mask controlling lane selection
* @return the result of rotating left this vector by the broadcast of an
* input scalar
*/
@ForceInline
! public final $abstractvectortype$ rotateL(int s, Mask<$Boxtype$> m) {
return shiftL(s, m).or(shiftR(-s, m), m);
}
/**
* Rotates right this vector by the broadcast of an input scalar.
--- 2253,2263 ----
* @param m the mask controlling lane selection
* @return the result of rotating left this vector by the broadcast of an
* input scalar
*/
@ForceInline
! public final $abstractvectortype$ rotateL(int s, VectorMask<$Boxtype$> m) {
return shiftL(s, m).or(shiftR(-s, m), m);
}
/**
* Rotates right this vector by the broadcast of an input scalar.
*** 2515,2541 ****
* @param m the mask controlling lane selection
* @return the result of rotating right this vector by the broadcast of an
* input scalar
*/
@ForceInline
! public final $abstractvectortype$ rotateR(int s, Mask<$Boxtype$> m) {
return shiftR(s, m).or(shiftL(-s, m), m);
}
#end[intOrLong]
#end[BITWISE]
@Override
public abstract void intoByteArray(byte[] a, int ix);
@Override
! public abstract void intoByteArray(byte[] a, int ix, Mask<$Boxtype$> m);
@Override
public abstract void intoByteBuffer(ByteBuffer bb, int ix);
@Override
! public abstract void intoByteBuffer(ByteBuffer bb, int ix, Mask<$Boxtype$> m);
// Type specific horizontal reductions
/**
* Adds all lane elements of this vector.
--- 2291,2317 ----
* @param m the mask controlling lane selection
* @return the result of rotating right this vector by the broadcast of an
* input scalar
*/
@ForceInline
! public final $abstractvectortype$ rotateR(int s, VectorMask<$Boxtype$> m) {
return shiftR(s, m).or(shiftL(-s, m), m);
}
#end[intOrLong]
#end[BITWISE]
@Override
public abstract void intoByteArray(byte[] a, int ix);
@Override
! public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
@Override
public abstract void intoByteBuffer(ByteBuffer bb, int ix);
@Override
! public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<$Boxtype$> m);
// Type specific horizontal reductions
/**
* Adds all lane elements of this vector.
*** 2587,2597 ****
#end[FP]
*
* @param m the mask controlling lane selection
* @return the addition of the selected lane elements of this vector
*/
! public abstract $type$ addAll(Mask<$Boxtype$> m);
/**
* Multiplies all lane elements of this vector.
* <p>
#if[FP]
--- 2363,2373 ----
#end[FP]
*
* @param m the mask controlling lane selection
* @return the addition of the selected lane elements of this vector
*/
! public abstract $type$ addAll(VectorMask<$Boxtype$> m);
/**
* Multiplies all lane elements of this vector.
* <p>
#if[FP]
*** 2639,2649 ****
#end[FP]
*
* @param m the mask controlling lane selection
* @return the multiplication of all the lane elements of this vector
*/
! public abstract $type$ mulAll(Mask<$Boxtype$> m);
/**
* Returns the minimum lane element of this vector.
* <p>
* This is an associative vector reduction operation where the operation
--- 2415,2425 ----
#end[FP]
*
* @param m the mask controlling lane selection
* @return the multiplication of all the lane elements of this vector
*/
! public abstract $type$ mulAll(VectorMask<$Boxtype$> m);
/**
* Returns the minimum lane element of this vector.
* <p>
* This is an associative vector reduction operation where the operation
*** 2673,2683 ****
#end[FP]
*
* @param m the mask controlling lane selection
* @return the minimum lane element of this vector
*/
! public abstract $type$ minAll(Mask<$Boxtype$> m);
/**
* Returns the maximum lane element of this vector.
* <p>
* This is an associative vector reduction operation where the operation
--- 2449,2459 ----
#end[FP]
*
* @param m the mask controlling lane selection
* @return the minimum lane element of this vector
*/
! public abstract $type$ minAll(VectorMask<$Boxtype$> m);
/**
* Returns the maximum lane element of this vector.
* <p>
* This is an associative vector reduction operation where the operation
*** 2707,2717 ****
#end[FP]
*
* @param m the mask controlling lane selection
* @return the maximum lane element of this vector
*/
! public abstract $type$ maxAll(Mask<$Boxtype$> m);
#if[BITWISE]
/**
* Logically ORs all lane elements of this vector.
* <p>
--- 2483,2493 ----
#end[FP]
*
* @param m the mask controlling lane selection
* @return the maximum lane element of this vector
*/
! public abstract $type$ maxAll(VectorMask<$Boxtype$> m);
#if[BITWISE]
/**
* Logically ORs all lane elements of this vector.
* <p>
*** 2732,2742 ****
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical OR all the lane elements of this vector
*/
! public abstract $type$ orAll(Mask<$Boxtype$> m);
/**
* Logically ANDs all lane elements of this vector.
* <p>
* This is an associative vector reduction operation where the logical AND
--- 2508,2518 ----
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical OR all the lane elements of this vector
*/
! public abstract $type$ orAll(VectorMask<$Boxtype$> m);
/**
* Logically ANDs all lane elements of this vector.
* <p>
* This is an associative vector reduction operation where the logical AND
*** 2756,2766 ****
* and the identity value is {@code -1}.
*
* @param m the mask controlling lane selection
* @return the logical AND all the lane elements of this vector
*/
! public abstract $type$ andAll(Mask<$Boxtype$> m);
/**
* Logically XORs all lane elements of this vector.
* <p>
* This is an associative vector reduction operation where the logical XOR
--- 2532,2542 ----
* and the identity value is {@code -1}.
*
* @param m the mask controlling lane selection
* @return the logical AND all the lane elements of this vector
*/
! public abstract $type$ andAll(VectorMask<$Boxtype$> m);
/**
* Logically XORs all lane elements of this vector.
* <p>
* This is an associative vector reduction operation where the logical XOR
*** 2780,2790 ****
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical XOR all the lane elements of this vector
*/
! public abstract $type$ xorAll(Mask<$Boxtype$> m);
#end[BITWISE]
// Type specific accessors
/**
--- 2556,2566 ----
* and the identity value is {@code 0}.
*
* @param m the mask controlling lane selection
* @return the logical XOR all the lane elements of this vector
*/
! public abstract $type$ xorAll(VectorMask<$Boxtype$> m);
#end[BITWISE]
// Type specific accessors
/**
*** 2863,2873 ****
* @param m the mask
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set {@code i >= a.length - N}
*/
! public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m);
/**
* Stores this vector into an array using indexes obtained from an index
* map.
* <p>
--- 2639,2649 ----
* @param m the mask
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set {@code i >= a.length - N}
*/
! public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m);
/**
* Stores this vector into an array using indexes obtained from an index
* map.
* <p>
*** 2915,2986 ****
* or for any vector lane index {@code N} where the mask at lane
* {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
}
#else[byteOrShort]
! public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j);
#end[byteOrShort]
// Species
@Override
! public abstract Species<$Boxtype$> species();
/**
! * Class representing {@link $abstractvectortype$}'s of the same {@link Vector.Shape Shape}.
*/
! static final class $Type$Species extends Vector.AbstractSpecies<$Boxtype$> {
final Function<$type$[], $Type$Vector> vectorFactory;
- final Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory;
! private $Type$Species(Vector.Shape shape,
Class<?> boxType,
Class<?> maskType,
Function<$type$[], $Type$Vector> vectorFactory,
! Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory) {
! super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType);
this.vectorFactory = vectorFactory;
- this.maskFactory = maskFactory;
}
interface FOp {
$type$ apply(int i);
}
- interface FOpm {
- boolean apply(int i);
- }
-
$Type$Vector op(FOp f) {
$type$[] res = new $type$[length()];
for (int i = 0; i < length(); i++) {
res[i] = f.apply(i);
}
return vectorFactory.apply(res);
}
! $Type$Vector op(Vector.Mask<$Boxtype$> o, FOp f) {
$type$[] res = new $type$[length()];
boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits();
for (int i = 0; i < length(); i++) {
if (mbits[i]) {
res[i] = f.apply(i);
}
}
return vectorFactory.apply(res);
}
-
- Vector.Mask<$Boxtype$> opm(IntVector.IntSpecies.FOpm f) {
- boolean[] res = new boolean[length()];
- for (int i = 0; i < length(); i++) {
- res[i] = (boolean)f.apply(i);
- }
- return maskFactory.apply(res);
- }
}
/**
* Finds the preferred species for an element type of {@code $type$}.
* <p>
--- 2691,2751 ----
* or for any vector lane index {@code N} where the mask at lane
* {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
! public void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
}
#else[byteOrShort]
! public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j);
#end[byteOrShort]
// Species
@Override
! public abstract VectorSpecies<$Boxtype$> species();
/**
! * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
*/
! static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
final Function<$type$[], $Type$Vector> vectorFactory;
! private $Type$Species(VectorShape shape,
Class<?> boxType,
Class<?> maskType,
Function<$type$[], $Type$Vector> vectorFactory,
! Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
! Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
! fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
! super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType, maskFactory,
! shuffleFromArrayFactory, shuffleFromOpFactory);
this.vectorFactory = vectorFactory;
}
interface FOp {
$type$ apply(int i);
}
$Type$Vector op(FOp f) {
$type$[] res = new $type$[length()];
for (int i = 0; i < length(); i++) {
res[i] = f.apply(i);
}
return vectorFactory.apply(res);
}
! $Type$Vector op(VectorMask<$Boxtype$> o, FOp f) {
$type$[] res = new $type$[length()];
boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits();
for (int i = 0; i < length(); i++) {
if (mbits[i]) {
res[i] = f.apply(i);
}
}
return vectorFactory.apply(res);
}
}
/**
* Finds the preferred species for an element type of {@code $type$}.
* <p>
*** 2990,3010 ****
* shuffles created from such species will be shape compatible.
*
* @return the preferred species for an element type of {@code $type$}
*/
private static $Type$Species preferredSpecies() {
! return ($Type$Species) Species.ofPreferred($type$.class);
}
/**
* Finds a species for an element type of {@code $type$} and shape.
*
* @param s the shape
* @return a species for an element type of {@code $type$} and shape
* @throws IllegalArgumentException if no such species exists for the shape
*/
! static $Type$Species species(Vector.Shape s) {
Objects.requireNonNull(s);
switch (s) {
case S_64_BIT: return ($Type$Species) SPECIES_64;
case S_128_BIT: return ($Type$Species) SPECIES_128;
case S_256_BIT: return ($Type$Species) SPECIES_256;
--- 2755,2775 ----
* shuffles created from such species will be shape compatible.
*
* @return the preferred species for an element type of {@code $type$}
*/
private static $Type$Species preferredSpecies() {
! return ($Type$Species) VectorSpecies.ofPreferred($type$.class);
}
/**
* Finds a species for an element type of {@code $type$} and shape.
*
* @param s the shape
* @return a species for an element type of {@code $type$} and shape
* @throws IllegalArgumentException if no such species exists for the shape
*/
! static $Type$Species species(VectorShape s) {
Objects.requireNonNull(s);
switch (s) {
case S_64_BIT: return ($Type$Species) SPECIES_64;
case S_128_BIT: return ($Type$Species) SPECIES_128;
case S_256_BIT: return ($Type$Species) SPECIES_256;
*** 3012,3042 ****
case S_Max_BIT: return ($Type$Species) SPECIES_MAX;
default: throw new IllegalArgumentException("Bad shape: " + s);
}
}
! /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_64_BIT Shape.S_64_BIT}. */
! public static final Species<$Boxtype$> SPECIES_64 = new $Type$Species(Shape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class,
! $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new);
!
! /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_128_BIT Shape.S_128_BIT}. */
! public static final Species<$Boxtype$> SPECIES_128 = new $Type$Species(Shape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class,
! $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new);
!
! /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_256_BIT Shape.S_256_BIT}. */
! public static final Species<$Boxtype$> SPECIES_256 = new $Type$Species(Shape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class,
! $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new);
!
! /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_512_BIT Shape.S_512_BIT}. */
! public static final Species<$Boxtype$> SPECIES_512 = new $Type$Species(Shape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class,
! $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new);
!
! /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_Max_BIT Shape.S_Max_BIT}. */
! public static final Species<$Boxtype$> SPECIES_MAX = new $Type$Species(Shape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class,
! $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new);
/**
* Preferred species for {@link $Type$Vector}s.
* A preferred species is a species of maximal bit size for the platform.
*/
! public static final Species<$Boxtype$> SPECIES_PREFERRED = (Species<$Boxtype$>) preferredSpecies();
}
--- 2777,2812 ----
case S_Max_BIT: return ($Type$Species) SPECIES_MAX;
default: throw new IllegalArgumentException("Bad shape: " + s);
}
}
! /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_64_BIT VectorShape.S_64_BIT}. */
! public static final VectorSpecies<$Boxtype$> SPECIES_64 = new $Type$Species(VectorShape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class,
! $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new,
! $Type$64Vector.$Type$64Shuffle::new, $Type$64Vector.$Type$64Shuffle::new);
!
! /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */
! public static final VectorSpecies<$Boxtype$> SPECIES_128 = new $Type$Species(VectorShape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class,
! $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new,
! $Type$128Vector.$Type$128Shuffle::new, $Type$128Vector.$Type$128Shuffle::new);
!
! /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */
! public static final VectorSpecies<$Boxtype$> SPECIES_256 = new $Type$Species(VectorShape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class,
! $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new,
! $Type$256Vector.$Type$256Shuffle::new, $Type$256Vector.$Type$256Shuffle::new);
!
! /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */
! public static final VectorSpecies<$Boxtype$> SPECIES_512 = new $Type$Species(VectorShape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class,
! $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new,
! $Type$512Vector.$Type$512Shuffle::new, $Type$512Vector.$Type$512Shuffle::new);
!
! /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */
! public static final VectorSpecies<$Boxtype$> SPECIES_MAX = new $Type$Species(VectorShape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class,
! $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new,
! $Type$MaxVector.$Type$MaxShuffle::new, $Type$MaxVector.$Type$MaxShuffle::new);
/**
* Preferred species for {@link $Type$Vector}s.
* A preferred species is a species of maximal bit size for the platform.
*/
! public static final VectorSpecies<$Boxtype$> SPECIES_PREFERRED = (VectorSpecies<$Boxtype$>) preferredSpecies();
}
< prev index next >