--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java 2019-04-16 10:39:13.808130000 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java 2019-04-16 10:39:13.347516100 -0700 @@ -38,7 +38,7 @@ @SuppressWarnings("cast") final class IntMaxVector extends IntVector { - private static final Species SPECIES = IntVector.SPECIES_MAX; + private static final VectorSpecies SPECIES = IntVector.SPECIES_MAX; static final IntMaxVector ZERO = new IntMaxVector(); @@ -49,7 +49,7 @@ static { int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH); - INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(Shape.forBitSize(bitSize)); + INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(VectorShape.forBitSize(bitSize)); } private final int[] vec; // Don't access directly, use getElements() instead. @@ -82,7 +82,7 @@ } @Override - IntMaxVector uOp(Mask o, FUnOp f) { + IntMaxVector uOp(VectorMask o, FUnOp f) { int[] vec = getElements(); int[] res = new int[length()]; boolean[] mbits = ((IntMaxMask)o).getBits(); @@ -106,7 +106,7 @@ } @Override - IntMaxVector bOp(Vector o1, Mask o2, FBinOp f) { + IntMaxVector bOp(Vector o1, VectorMask o2, FBinOp f) { int[] res = new int[length()]; int[] vec1 = this.getElements(); int[] vec2 = ((IntMaxVector)o1).getElements(); @@ -132,7 +132,7 @@ } @Override - IntMaxVector tOp(Vector o1, Vector o2, Mask o3, FTriOp f) { + IntMaxVector tOp(Vector o1, Vector o2, VectorMask o3, FTriOp f) { int[] res = new int[length()]; int[] vec1 = getElements(); int[] vec2 = ((IntMaxVector)o1).getElements(); @@ -155,7 +155,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"); @@ -172,7 +172,7 @@ @SuppressWarnings("unchecked") @ForceInline - private Vector castDefault(Species s) { + private Vector castDefault(VectorSpecies s) { int limit = s.length(); Class stype = s.elementType(); @@ -181,37 +181,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."); } @@ -220,11 +220,11 @@ @Override @ForceInline @SuppressWarnings("unchecked") - public Vector reinterpret(Species s) { + public Vector reinterpret(VectorSpecies s) { Objects.requireNonNull(s); if(s.elementType().equals(int.class)) { - return (Vector) reshape((Species)s); + return (Vector) reshape((VectorSpecies)s); } if(s.bitSize() == bitSize()) { return reinterpretType(s); @@ -234,7 +234,7 @@ } @ForceInline - private Vector reinterpretType(Species s) { + private Vector reinterpretType(VectorSpecies s) { Objects.requireNonNull(s); Class stype = s.elementType(); @@ -299,7 +299,7 @@ @Override @ForceInline - public IntVector reshape(Species s) { + public IntVector reshape(VectorSpecies s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Int64Vector.class)) { return VectorIntrinsics.reinterpret( @@ -362,7 +362,7 @@ @Override @ForceInline - public IntVector add(int o, Mask m) { + public IntVector add(int o, VectorMask m) { return add((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -374,7 +374,7 @@ @Override @ForceInline - public IntVector sub(int o, Mask m) { + public IntVector sub(int o, VectorMask m) { return sub((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -386,7 +386,7 @@ @Override @ForceInline - public IntVector mul(int o, Mask m) { + public IntVector mul(int o, VectorMask m) { return mul((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -404,43 +404,43 @@ @Override @ForceInline - public Mask equal(int o) { + public VectorMask equal(int o) { return equal((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask notEqual(int o) { + public VectorMask notEqual(int o) { return notEqual((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask lessThan(int o) { + public VectorMask lessThan(int o) { return lessThan((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask lessThanEq(int o) { + public VectorMask lessThanEq(int o) { return lessThanEq((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask greaterThan(int o) { + public VectorMask greaterThan(int o) { return greaterThan((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public Mask greaterThanEq(int o) { + public VectorMask greaterThanEq(int o) { return greaterThanEq((IntMaxVector)IntVector.broadcast(SPECIES, o)); } @Override @ForceInline - public IntVector blend(int o, Mask m) { + public IntVector blend(int o, VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -453,7 +453,7 @@ @Override @ForceInline - public IntVector and(int o, Mask m) { + public IntVector and(int o, VectorMask m) { return and((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -465,7 +465,7 @@ @Override @ForceInline - public IntVector or(int o, Mask m) { + public IntVector or(int o, VectorMask m) { return or((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -477,7 +477,7 @@ @Override @ForceInline - public IntVector xor(int o, Mask m) { + public IntVector xor(int o, VectorMask m) { return xor((IntMaxVector)IntVector.broadcast(SPECIES, o), m); } @@ -491,7 +491,7 @@ @ForceInline @Override - public IntMaxVector neg(Mask m) { + public IntMaxVector neg(VectorMask m) { return blend(neg(), m); } @@ -506,7 +506,7 @@ @ForceInline @Override - public IntMaxVector abs(Mask m) { + public IntMaxVector abs(VectorMask m) { return blend(abs(), m); } @@ -522,7 +522,7 @@ @ForceInline @Override - public IntMaxVector not(Mask m) { + public IntMaxVector not(VectorMask m) { return blend(not(), m); } // Binary operations @@ -540,7 +540,7 @@ @Override @ForceInline - public IntMaxVector add(Vector v, Mask m) { + public IntMaxVector add(Vector v, VectorMask m) { return blend(add(v), m); } @@ -557,7 +557,7 @@ @Override @ForceInline - public IntMaxVector sub(Vector v, Mask m) { + public IntMaxVector sub(Vector v, VectorMask m) { return blend(sub(v), m); } @@ -574,7 +574,7 @@ @Override @ForceInline - public IntMaxVector mul(Vector v, Mask m) { + public IntMaxVector mul(Vector v, VectorMask m) { return blend(mul(v), m); } @@ -591,7 +591,7 @@ @Override @ForceInline - public IntMaxVector min(Vector v, Mask m) { + public IntMaxVector min(Vector v, VectorMask m) { return blend(min(v), m); } @@ -608,7 +608,7 @@ @Override @ForceInline - public IntMaxVector max(Vector v, Mask m) { + public IntMaxVector max(Vector v, VectorMask m) { return blend(max(v), m); } @@ -647,19 +647,19 @@ @Override @ForceInline - public IntMaxVector and(Vector v, Mask m) { + public IntMaxVector and(Vector v, VectorMask m) { return blend(and(v), m); } @Override @ForceInline - public IntMaxVector or(Vector v, Mask m) { + public IntMaxVector or(Vector v, VectorMask m) { return blend(or(v), m); } @Override @ForceInline - public IntMaxVector xor(Vector v, Mask m) { + public IntMaxVector xor(Vector v, VectorMask m) { return blend(xor(v), m); } @@ -674,7 +674,7 @@ @Override @ForceInline - public IntMaxVector shiftL(int s, Mask m) { + public IntMaxVector shiftL(int s, VectorMask m) { return blend(shiftL(s), m); } @@ -689,7 +689,7 @@ @Override @ForceInline - public IntMaxVector shiftR(int s, Mask m) { + public IntMaxVector shiftR(int s, VectorMask m) { return blend(shiftR(s), m); } @@ -704,7 +704,7 @@ @Override @ForceInline - public IntMaxVector aShiftR(int s, Mask m) { + public IntMaxVector aShiftR(int s, VectorMask m) { return blend(aShiftR(s), m); } @@ -768,7 +768,7 @@ @Override @ForceInline - public int andAll(Mask m) { + public int andAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, (int) -1), m).andAll(); } @@ -810,7 +810,7 @@ @Override @ForceInline - public int orAll(Mask m) { + public int orAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, (int) 0), m).orAll(); } @@ -825,45 +825,45 @@ @Override @ForceInline - public int xorAll(Mask m) { + public int xorAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, (int) 0), m).xorAll(); } @Override @ForceInline - public int addAll(Mask m) { + public int addAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, (int) 0), m).addAll(); } @Override @ForceInline - public int mulAll(Mask m) { + public int mulAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, (int) 1), m).mulAll(); } @Override @ForceInline - public int minAll(Mask m) { + public int minAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, Integer.MAX_VALUE), m).minAll(); } @Override @ForceInline - public int maxAll(Mask m) { + public int maxAll(VectorMask m) { return blend((IntMaxVector)IntVector.broadcast(SPECIES, Integer.MIN_VALUE), m).maxAll(); } @Override @ForceInline - public Shuffle toShuffle() { + public VectorShuffle toShuffle() { int[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } - return IntVector.shuffleFromArray(SPECIES, sa, 0); + return VectorShuffle.fromArray(SPECIES, sa, 0); } // Memory operations @@ -885,7 +885,7 @@ @Override @ForceInline - public final void intoArray(int[] a, int ax, Mask m) { + public final void intoArray(int[] a, int ax, VectorMask m) { IntVector oldVal = IntVector.fromArray(SPECIES, a, ax); IntVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); @@ -910,7 +910,7 @@ @Override @ForceInline - public final void intoArray(int[] a, int ax, Mask m, int[] b, int iy) { + public final void intoArray(int[] a, int ax, VectorMask m, int[] b, int iy) { // @@@ This can result in out of bounds errors for unset mask lanes IntVector oldVal = IntVector.fromArray(SPECIES, a, ax, b, iy); IntVector newVal = oldVal.blend(this, m); @@ -935,7 +935,7 @@ @Override @ForceInline - public final void intoByteArray(byte[] a, int ix, Mask m) { + public final void intoByteArray(byte[] a, int ix, VectorMask m) { IntMaxVector oldVal = (IntMaxVector) IntVector.fromByteArray(SPECIES, a, ix); IntMaxVector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); @@ -964,7 +964,7 @@ @Override @ForceInline - public void intoByteBuffer(ByteBuffer bb, int ix, Mask m) { + public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask m) { IntMaxVector oldVal = (IntMaxVector) IntVector.fromByteBuffer(SPECIES, bb, ix); IntMaxVector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); @@ -1089,7 +1089,7 @@ } @Override - void forEach(Mask o, FUnCon f) { + void forEach(VectorMask o, FUnCon f) { boolean[] mbits = ((IntMaxMask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } @@ -1154,13 +1154,13 @@ @Override @ForceInline public IntMaxVector rearrange(Vector v, - Shuffle s, Mask m) { + VectorShuffle s, VectorMask m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline - public IntMaxVector rearrange(Shuffle o1) { + public IntMaxVector rearrange(VectorShuffle o1) { Objects.requireNonNull(o1); IntMaxShuffle s = (IntMaxShuffle)o1; @@ -1175,7 +1175,7 @@ @Override @ForceInline - public IntMaxVector blend(Vector o1, Mask o2) { + public IntMaxVector blend(Vector o1, VectorMask o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); IntMaxVector v = (IntMaxVector)o1; @@ -1259,7 +1259,7 @@ } @Override - IntMaxMask bOp(Mask o, MBinOp f) { + IntMaxMask bOp(VectorMask o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((IntMaxMask)o).getBits(); @@ -1270,7 +1270,7 @@ } @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } @@ -1289,23 +1289,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."); } @@ -1326,7 +1326,7 @@ @Override @ForceInline - public IntMaxMask and(Mask o) { + public IntMaxMask and(VectorMask o) { Objects.requireNonNull(o); IntMaxMask m = (IntMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, IntMaxMask.class, int.class, LENGTH, @@ -1336,7 +1336,7 @@ @Override @ForceInline - public IntMaxMask or(Mask o) { + public IntMaxMask or(VectorMask o) { Objects.requireNonNull(o); IntMaxMask m = (IntMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, IntMaxMask.class, int.class, LENGTH, @@ -1358,7 +1358,7 @@ @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, IntMaxMask.class, int.class, LENGTH, - this, IntVector.maskAllTrue(species()), + this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((IntMaxMask)m).getBits())); } } @@ -1383,7 +1383,7 @@ } @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } @@ -1399,30 +1399,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 IntMaxShuffle rearrange(Vector.Shuffle o) { + public IntMaxShuffle rearrange(VectorShuffle o) { IntMaxShuffle s = (IntMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { @@ -1432,10 +1432,10 @@ } } - // Species + // VectorSpecies @Override - public Species species() { + public VectorSpecies species() { return SPECIES; } }