--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java 2019-04-26 14:50:50.283081900 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java 2019-04-26 14:50:49.714405500 -0700 @@ -112,7 +112,7 @@ @ForceInline @SuppressWarnings("unchecked") public static IntVector zero(VectorSpecies species) { - return VectorIntrinsics.broadcastCoerced((Class) species.boxType(), int.class, species.length(), + return VectorIntrinsics.broadcastCoerced((Class) species.vectorType(), int.class, species.length(), 0, species, ((bits, s) -> ((IntSpecies)s).op(i -> (int)bits))); } @@ -142,7 +142,7 @@ public static IntVector fromByteArray(VectorSpecies species, byte[] a, int offset) { Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); - return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), + return VectorIntrinsics.load((Class) species.vectorType(), int.class, species.length(), a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET, a, offset, species, (c, idx, s) -> { @@ -200,7 +200,7 @@ public static IntVector fromArray(VectorSpecies species, int[] a, int offset){ Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); - return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), + return VectorIntrinsics.load((Class) species.vectorType(), int.class, species.length(), a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_INT_BASE_OFFSET, a, offset, species, (c, idx, s) -> ((IntSpecies)s).op(n -> c[idx + n])); @@ -263,8 +263,8 @@ vix = VectorIntrinsics.checkIndex(vix, a.length); - return VectorIntrinsics.loadWithMap((Class) species.boxType(), int.class, species.length(), - IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_INT_BASE_OFFSET, vix, + return VectorIntrinsics.loadWithMap((Class) species.vectorType(), int.class, species.length(), + IntVector.species(species.indexShape()).vectorType(), a, Unsafe.ARRAY_INT_BASE_OFFSET, vix, a, a_offset, indexMap, i_offset, species, (int[] c, int idx, int[] iMap, int idy, VectorSpecies s) -> ((IntSpecies)s).op(n -> c[idx + iMap[idy+n]])); @@ -333,7 +333,7 @@ throw new IllegalArgumentException(); } offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); - return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), + return VectorIntrinsics.load((Class) species.vectorType(), int.class, species.length(), U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset, bb, offset, species, (c, idx, s) -> { @@ -389,7 +389,7 @@ * value {@code e}. * * @param species species of the desired vector - * @param e the value + * @param e the value to be broadcasted * @return a vector of vector where all lane elements are set to * the primitive value {@code e} */ @@ -397,7 +397,7 @@ @SuppressWarnings("unchecked") public static IntVector broadcast(VectorSpecies species, int e) { return VectorIntrinsics.broadcastCoerced( - (Class) species.boxType(), int.class, species.length(), + (Class) species.vectorType(), int.class, species.length(), e, species, ((bits, sp) -> ((IntSpecies)sp).op(i -> (int)bits))); } @@ -421,7 +421,7 @@ public static IntVector scalars(VectorSpecies species, int... es) { Objects.requireNonNull(es); int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); - return VectorIntrinsics.load((Class) species.boxType(), int.class, species.length(), + return VectorIntrinsics.load((Class) species.vectorType(), int.class, species.length(), es, Unsafe.ARRAY_INT_BASE_OFFSET, es, ix, species, (c, idx, sp) -> ((IntSpecies)sp).op(n -> c[idx + n])); @@ -799,25 +799,25 @@ * {@inheritDoc} */ @Override - public abstract IntVector rotateEL(int i); + public abstract IntVector rotateLanesLeft(int i); /** * {@inheritDoc} */ @Override - public abstract IntVector rotateER(int i); + public abstract IntVector rotateLanesRight(int i); /** * {@inheritDoc} */ @Override - public abstract IntVector shiftEL(int i); + public abstract IntVector shiftLanesLeft(int i); /** * {@inheritDoc} */ @Override - public abstract IntVector shiftER(int i); + public abstract IntVector shiftLanesRight(int i); @@ -996,113 +996,121 @@ * Logically left shifts this vector by the broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive logical left shift - * operation ({@code <<}) to each lane. + * operation ({@code <<}) to each lane to left shift the + * element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to left shift - * @return the result of logically left shifting left this vector by the + * @return the result of logically left shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector shiftL(int s); + public abstract IntVector shiftLeft(int s); /** * Logically left shifts this vector by the broadcast of an input scalar, * selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical left shift - * operation ({@code <<}) to each lane. + * operation ({@code <<}) to each lane to left shift the + * element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to left shift * @param m the mask controlling lane selection * @return the result of logically left shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector shiftL(int s, VectorMask m); + public abstract IntVector shiftLeft(int s, VectorMask m); /** * Logically left shifts this vector by an input vector. *

* This is a lane-wise binary operation which applies the primitive logical left shift - * operation ({@code <<}) to each lane. + * operation ({@code <<}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @param v the input vector * @return the result of logically left shifting this vector by the input * vector */ - public abstract IntVector shiftL(Vector v); + public abstract IntVector shiftLeft(Vector v); /** * Logically left shifts this vector by an input vector, selecting lane * elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical left shift - * operation ({@code <<}) to each lane. + * operation ({@code <<}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @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 IntVector shiftL(Vector v, VectorMask m) { - return bOp(v, m, (i, a, b) -> (int) (a << b)); + public IntVector shiftLeft(Vector v, VectorMask m) { + return blend(shiftLeft(v), m); } // logical, or unsigned, shift right - /** + /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive logical right shift - * operation ({@code >>>}) to each lane. + * operation ({@code >>>}) to each lane to logically right shift the + * element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to right shift * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector shiftR(int s); + public abstract IntVector shiftRight(int s); - /** + /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. *

* This is a lane-wise binary operation which applies the primitive logical right shift - * operation ({@code >>>}) to each lane. + * operation ({@code >>}) to each lane to logically right shift the + * element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector shiftR(int s, VectorMask m); + public abstract IntVector shiftRight(int s, VectorMask m); /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector. *

* This is a lane-wise binary operation which applies the primitive logical right shift - * operation ({@code >>>}) to each lane. + * operation ({@code >>>}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @param v the input vector * @return the result of logically right shifting this vector by the * input vector */ - public abstract IntVector shiftR(Vector v); + public abstract IntVector shiftRight(Vector v); /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical right shift - * operation ({@code >>>}) to each lane. + * operation ({@code >>>}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @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 IntVector shiftR(Vector v, VectorMask m) { - return bOp(v, m, (i, a, b) -> (int) (a >>> b)); + public IntVector shiftRight(Vector v, VectorMask m) { + return blend(shiftRight(v), m); } /** @@ -1110,13 +1118,14 @@ * broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive arithmetic right - * shift operation ({@code >>}) to each lane. + * shift operation ({@code >>}) to each lane to arithmetically + * right shift the element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to right shift * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector aShiftR(int s); + public abstract IntVector shiftArithmeticRight(int s); /** * Arithmetically right shifts (or signed right shifts) this vector by the @@ -1124,42 +1133,45 @@ * mask. *

* This is a lane-wise binary operation which applies the primitive arithmetic right - * shift operation ({@code >>}) to each lane. + * shift operation ({@code >>}) to each lane to arithmetically + * right shift the element by shift value as specified by the input scalar. * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ - public abstract IntVector aShiftR(int s, VectorMask m); + public abstract IntVector shiftArithmeticRight(int s, VectorMask m); /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector. *

* This is a lane-wise binary operation which applies the primitive arithmetic right - * shift operation ({@code >>}) to each lane. + * shift operation ({@code >>}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @param v the input vector * @return the result of arithmetically right shifting this vector by the * input vector */ - public abstract IntVector aShiftR(Vector v); + public abstract IntVector shiftArithmeticRight(Vector v); /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive arithmetic right - * shift operation ({@code >>}) to each lane. + * shift operation ({@code >>}) to each lane. For each lane of this vector, the + * shift value is the corresponding lane of input vector. * * @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 IntVector aShiftR(Vector v, VectorMask m) { - return bOp(v, m, (i, a, b) -> (int) (a >> b)); + public IntVector shiftArithmeticRight(Vector v, VectorMask m) { + return blend(shiftArithmeticRight(v), m); } /** @@ -1176,8 +1188,8 @@ * input scalar */ @ForceInline - public final IntVector rotateL(int s) { - return shiftL(s).or(shiftR(-s)); + public final IntVector rotateLeft(int s) { + return shiftLeft(s).or(shiftRight(-s)); } /** @@ -1196,8 +1208,8 @@ * input scalar */ @ForceInline - public final IntVector rotateL(int s, VectorMask m) { - return shiftL(s, m).or(shiftR(-s, m), m); + public final IntVector rotateLeft(int s, VectorMask m) { + return shiftLeft(s, m).or(shiftRight(-s, m), m); } /** @@ -1214,8 +1226,8 @@ * input scalar */ @ForceInline - public final IntVector rotateR(int s) { - return shiftR(s).or(shiftL(-s)); + public final IntVector rotateRight(int s) { + return shiftRight(s).or(shiftLeft(-s)); } /** @@ -1234,8 +1246,8 @@ * input scalar */ @ForceInline - public final IntVector rotateR(int s, VectorMask m) { - return shiftR(s, m).or(shiftL(-s, m), m); + public final IntVector rotateRight(int s, VectorMask m) { + return shiftRight(s, m).or(shiftLeft(-s, m), m); } /** @@ -1273,7 +1285,7 @@ * * @return the addition of all the lane elements of this vector */ - public abstract int addAll(); + public abstract int addLanes(); /** * Adds all lane elements of this vector, selecting lane elements @@ -1286,7 +1298,7 @@ * @param m the mask controlling lane selection * @return the addition of the selected lane elements of this vector */ - public abstract int addAll(VectorMask m); + public abstract int addLanes(VectorMask m); /** * Multiplies all lane elements of this vector. @@ -1297,7 +1309,7 @@ * * @return the multiplication of all the lane elements of this vector */ - public abstract int mulAll(); + public abstract int mulLanes(); /** * Multiplies all lane elements of this vector, selecting lane elements @@ -1310,7 +1322,7 @@ * @param m the mask controlling lane selection * @return the multiplication of all the lane elements of this vector */ - public abstract int mulAll(VectorMask m); + public abstract int mulLanes(VectorMask m); /** * Returns the minimum lane element of this vector. @@ -1322,7 +1334,7 @@ * * @return the minimum lane element of this vector */ - public abstract int minAll(); + public abstract int minLanes(); /** * Returns the minimum lane element of this vector, selecting lane elements @@ -1336,7 +1348,7 @@ * @param m the mask controlling lane selection * @return the minimum lane element of this vector */ - public abstract int minAll(VectorMask m); + public abstract int minLanes(VectorMask m); /** * Returns the maximum lane element of this vector. @@ -1348,7 +1360,7 @@ * * @return the maximum lane element of this vector */ - public abstract int maxAll(); + public abstract int maxLanes(); /** * Returns the maximum lane element of this vector, selecting lane elements @@ -1362,7 +1374,7 @@ * @param m the mask controlling lane selection * @return the maximum lane element of this vector */ - public abstract int maxAll(VectorMask m); + public abstract int maxLanes(VectorMask m); /** * Logically ORs all lane elements of this vector. @@ -1373,7 +1385,7 @@ * * @return the logical OR all the lane elements of this vector */ - public abstract int orAll(); + public abstract int orLanes(); /** * Logically ORs all lane elements of this vector, selecting lane elements @@ -1386,7 +1398,7 @@ * @param m the mask controlling lane selection * @return the logical OR all the lane elements of this vector */ - public abstract int orAll(VectorMask m); + public abstract int orLanes(VectorMask m); /** * Logically ANDs all lane elements of this vector. @@ -1397,7 +1409,7 @@ * * @return the logical AND all the lane elements of this vector */ - public abstract int andAll(); + public abstract int andLanes(); /** * Logically ANDs all lane elements of this vector, selecting lane elements @@ -1410,7 +1422,7 @@ * @param m the mask controlling lane selection * @return the logical AND all the lane elements of this vector */ - public abstract int andAll(VectorMask m); + public abstract int andLanes(VectorMask m); /** * Logically XORs all lane elements of this vector. @@ -1421,7 +1433,7 @@ * * @return the logical XOR all the lane elements of this vector */ - public abstract int xorAll(); + public abstract int xorLanes(); /** * Logically XORs all lane elements of this vector, selecting lane elements @@ -1434,7 +1446,7 @@ * @param m the mask controlling lane selection * @return the logical XOR all the lane elements of this vector */ - public abstract int xorAll(VectorMask m); + public abstract int xorLanes(VectorMask m); // Type specific accessors @@ -1577,13 +1589,13 @@ final Function vectorFactory; private IntSpecies(VectorShape shape, - Class boxType, + Class vectorType, Class maskType, Function vectorFactory, Function> maskFactory, Function> shuffleFromArrayFactory, fShuffleFromArray shuffleFromOpFactory) { - super(shape, int.class, Integer.SIZE, boxType, maskType, maskFactory, + super(shape, int.class, Integer.SIZE, vectorType, maskType, maskFactory, shuffleFromArrayFactory, shuffleFromOpFactory); this.vectorFactory = vectorFactory; }