* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane to left shift the - * element by shift value as specified by the input scalar. Only the 4 - * lowest-order bits of shift value are used. It is as if the shift value + * element by shift value as specified by the input scalar. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. * @@ -986,7 +986,7 @@ * @return the result of logically left shifting left this vector by the * broadcast of an input scalar */ - public abstract ShortVector shiftL(int s); + public abstract ShortVector shiftLeft(int s); /** * Logically left shifts this vector by the broadcast of an input scalar, @@ -994,8 +994,8 @@ *

* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane to left shift the - * element by shift value as specified by the input scalar. Only the 4 - * lowest-order bits of shift value are used. It is as if the shift value + * element by shift value as specified by the input scalar. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. * @@ -1004,8 +1004,43 @@ * @return the result of logically left shifting left this vector by the * broadcast of an input scalar */ - public abstract ShortVector shiftL(int s, VectorMask m); + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value + * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @param v the input vector + * @return the result of logically left shifting this vector by the input + * vector + */ + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value + * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @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 ShortVector shiftLeft(Vector v, VectorMask m) { + return blend(shiftLeft(v), m); + } // logical, or unsigned, shift right @@ -1015,8 +1050,8 @@ *

* This is a lane-wise binary operation which applies the primitive logical right shift * operation ({@code >>>}) to each lane to logically right shift the - * element by shift value as specified by the input scalar. Only the 4 - * lowest-order bits of shift value are used. It is as if the shift value + * element by shift value as specified by the input scalar. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. * @@ -1024,7 +1059,7 @@ * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ - public abstract ShortVector shiftR(int s); + public abstract ShortVector shiftRight(int s); /** * Logically right shifts (or unsigned right shifts) this vector by the @@ -1032,9 +1067,9 @@ * mask. *

* This is a lane-wise binary operation which applies the primitive logical right shift - * operation ({@code >>>}) to each lane to logically right shift the - * element by shift value as specified by the input scalar. Only the 4 - * lowest-order bits of shift value are used. It is as if the shift value + * operation ({@code >>}) to each lane to logically right shift the + * element by shift value as specified by the input scalar. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. * @@ -1043,8 +1078,44 @@ * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ - public abstract ShortVector shiftR(int s, VectorMask m); + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value + * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @param v the input vector + * @return the result of logically right shifting this vector by the + * input vector + */ + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift value + * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @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 ShortVector shiftRight(Vector v, VectorMask m) { + return blend(shiftRight(v), m); + } /** * Arithmetically right shifts (or signed right shifts) this vector by the @@ -1061,7 +1132,7 @@ * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ - public abstract ShortVector aShiftR(int s); + public abstract ShortVector shiftArithmeticRight(int s); /** * Arithmetically right shifts (or signed right shifts) this vector by the @@ -1080,8 +1151,120 @@ * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ - public abstract ShortVector aShiftR(int s, VectorMask m); + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift + * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @param v the input vector + * @return the result of arithmetically right shifting this vector by the + * input vector + */ + public abstract ShortVector 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. For each lane of this vector, the + * shift value is the corresponding lane of input vector. + * Only the 4 lowest-order bits of shift value are used. It is as if the shift + * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. + * The shift distance actually used is therefore always in the range 0 to 15, inclusive. + * + * @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 ShortVector shiftArithmeticRight(Vector v, VectorMask m) { + return blend(shiftArithmeticRight(v), m); + } + + /** + * Rotates left this vector by the broadcast of an input scalar. + *

+ * This is a lane-wise binary operation which produces the result of rotating left the two's + * complement binary representation of each lane of first operand (this vector) by input scalar. + * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. + * It is as if the input value were subjected to a bitwise logical + * AND operator ({@code &}) with the mask value 0x15. + * + * @param s the input scalar; the number of the bits to rotate left + * @return the result of rotating left this vector by the broadcast of an + * input scalar + */ + @ForceInline + public final ShortVector rotateLeft(int s) { + return shiftLeft(s).or(shiftRight(-s)); + } + + /** + * Rotates left this vector by the broadcast of an input scalar, selecting + * lane elements controlled by a mask. + *

+ * This is a lane-wise binary operation which produces the result of rotating left the two's + * complement binary representation of each lane of first operand (this vector) by input scalar. + * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. + * It is as if the input value were subjected to a bitwise logical + * AND operator ({@code &}) with the mask value 0x15. + * + * @param s the input scalar; the number of the bits to rotate left + * @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 ShortVector rotateLeft(int s, VectorMask m) { + return shiftLeft(s, m).or(shiftRight(-s, m), m); + } + /** + * Rotates right this vector by the broadcast of an input scalar. + *

+ * This is a lane-wise binary operation which produces the result of rotating right the two's + * complement binary representation of each lane of first operand (this vector) by input scalar. + * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. + * It is as if the input value were subjected to a bitwise logical + * AND operator ({@code &}) with the mask value 0x15. + * + * @param s the input scalar; the number of the bits to rotate right + * @return the result of rotating right this vector by the broadcast of an + * input scalar + */ + @ForceInline + public final ShortVector rotateRight(int s) { + return shiftRight(s).or(shiftLeft(-s)); + } + + /** + * Rotates right this vector by the broadcast of an input scalar, selecting + * lane elements controlled by a mask. + *

+ * This is a lane-wise binary operation which produces the result of rotating right the two's + * complement binary representation of each lane of first operand (this vector) by input scalar. + * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. + * It is as if the input value were subjected to a bitwise logical + * AND operator ({@code &}) with the mask value 0x15. + * + * @param s the input scalar; the number of the bits to rotate right + * @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 ShortVector rotateRight(int s, VectorMask m) { + return shiftRight(s, m).or(shiftLeft(-s, m), m); + } /** * {@inheritDoc} @@ -1426,13 +1609,13 @@ final Function vectorFactory; private ShortSpecies(VectorShape shape, - Class boxType, + Class vectorType, Class maskType, Function vectorFactory, Function> maskFactory, Function> shuffleFromArrayFactory, fShuffleFromArray shuffleFromOpFactory) { - super(shape, short.class, Short.SIZE, boxType, maskType, maskFactory, + super(shape, short.class, Short.SIZE, vectorType, maskType, maskFactory, shuffleFromArrayFactory, shuffleFromOpFactory); this.vectorFactory = vectorFactory; }