--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java 2019-04-26 14:49:05.765525100 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java 2019-04-26 14:49:05.182538500 -0700 @@ -154,7 +154,7 @@ return VectorIntrinsics.cast( Byte128Vector.class, byte.class, LENGTH, - s.boxType(), + s.vectorType(), s.elementType(), LENGTH, this, s, (species, vector) -> vector.castDefault(species) @@ -292,7 +292,7 @@ @ForceInline public ByteVector reshape(VectorSpecies s) { Objects.requireNonNull(s); - if (s.bitSize() == 64 && (s.boxType() == Byte64Vector.class)) { + if (s.bitSize() == 64 && (s.vectorType() == Byte64Vector.class)) { return VectorIntrinsics.reinterpret( Byte128Vector.class, byte.class, LENGTH, @@ -301,7 +301,7 @@ this, s, (species, vector) -> (ByteVector) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 128 && (s.boxType() == Byte128Vector.class)) { + } else if (s.bitSize() == 128 && (s.vectorType() == Byte128Vector.class)) { return VectorIntrinsics.reinterpret( Byte128Vector.class, byte.class, LENGTH, @@ -310,7 +310,7 @@ this, s, (species, vector) -> (ByteVector) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 256 && (s.boxType() == Byte256Vector.class)) { + } else if (s.bitSize() == 256 && (s.vectorType() == Byte256Vector.class)) { return VectorIntrinsics.reinterpret( Byte128Vector.class, byte.class, LENGTH, @@ -319,7 +319,7 @@ this, s, (species, vector) -> (ByteVector) vector.defaultReinterpret(species) ); - } else if (s.bitSize() == 512 && (s.boxType() == Byte512Vector.class)) { + } else if (s.bitSize() == 512 && (s.vectorType() == Byte512Vector.class)) { return VectorIntrinsics.reinterpret( Byte128Vector.class, byte.class, LENGTH, @@ -329,7 +329,7 @@ (species, vector) -> (ByteVector) vector.defaultReinterpret(species) ); } else if ((s.bitSize() > 0) && (s.bitSize() <= 2048) - && (s.bitSize() % 128 == 0) && (s.boxType() == ByteMaxVector.class)) { + && (s.bitSize() % 128 == 0) && (s.vectorType() == ByteMaxVector.class)) { return VectorIntrinsics.reinterpret( Byte128Vector.class, byte.class, LENGTH, @@ -656,48 +656,76 @@ @Override @ForceInline - public Byte128Vector shiftL(int s) { + public Byte128Vector shiftLeft(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_LSHIFT, Byte128Vector.class, byte.class, LENGTH, this, s, - (v, i) -> v.uOp((__, a) -> (byte) (a << (i & 7)))); + (v, i) -> v.uOp((__, a) -> (byte) (a << (i & 0x7)))); } @Override @ForceInline - public Byte128Vector shiftL(int s, VectorMask m) { - return blend(shiftL(s), m); + public Byte128Vector shiftLeft(int s, VectorMask m) { + return blend(shiftLeft(s), m); } @Override @ForceInline - public Byte128Vector shiftR(int s) { + public Byte128Vector shiftLeft(Vector s) { + Byte128Vector shiftv = (Byte128Vector)s; + // As per shift specification for Java, mask the shift count. + shiftv = shiftv.and(ByteVector.broadcast(SPECIES, (byte) 0x7)); + return this.bOp(shiftv, (i, a, b) -> (byte) (a << (b & 0x7))); + } + + @Override + @ForceInline + public Byte128Vector shiftRight(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_URSHIFT, Byte128Vector.class, byte.class, LENGTH, this, s, - (v, i) -> v.uOp((__, a) -> (byte) ((a & 0xFF) >>> (i & 7)))); + (v, i) -> v.uOp((__, a) -> (byte) ((a & 0xFF) >>> (i & 0x7)))); } @Override @ForceInline - public Byte128Vector shiftR(int s, VectorMask m) { - return blend(shiftR(s), m); + public Byte128Vector shiftRight(int s, VectorMask m) { + return blend(shiftRight(s), m); } @Override @ForceInline - public Byte128Vector aShiftR(int s) { + public Byte128Vector shiftRight(Vector s) { + Byte128Vector shiftv = (Byte128Vector)s; + // As per shift specification for Java, mask the shift count. + shiftv = shiftv.and(ByteVector.broadcast(SPECIES, (byte) 0x7)); + return this.bOp(shiftv, (i, a, b) -> (byte) (a >>> (b & 0x7))); + } + + @Override + @ForceInline + public Byte128Vector shiftArithmeticRight(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_RSHIFT, Byte128Vector.class, byte.class, LENGTH, this, s, - (v, i) -> v.uOp((__, a) -> (byte) (a >> (i & 7)))); + (v, i) -> v.uOp((__, a) -> (byte) (a >> (i & 0x7)))); + } + + @Override + @ForceInline + public Byte128Vector shiftArithmeticRight(int s, VectorMask m) { + return blend(shiftArithmeticRight(s), m); } @Override @ForceInline - public Byte128Vector aShiftR(int s, VectorMask m) { - return blend(aShiftR(s), m); + public Byte128Vector shiftArithmeticRight(Vector s) { + Byte128Vector shiftv = (Byte128Vector)s; + // As per shift specification for Java, mask the shift count. + shiftv = shiftv.and(ByteVector.broadcast(SPECIES, (byte) 0x7)); + return this.bOp(shiftv, (i, a, b) -> (byte) (a >> (b & 0x7))); } + // Ternary operations @@ -705,7 +733,7 @@ @Override @ForceInline - public byte addAll() { + public byte addLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_ADD, Byte128Vector.class, byte.class, LENGTH, this, @@ -714,7 +742,7 @@ @Override @ForceInline - public byte andAll() { + public byte andLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_AND, Byte128Vector.class, byte.class, LENGTH, this, @@ -723,13 +751,13 @@ @Override @ForceInline - public byte andAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, (byte) -1).blend(this, m).andAll(); + public byte andLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, (byte) -1).blend(this, m).andLanes(); } @Override @ForceInline - public byte minAll() { + public byte minLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_MIN, Byte128Vector.class, byte.class, LENGTH, this, @@ -738,7 +766,7 @@ @Override @ForceInline - public byte maxAll() { + public byte maxLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_MAX, Byte128Vector.class, byte.class, LENGTH, this, @@ -747,7 +775,7 @@ @Override @ForceInline - public byte mulAll() { + public byte mulLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_MUL, Byte128Vector.class, byte.class, LENGTH, this, @@ -756,7 +784,7 @@ @Override @ForceInline - public byte orAll() { + public byte orLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_OR, Byte128Vector.class, byte.class, LENGTH, this, @@ -765,13 +793,13 @@ @Override @ForceInline - public byte orAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).orAll(); + public byte orLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).orLanes(); } @Override @ForceInline - public byte xorAll() { + public byte xorLanes() { return (byte) VectorIntrinsics.reductionCoerced( VECTOR_OP_XOR, Byte128Vector.class, byte.class, LENGTH, this, @@ -780,34 +808,34 @@ @Override @ForceInline - public byte xorAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).xorAll(); + public byte xorLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).xorLanes(); } @Override @ForceInline - public byte addAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).addAll(); + public byte addLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, (byte) 0).blend(this, m).addLanes(); } @Override @ForceInline - public byte mulAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, (byte) 1).blend(this, m).mulAll(); + public byte mulLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, (byte) 1).blend(this, m).mulLanes(); } @Override @ForceInline - public byte minAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, Byte.MAX_VALUE).blend(this, m).minAll(); + public byte minLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, Byte.MAX_VALUE).blend(this, m).minLanes(); } @Override @ForceInline - public byte maxAll(VectorMask m) { - return ByteVector.broadcast(SPECIES, Byte.MIN_VALUE).blend(this, m).maxAll(); + public byte maxLanes(VectorMask m) { + return ByteVector.broadcast(SPECIES, Byte.MIN_VALUE).blend(this, m).maxLanes(); } @Override @@ -1028,7 +1056,7 @@ @Override - public Byte128Vector rotateEL(int j) { + public Byte128Vector rotateLanesLeft(int j) { byte[] vec = getElements(); byte[] res = new byte[length()]; for (int i = 0; i < length(); i++){ @@ -1038,7 +1066,7 @@ } @Override - public Byte128Vector rotateER(int j) { + public Byte128Vector rotateLanesRight(int j) { byte[] vec = getElements(); byte[] res = new byte[length()]; for (int i = 0; i < length(); i++){ @@ -1053,7 +1081,7 @@ } @Override - public Byte128Vector shiftEL(int j) { + public Byte128Vector shiftLanesLeft(int j) { byte[] vec = getElements(); byte[] res = new byte[length()]; for (int i = 0; i < length() - j; i++) { @@ -1063,7 +1091,7 @@ } @Override - public Byte128Vector shiftER(int j) { + public Byte128Vector shiftLanesRight(int j) { byte[] vec = getElements(); byte[] res = new byte[length()]; for (int i = 0; i < length() - j; i++){