--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java 2019-04-16 10:37:59.054760500 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java 2019-04-16 10:37:58.612701900 -0700 @@ -37,7 +37,7 @@ @SuppressWarnings("cast") final class ByteMaxVector extends ByteVector { - private static final Species SPECIES = ByteVector.SPECIES_MAX; + private static final VectorSpecies SPECIES = ByteVector.SPECIES_MAX; static final ByteMaxVector ZERO = new ByteMaxVector(); @@ -73,7 +73,7 @@ } @Override - ByteMaxVector uOp(Mask o, FUnOp f) { + ByteMaxVector uOp(VectorMask o, FUnOp f) { byte[] vec = getElements(); byte[] res = new byte[length()]; boolean[] mbits = ((ByteMaxMask)o).getBits(); @@ -97,7 +97,7 @@ } @Override - ByteMaxVector bOp(Vector o1, Mask o2, FBinOp f) { + ByteMaxVector bOp(Vector o1, VectorMask o2, FBinOp f) { byte[] res = new byte[length()]; byte[] vec1 = this.getElements(); byte[] vec2 = ((ByteMaxVector)o1).getElements(); @@ -123,7 +123,7 @@ } @Override - ByteMaxVector tOp(Vector o1, Vector o2, Mask o3, FTriOp f) { + ByteMaxVector tOp(Vector o1, Vector o2, VectorMask o3, FTriOp f) { byte[] res = new byte[length()]; byte[] vec1 = getElements(); byte[] vec2 = ((ByteMaxVector)o1).getElements(); @@ -146,7 +146,7 @@ @Override @ForceInline - public Vector cast(Species s) { + public Vector cast(VectorSpecies s) { Objects.requireNonNull(s); if (s.length() != LENGTH) throw new IllegalArgumentException("Vector length this species length differ"); @@ -163,7 +163,7 @@ @SuppressWarnings("unchecked") @ForceInline - private Vector castDefault(Species s) { + private Vector castDefault(VectorSpecies s) { int limit = s.length(); Class stype = s.elementType(); @@ -172,37 +172,37 @@ for (int i = 0; i < limit; i++) { a[i] = (byte) this.get(i); } - return (Vector) ByteVector.fromArray((Species) s, a, 0); + return (Vector) ByteVector.fromArray((VectorSpecies) 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((Species) s, a, 0); + return (Vector) ShortVector.fromArray((VectorSpecies) 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((Species) s, a, 0); + return (Vector) IntVector.fromArray((VectorSpecies) 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((Species) s, a, 0); + return (Vector) LongVector.fromArray((VectorSpecies) 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((Species) s, a, 0); + return (Vector) FloatVector.fromArray((VectorSpecies) 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((Species) s, a, 0); + return (Vector) DoubleVector.fromArray((VectorSpecies) s, a, 0); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } @@ -211,11 +211,11 @@ @Override @ForceInline @SuppressWarnings("unchecked") - public Vector reinterpret(Species s) { + public Vector reinterpret(VectorSpecies s) { Objects.requireNonNull(s); if(s.elementType().equals(byte.class)) { - return (Vector) reshape((Species)s); + return (Vector) reshape((VectorSpecies)s); } if(s.bitSize() == bitSize()) { return reinterpretType(s); @@ -225,7 +225,7 @@ } @ForceInline - private Vector reinterpretType(Species s) { + private Vector reinterpretType(VectorSpecies s) { Objects.requireNonNull(s); Class stype = s.elementType(); @@ -290,7 +290,7 @@ @Override @ForceInline - public ByteVector reshape(Species s) { + public ByteVector reshape(VectorSpecies s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Byte64Vector.class)) { return VectorIntrinsics.reinterpret( @@ -353,7 +353,7 @@ @Override @ForceInline - public ByteVector add(byte o, Mask m) { + public ByteVector add(byte o, VectorMask m) { return add((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -365,7 +365,7 @@ @Override @ForceInline - public ByteVector sub(byte o, Mask m) { + public ByteVector sub(byte o, VectorMask m) { return sub((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -377,7 +377,7 @@ @Override @ForceInline - public ByteVector mul(byte o, Mask m) { + public ByteVector mul(byte o, VectorMask m) { return mul((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -395,43 +395,43 @@ @Override @ForceInline - public Mask equal(byte o) { + public VectorMask equal(byte o) { return equal((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask notEqual(byte o) { + public VectorMask notEqual(byte o) { return notEqual((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask lessThan(byte o) { + public VectorMask lessThan(byte o) { return lessThan((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask lessThanEq(byte o) { + public VectorMask lessThanEq(byte o) { return lessThanEq((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask greaterThan(byte o) { + public VectorMask greaterThan(byte o) { return greaterThan((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask greaterThanEq(byte o) { + public VectorMask greaterThanEq(byte o) { return greaterThanEq((ByteMaxVector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline - public ByteVector blend(byte o, Mask m) { + public ByteVector blend(byte o, VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -444,7 +444,7 @@ @Override @ForceInline - public ByteVector and(byte o, Mask m) { + public ByteVector and(byte o, VectorMask m) { return and((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -456,7 +456,7 @@ @Override @ForceInline - public ByteVector or(byte o, Mask m) { + public ByteVector or(byte o, VectorMask m) { return or((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -468,7 +468,7 @@ @Override @ForceInline - public ByteVector xor(byte o, Mask m) { + public ByteVector xor(byte o, VectorMask m) { return xor((ByteMaxVector)ByteVector.broadcast(SPECIES, o), m); } @@ -482,7 +482,7 @@ @ForceInline @Override - public ByteMaxVector neg(Mask m) { + public ByteMaxVector neg(VectorMask m) { return blend(neg(), m); } @@ -497,7 +497,7 @@ @ForceInline @Override - public ByteMaxVector abs(Mask m) { + public ByteMaxVector abs(VectorMask m) { return blend(abs(), m); } @@ -513,7 +513,7 @@ @ForceInline @Override - public ByteMaxVector not(Mask m) { + public ByteMaxVector not(VectorMask m) { return blend(not(), m); } // Binary operations @@ -531,7 +531,7 @@ @Override @ForceInline - public ByteMaxVector add(Vector v, Mask m) { + public ByteMaxVector add(Vector v, VectorMask m) { return blend(add(v), m); } @@ -548,7 +548,7 @@ @Override @ForceInline - public ByteMaxVector sub(Vector v, Mask m) { + public ByteMaxVector sub(Vector v, VectorMask m) { return blend(sub(v), m); } @@ -565,7 +565,7 @@ @Override @ForceInline - public ByteMaxVector mul(Vector v, Mask m) { + public ByteMaxVector mul(Vector v, VectorMask m) { return blend(mul(v), m); } @@ -582,7 +582,7 @@ @Override @ForceInline - public ByteMaxVector min(Vector v, Mask m) { + public ByteMaxVector min(Vector v, VectorMask m) { return blend(min(v), m); } @@ -599,7 +599,7 @@ @Override @ForceInline - public ByteMaxVector max(Vector v, Mask m) { + public ByteMaxVector max(Vector v, VectorMask m) { return blend(max(v), m); } @@ -638,19 +638,19 @@ @Override @ForceInline - public ByteMaxVector and(Vector v, Mask m) { + public ByteMaxVector and(Vector v, VectorMask m) { return blend(and(v), m); } @Override @ForceInline - public ByteMaxVector or(Vector v, Mask m) { + public ByteMaxVector or(Vector v, VectorMask m) { return blend(or(v), m); } @Override @ForceInline - public ByteMaxVector xor(Vector v, Mask m) { + public ByteMaxVector xor(Vector v, VectorMask m) { return blend(xor(v), m); } @@ -665,7 +665,7 @@ @Override @ForceInline - public ByteMaxVector shiftL(int s, Mask m) { + public ByteMaxVector shiftL(int s, VectorMask m) { return blend(shiftL(s), m); } @@ -680,7 +680,7 @@ @Override @ForceInline - public ByteMaxVector shiftR(int s, Mask m) { + public ByteMaxVector shiftR(int s, VectorMask m) { return blend(shiftR(s), m); } @@ -695,7 +695,7 @@ @Override @ForceInline - public ByteMaxVector aShiftR(int s, Mask m) { + public ByteMaxVector aShiftR(int s, VectorMask m) { return blend(aShiftR(s), m); } // Ternary operations @@ -723,7 +723,7 @@ @Override @ForceInline - public byte andAll(Mask m) { + public byte andAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, (byte) -1), m).andAll(); } @@ -765,7 +765,7 @@ @Override @ForceInline - public byte orAll(Mask m) { + public byte orAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, (byte) 0), m).orAll(); } @@ -780,45 +780,45 @@ @Override @ForceInline - public byte xorAll(Mask m) { + public byte xorAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, (byte) 0), m).xorAll(); } @Override @ForceInline - public byte addAll(Mask m) { + public byte addAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, (byte) 0), m).addAll(); } @Override @ForceInline - public byte mulAll(Mask m) { + public byte mulAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, (byte) 1), m).mulAll(); } @Override @ForceInline - public byte minAll(Mask m) { + public byte minAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, Byte.MAX_VALUE), m).minAll(); } @Override @ForceInline - public byte maxAll(Mask m) { + public byte maxAll(VectorMask m) { return blend((ByteMaxVector)ByteVector.broadcast(SPECIES, Byte.MIN_VALUE), m).maxAll(); } @Override @ForceInline - public Shuffle toShuffle() { + public VectorShuffle toShuffle() { byte[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } - return ByteVector.shuffleFromArray(SPECIES, sa, 0); + return VectorShuffle.fromArray(SPECIES, sa, 0); } // Memory operations @@ -840,7 +840,7 @@ @Override @ForceInline - public final void intoArray(byte[] a, int ax, Mask m) { + public final void intoArray(byte[] a, int ax, VectorMask m) { ByteVector oldVal = ByteVector.fromArray(SPECIES, a, ax); ByteVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); @@ -864,7 +864,7 @@ @Override @ForceInline - public final void intoByteArray(byte[] a, int ix, Mask m) { + public final void intoByteArray(byte[] a, int ix, VectorMask m) { ByteMaxVector oldVal = (ByteMaxVector) ByteVector.fromByteArray(SPECIES, a, ix); ByteMaxVector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); @@ -893,7 +893,7 @@ @Override @ForceInline - public void intoByteBuffer(ByteBuffer bb, int ix, Mask m) { + public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask m) { ByteMaxVector oldVal = (ByteMaxVector) ByteVector.fromByteBuffer(SPECIES, bb, ix); ByteMaxVector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); @@ -1018,7 +1018,7 @@ } @Override - void forEach(Mask o, FUnCon f) { + void forEach(VectorMask o, FUnCon f) { boolean[] mbits = ((ByteMaxMask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } @@ -1075,13 +1075,13 @@ @Override @ForceInline public ByteMaxVector rearrange(Vector v, - Shuffle s, Mask m) { + VectorShuffle s, VectorMask m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline - public ByteMaxVector rearrange(Shuffle o1) { + public ByteMaxVector rearrange(VectorShuffle o1) { Objects.requireNonNull(o1); ByteMaxShuffle s = (ByteMaxShuffle)o1; @@ -1096,7 +1096,7 @@ @Override @ForceInline - public ByteMaxVector blend(Vector o1, Mask o2) { + public ByteMaxVector blend(Vector o1, VectorMask o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); ByteMaxVector v = (ByteMaxVector)o1; @@ -1180,7 +1180,7 @@ } @Override - ByteMaxMask bOp(Mask o, MBinOp f) { + ByteMaxMask bOp(VectorMask o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((ByteMaxMask)o).getBits(); @@ -1191,7 +1191,7 @@ } @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } @@ -1210,23 +1210,23 @@ @Override @ForceInline @SuppressWarnings("unchecked") - public Mask cast(Species species) { + public VectorMask cast(VectorSpecies species) { if (length() != species.length()) - throw new IllegalArgumentException("Mask length and species length differ"); + throw new IllegalArgumentException("VectorMask length and species length differ"); Class stype = species.elementType(); boolean [] maskArray = toArray(); if (stype == byte.class) { - return (Mask ) new ByteMaxVector.ByteMaxMask(maskArray); + return (VectorMask ) new ByteMaxVector.ByteMaxMask(maskArray); } else if (stype == short.class) { - return (Mask ) new ShortMaxVector.ShortMaxMask(maskArray); + return (VectorMask ) new ShortMaxVector.ShortMaxMask(maskArray); } else if (stype == int.class) { - return (Mask ) new IntMaxVector.IntMaxMask(maskArray); + return (VectorMask ) new IntMaxVector.IntMaxMask(maskArray); } else if (stype == long.class) { - return (Mask ) new LongMaxVector.LongMaxMask(maskArray); + return (VectorMask ) new LongMaxVector.LongMaxMask(maskArray); } else if (stype == float.class) { - return (Mask ) new FloatMaxVector.FloatMaxMask(maskArray); + return (VectorMask ) new FloatMaxVector.FloatMaxMask(maskArray); } else if (stype == double.class) { - return (Mask ) new DoubleMaxVector.DoubleMaxMask(maskArray); + return (VectorMask ) new DoubleMaxVector.DoubleMaxMask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } @@ -1247,7 +1247,7 @@ @Override @ForceInline - public ByteMaxMask and(Mask o) { + public ByteMaxMask and(VectorMask o) { Objects.requireNonNull(o); ByteMaxMask m = (ByteMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, ByteMaxMask.class, byte.class, LENGTH, @@ -1257,7 +1257,7 @@ @Override @ForceInline - public ByteMaxMask or(Mask o) { + public ByteMaxMask or(VectorMask o) { Objects.requireNonNull(o); ByteMaxMask m = (ByteMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, ByteMaxMask.class, byte.class, LENGTH, @@ -1279,7 +1279,7 @@ @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, ByteMaxMask.class, byte.class, LENGTH, - this, ByteVector.maskAllTrue(species()), + this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((ByteMaxMask)m).getBits())); } } @@ -1304,7 +1304,7 @@ } @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } @@ -1320,30 +1320,30 @@ @Override @ForceInline @SuppressWarnings("unchecked") - public Shuffle cast(Species species) { + public VectorShuffle cast(VectorSpecies 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 ByteMaxVector.ByteMaxShuffle(shuffleArray); + return (VectorShuffle) new ByteMaxVector.ByteMaxShuffle(shuffleArray); } else if (stype == short.class) { - return (Shuffle) new ShortMaxVector.ShortMaxShuffle(shuffleArray); + return (VectorShuffle) new ShortMaxVector.ShortMaxShuffle(shuffleArray); } else if (stype == int.class) { - return (Shuffle) new IntMaxVector.IntMaxShuffle(shuffleArray); + return (VectorShuffle) new IntMaxVector.IntMaxShuffle(shuffleArray); } else if (stype == long.class) { - return (Shuffle) new LongMaxVector.LongMaxShuffle(shuffleArray); + return (VectorShuffle) new LongMaxVector.LongMaxShuffle(shuffleArray); } else if (stype == float.class) { - return (Shuffle) new FloatMaxVector.FloatMaxShuffle(shuffleArray); + return (VectorShuffle) new FloatMaxVector.FloatMaxShuffle(shuffleArray); } else if (stype == double.class) { - return (Shuffle) new DoubleMaxVector.DoubleMaxShuffle(shuffleArray); + return (VectorShuffle) new DoubleMaxVector.DoubleMaxShuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override - public ByteMaxShuffle rearrange(Vector.Shuffle o) { + public ByteMaxShuffle rearrange(VectorShuffle o) { ByteMaxShuffle s = (ByteMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { @@ -1353,10 +1353,10 @@ } } - // Species + // VectorSpecies @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } }