--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template 2019-04-09 12:08:41.254648800 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template 2019-04-09 12:08:40.531636300 -0700 @@ -40,7 +40,7 @@ @SuppressWarnings("cast") final class $vectortype$ extends $abstractvectortype$ { - static final $Type$$bits$Species SPECIES = new $Type$$bits$Species(); + private static final Species<$Boxtype$> SPECIES = $Type$Vector.SPECIES_$BITS$; static final $vectortype$ ZERO = new $vectortype$(); @@ -48,16 +48,17 @@ #if[!byteOrShort] // Index vector species - private static final IntVector.IntSpecies INDEX_SPEC; + private static final IntVector.IntSpecies INDEX_SPECIES; + static { #if[longOrDouble64] - INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, Shape.S_64_BIT); + INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(Shape.S_64_BIT); #else[longOrDouble64] int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH); - Vector.Shape shape = Shape.forBitSize(bitSize); - INDEX_SPEC = (IntVector.IntSpecies) Species.of(int.class, shape); + INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(Shape.forBitSize(bitSize)); #end[longOrDouble64] } + #end[!byteOrShort] private final $type$[] vec; // Don't access directly, use getElements() instead. @@ -170,7 +171,7 @@ return VectorIntrinsics.cast( $vectortype$.class, $type$.class, LENGTH, - s.vectorType(), + s.boxType(), s.elementType(), LENGTH, this, s, (species, vector) -> vector.castDefault(species) @@ -188,37 +189,37 @@ for (int i = 0; i < limit; i++) { a[i] = (byte) this.get(i); } - return (Vector) ByteVector.fromArray((ByteVector.ByteSpecies) s, a, 0); + return (Vector) ByteVector.fromArray((Species) s, a, 0); } else if (stype == short.class) { short[] a = new short[limit]; for (int i = 0; i < limit; i++) { a[i] = (short) this.get(i); } - return (Vector) ShortVector.fromArray((ShortVector.ShortSpecies) s, a, 0); + return (Vector) ShortVector.fromArray((Species) s, a, 0); } else if (stype == int.class) { int[] a = new int[limit]; for (int i = 0; i < limit; i++) { a[i] = (int) this.get(i); } - return (Vector) IntVector.fromArray((IntVector.IntSpecies) s, a, 0); + return (Vector) IntVector.fromArray((Species) s, a, 0); } else if (stype == long.class) { long[] a = new long[limit]; for (int i = 0; i < limit; i++) { a[i] = (long) this.get(i); } - return (Vector) LongVector.fromArray((LongVector.LongSpecies) s, a, 0); + return (Vector) LongVector.fromArray((Species) s, a, 0); } else if (stype == float.class) { float[] a = new float[limit]; for (int i = 0; i < limit; i++) { a[i] = (float) this.get(i); } - return (Vector) FloatVector.fromArray((FloatVector.FloatSpecies) s, a, 0); + return (Vector) FloatVector.fromArray((Species) s, a, 0); } else if (stype == double.class) { double[] a = new double[limit]; for (int i = 0; i < limit; i++) { a[i] = (double) this.get(i); } - return (Vector) DoubleVector.fromArray((DoubleVector.DoubleSpecies) s, a, 0); + return (Vector) DoubleVector.fromArray((Species) s, a, 0); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } @@ -308,55 +309,50 @@ @ForceInline public $abstractvectortype$ reshape(Species<$Boxtype$> s) { Objects.requireNonNull(s); - if (s.bitSize() == 64 && (s instanceof $Type$64Vector.$Type$64Species)) { - $Type$64Vector.$Type$64Species ts = ($Type$64Vector.$Type$64Species)s; + if (s.bitSize() == 64 && (s.boxType() == $Type$64Vector.class)) { return VectorIntrinsics.reinterpret( $vectortype$.class, $type$.class, LENGTH, $Type$64Vector.class, $type$.class, $Type$64Vector.LENGTH, - this, ts, + this, s, (species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 128 && (s instanceof $Type$128Vector.$Type$128Species)) { - $Type$128Vector.$Type$128Species ts = ($Type$128Vector.$Type$128Species)s; + } else if (s.bitSize() == 128 && (s.boxType() == $Type$128Vector.class)) { return VectorIntrinsics.reinterpret( $vectortype$.class, $type$.class, LENGTH, $Type$128Vector.class, $type$.class, $Type$128Vector.LENGTH, - this, ts, + this, s, (species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 256 && (s instanceof $Type$256Vector.$Type$256Species)) { - $Type$256Vector.$Type$256Species ts = ($Type$256Vector.$Type$256Species)s; + } else if (s.bitSize() == 256 && (s.boxType() == $Type$256Vector.class)) { return VectorIntrinsics.reinterpret( $vectortype$.class, $type$.class, LENGTH, $Type$256Vector.class, $type$.class, $Type$256Vector.LENGTH, - this, ts, + this, s, (species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 512 && (s instanceof $Type$512Vector.$Type$512Species)) { - $Type$512Vector.$Type$512Species ts = ($Type$512Vector.$Type$512Species)s; + } else if (s.bitSize() == 512 && (s.boxType() == $Type$512Vector.class)) { return VectorIntrinsics.reinterpret( $vectortype$.class, $type$.class, LENGTH, $Type$512Vector.class, $type$.class, $Type$512Vector.LENGTH, - this, ts, + this, s, (species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species) ); } else if ((s.bitSize() > 0) && (s.bitSize() <= 2048) - && (s.bitSize() % 128 == 0) && (s instanceof $Type$MaxVector.$Type$MaxSpecies)) { - $Type$MaxVector.$Type$MaxSpecies ts = ($Type$MaxVector.$Type$MaxSpecies)s; + && (s.bitSize() % 128 == 0) && (s.boxType() == $Type$MaxVector.class)) { return VectorIntrinsics.reinterpret( $vectortype$.class, $type$.class, LENGTH, $Type$MaxVector.class, $type$.class, $Type$MaxVector.LENGTH, - this, ts, + this, s, (species, vector) -> ($abstractvectortype$) vector.defaultReinterpret(species) ); } else { @@ -369,104 +365,104 @@ @Override @ForceInline public $abstractvectortype$ add($type$ o) { - return add(SPECIES.broadcast(o)); + return add(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ add($type$ o, Mask<$Boxtype$> m) { - return add(SPECIES.broadcast(o), m); + return add(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ sub($type$ o) { - return sub(SPECIES.broadcast(o)); + return sub(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ sub($type$ o, Mask<$Boxtype$> m) { - return sub(SPECIES.broadcast(o), m); + return sub(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ mul($type$ o) { - return mul(SPECIES.broadcast(o)); + return mul(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ mul($type$ o, Mask<$Boxtype$> m) { - return mul(SPECIES.broadcast(o), m); + return mul(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ min($type$ o) { - return min(SPECIES.broadcast(o)); + return min(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ max($type$ o) { - return max(SPECIES.broadcast(o)); + return max(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> equal($type$ o) { - return equal(SPECIES.broadcast(o)); + return equal(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> notEqual($type$ o) { - return notEqual(SPECIES.broadcast(o)); + return notEqual(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> lessThan($type$ o) { - return lessThan(SPECIES.broadcast(o)); + return lessThan(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> lessThanEq($type$ o) { - return lessThanEq(SPECIES.broadcast(o)); + return lessThanEq(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> greaterThan($type$ o) { - return greaterThan(SPECIES.broadcast(o)); + return greaterThan(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public Mask<$Boxtype$> greaterThanEq($type$ o) { - return greaterThanEq(SPECIES.broadcast(o)); + return greaterThanEq(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ blend($type$ o, Mask<$Boxtype$> m) { - return blend(SPECIES.broadcast(o), m); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } #if[FP] @Override @ForceInline public $abstractvectortype$ div($type$ o) { - return div(SPECIES.broadcast(o)); + return div(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ div($type$ o, Mask<$Boxtype$> m) { - return div(SPECIES.broadcast(o), m); + return div(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @@ -478,49 +474,49 @@ @Override @ForceInline public $abstractvectortype$ atan2($type$ o) { - return atan2(SPECIES.broadcast(o)); + return atan2(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ atan2($type$ o, Mask<$Boxtype$> m) { - return atan2(SPECIES.broadcast(o), m); + return atan2(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ pow($type$ o) { - return pow(SPECIES.broadcast(o)); + return pow(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ pow($type$ o, Mask<$Boxtype$> m) { - return pow(SPECIES.broadcast(o), m); + return pow(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ fma($type$ o1, $type$ o2) { - return fma(SPECIES.broadcast(o1), SPECIES.broadcast(o2)); + return fma(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o1), ($vectortype$)$abstractvectortype$.broadcast(SPECIES, o2)); } @Override @ForceInline public $abstractvectortype$ fma($type$ o1, $type$ o2, Mask<$Boxtype$> m) { - return fma(SPECIES.broadcast(o1), SPECIES.broadcast(o2), m); + return fma(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o1), ($vectortype$)$abstractvectortype$.broadcast(SPECIES, o2), m); } @Override @ForceInline public $abstractvectortype$ hypot($type$ o) { - return hypot(SPECIES.broadcast(o)); + return hypot(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ hypot($type$ o, Mask<$Boxtype$> m) { - return hypot(SPECIES.broadcast(o), m); + return hypot(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } #end[FP] @@ -528,37 +524,37 @@ @Override @ForceInline public $abstractvectortype$ and($type$ o) { - return and(SPECIES.broadcast(o)); + return and(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ and($type$ o, Mask<$Boxtype$> m) { - return and(SPECIES.broadcast(o), m); + return and(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ or($type$ o) { - return or(SPECIES.broadcast(o)); + return or(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ or($type$ o, Mask<$Boxtype$> m) { - return or(SPECIES.broadcast(o), m); + return or(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @ForceInline public $abstractvectortype$ xor($type$ o) { - return xor(SPECIES.broadcast(o)); + return xor(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o)); } @Override @ForceInline public $abstractvectortype$ xor($type$ o, Mask<$Boxtype$> m) { - return xor(SPECIES.broadcast(o), m); + return xor(($vectortype$)$abstractvectortype$.broadcast(SPECIES, o), m); } @Override @@ -1090,7 +1086,7 @@ public $vectortype$ shiftL(Vector<$Boxtype$> s) { $vectortype$ shiftv = ($vectortype$)s; // As per shift specification for Java, mask the shift count. - shiftv = shiftv.and(species().broadcast({#if[int]?0x1f:0x3f})); + shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f})); return VectorIntrinsics.binaryOp( VECTOR_OP_LSHIFT, $vectortype$.class, $type$.class, LENGTH, this, shiftv, @@ -1102,7 +1098,7 @@ public $vectortype$ shiftR(Vector<$Boxtype$> s) { $vectortype$ shiftv = ($vectortype$)s; // As per shift specification for Java, mask the shift count. - shiftv = shiftv.and(species().broadcast({#if[int]?0x1f:0x3f})); + shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f})); return VectorIntrinsics.binaryOp( VECTOR_OP_URSHIFT, $vectortype$.class, $type$.class, LENGTH, this, shiftv, @@ -1114,7 +1110,7 @@ public $vectortype$ aShiftR(Vector<$Boxtype$> s) { $vectortype$ shiftv = ($vectortype$)s; // As per shift specification for Java, mask the shift count. - shiftv = shiftv.and(species().broadcast({#if[int]?0x1f:0x3f})); + shiftv = shiftv.and($abstractvectortype$.broadcast(SPECIES, {#if[int]?0x1f:0x3f})); return VectorIntrinsics.binaryOp( VECTOR_OP_RSHIFT, $vectortype$.class, $type$.class, LENGTH, this, shiftv, @@ -1162,7 +1158,7 @@ @Override @ForceInline public $type$ andAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast(($type$) -1).blend(this, m).andAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, ($type$) -1), m).andAll(); } @Override @@ -1204,7 +1200,7 @@ @Override @ForceInline public $type$ orAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast(($type$) 0).blend(this, m).orAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, ($type$) 0), m).orAll(); } @Override @@ -1219,7 +1215,7 @@ @Override @ForceInline public $type$ xorAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast(($type$) 0).blend(this, m).xorAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, ($type$) 0), m).xorAll(); } #end[BITWISE] @@ -1281,26 +1277,26 @@ @Override @ForceInline public $type$ addAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast(($type$) 0).blend(this, m).addAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, ($type$) 0), m).addAll(); } @Override @ForceInline public $type$ mulAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast(($type$) 1).blend(this, m).mulAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, ($type$) 1), m).mulAll(); } @Override @ForceInline public $type$ minAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast($Boxtype$.MAX_VALUE).blend(this, m).minAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MAX_VALUE), m).minAll(); } @Override @ForceInline public $type$ maxAll(Mask<$Boxtype$> m) { - return SPECIES.broadcast($Boxtype$.MIN_VALUE).blend(this, m).maxAll(); + return blend(($vectortype$)$abstractvectortype$.broadcast(SPECIES, $Boxtype$.MIN_VALUE), m).maxAll(); } @Override @@ -1349,7 +1345,7 @@ Objects.requireNonNull(b); // Index vector: vix[0:n] = i -> ix + indexMap[iy + i] - IntVector vix = IntVector.fromArray(INDEX_SPEC, b, iy).add(ix); + IntVector vix = IntVector.fromArray(INDEX_SPECIES, b, iy).add(ix); vix = VectorIntrinsics.checkIndex(vix, a.length); @@ -1768,7 +1764,7 @@ } @Override - public $Type$$bits$Species species() { + public Species<$Boxtype$> species() { return SPECIES; } @@ -1784,6 +1780,31 @@ return new $vectortype$(res); } + @Override + @ForceInline + @SuppressWarnings("unchecked") + public Mask cast(Species species) { + if (length() != species.length()) + throw new IllegalArgumentException("Mask length and species length differ"); + Class stype = species.elementType(); + boolean [] maskArray = toArray(); + if (stype == byte.class) { + return (Mask ) new Byte$bits$Vector.Byte$bits$Mask(maskArray); + } else if (stype == short.class) { + return (Mask ) new Short$bits$Vector.Short$bits$Mask(maskArray); + } else if (stype == int.class) { + return (Mask ) new Int$bits$Vector.Int$bits$Mask(maskArray); + } else if (stype == long.class) { + return (Mask ) new Long$bits$Vector.Long$bits$Mask(maskArray); + } else if (stype == float.class) { + return (Mask ) new Float$bits$Vector.Float$bits$Mask(maskArray); + } else if (stype == double.class) { + return (Mask ) new Double$bits$Vector.Double$bits$Mask(maskArray); + } else { + throw new UnsupportedOperationException("Bad lane type for casting."); + } + } + // Unary operations @Override @@ -1856,7 +1877,7 @@ } @Override - public $Type$$bits$Species species() { + public Species<$Boxtype$> species() { return SPECIES; } @@ -1870,6 +1891,31 @@ } @Override + @ForceInline + @SuppressWarnings("unchecked") + public Shuffle cast(Species species) { + if (length() != species.length()) + throw new IllegalArgumentException("Shuffle length and species length differ"); + Class stype = species.elementType(); + int [] shuffleArray = toArray(); + if (stype == byte.class) { + return (Shuffle) new Byte$bits$Vector.Byte$bits$Shuffle(shuffleArray); + } else if (stype == short.class) { + return (Shuffle) new Short$bits$Vector.Short$bits$Shuffle(shuffleArray); + } else if (stype == int.class) { + return (Shuffle) new Int$bits$Vector.Int$bits$Shuffle(shuffleArray); + } else if (stype == long.class) { + return (Shuffle) new Long$bits$Vector.Long$bits$Shuffle(shuffleArray); + } else if (stype == float.class) { + return (Shuffle) new Float$bits$Vector.Float$bits$Shuffle(shuffleArray); + } else if (stype == double.class) { + return (Shuffle) new Double$bits$Vector.Double$bits$Shuffle(shuffleArray); + } else { + throw new UnsupportedOperationException("Bad lane type for casting."); + } + } + + @Override public $shuffletype$ rearrange(Vector.Shuffle<$Boxtype$> o) { $shuffletype$ s = ($shuffletype$) o; byte[] r = new byte[reorder.length]; @@ -1883,175 +1929,7 @@ // Species @Override - public $Type$$bits$Species species() { + public Species<$Boxtype$> species() { return SPECIES; } - - static final class $Type$$bits$Species extends $Type$Species { - static final int BIT_SIZE = Shape.$Shape$.bitSize(); - - static final int LENGTH = BIT_SIZE / $Boxtype$.SIZE; - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("Shape["); - sb.append(bitSize()).append(" bits, "); - sb.append(length()).append(" ").append($type$.class.getSimpleName()).append("s x "); - sb.append(elementSize()).append(" bits"); - sb.append("]"); - return sb.toString(); - } - - @Override - @ForceInline - public int bitSize() { - return BIT_SIZE; - } - - @Override - @ForceInline - public int length() { - return LENGTH; - } - - @Override - @ForceInline - public Class<$Boxtype$> elementType() { - return $type$.class; - } - - @Override - @ForceInline - public Class boxType() { - return $vectortype$.class; - } - - @Override - @ForceInline - public Class maskType() { - return $masktype$.class; - } - - @Override - @ForceInline - public int elementSize() { - return $Boxtype$.SIZE; - } - - @Override - @ForceInline - @SuppressWarnings("unchecked") - Class vectorType() { - return $vectortype$.class; - } - - @Override - @ForceInline - public Shape shape() { - return Shape.$Shape$; - } - -#if[!byteOrShort] - @Override - IntVector.IntSpecies indexSpecies() { - return INDEX_SPEC; - } - -#end[!byteOrShort] - @Override - $vectortype$ op(FOp f) { - $type$[] res = new $type$[length()]; - for (int i = 0; i < length(); i++) { - res[i] = f.apply(i); - } - return new $vectortype$(res); - } - - @Override - $vectortype$ op(Mask<$Boxtype$> o, FOp f) { - $type$[] res = new $type$[length()]; - boolean[] mbits = (($masktype$)o).getBits(); - for (int i = 0; i < length(); i++) { - if (mbits[i]) { - res[i] = f.apply(i); - } - } - return new $vectortype$(res); - } - - @Override - $masktype$ opm(FOpm f) { - boolean[] res = new boolean[length()]; - for (int i = 0; i < length(); i++) { - res[i] = (boolean)f.apply(i); - } - return new $masktype$(res); - } - - // Factories - -#if[FP] - @Override - @ForceInline - public $vectortype$ zero() { - return VectorIntrinsics.broadcastCoerced($vectortype$.class, $type$.class, LENGTH, - $Type$.$type$To$Bitstype$Bits(0.0f), SPECIES, - ((bits, s) -> (($Type$$bits$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits)))); - } - - @Override - @ForceInline - public $vectortype$ broadcast($type$ e) { - return VectorIntrinsics.broadcastCoerced( - $vectortype$.class, $type$.class, LENGTH, - $Type$.$type$To$Bitstype$Bits(e), SPECIES, - ((bits, s) -> (($Type$$bits$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits)))); - } -#end[FP] -#if[BITWISE] - @Override - @ForceInline - public $vectortype$ zero() { - return VectorIntrinsics.broadcastCoerced($vectortype$.class, $type$.class, LENGTH, - 0, SPECIES, - ((bits, s) -> (($Type$$bits$Species)s).op(i -> ($type$)bits))); - } - - @Override - @ForceInline - public $vectortype$ broadcast($type$ e) { - return VectorIntrinsics.broadcastCoerced( - $vectortype$.class, $type$.class, LENGTH, - e, SPECIES, - ((bits, s) -> (($Type$$bits$Species)s).op(i -> ($type$)bits))); - } -#end[BITWISE] - - @Override - @ForceInline - public $vectortype$ scalars($type$... es) { - Objects.requireNonNull(es); - int ix = VectorIntrinsics.checkIndex(0, es.length, LENGTH); - return VectorIntrinsics.load($vectortype$.class, $type$.class, LENGTH, - es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, - es, ix, SPECIES, - (c, idx, s) -> (($Type$$bits$Species)s).op(n -> c[idx + n])); - } - - @Override - @ForceInline - public $masktype$ cast(Mask m) { - if (m.length() != LENGTH) - throw new IllegalArgumentException("Mask length this species length differ"); - return new $masktype$(m.toArray()); - } - - @Override - @ForceInline - public $shuffletype$ cast(Shuffle s) { - if (s.length() != LENGTH) - throw new IllegalArgumentException("Shuffle length this species length differ"); - return new $shuffletype$(s.toArray()); - } - } }