< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java

Print this page
rev 55891 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz
rev 55894 : 8222897: [vector] Renaming of shift, rotate operations. Few other api changes.
Summary: Renaming of shift, rotate operations. Few other api changes.
Reviewed-by: jrose, briangoetz

*** 153,163 **** throw new IllegalArgumentException("Vector length this species length differ"); return VectorIntrinsics.cast( ShortMaxVector.class, short.class, LENGTH, ! s.boxType(), s.elementType(), LENGTH, this, s, (species, vector) -> vector.castDefault(species) ); } --- 153,163 ---- throw new IllegalArgumentException("Vector length this species length differ"); return VectorIntrinsics.cast( ShortMaxVector.class, short.class, LENGTH, ! s.vectorType(), s.elementType(), LENGTH, this, s, (species, vector) -> vector.castDefault(species) ); }
*** 291,338 **** @Override @ForceInline public ShortVector reshape(VectorSpecies<Short> s) { Objects.requireNonNull(s); ! if (s.bitSize() == 64 && (s.boxType() == Short64Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short64Vector.class, short.class, Short64Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 128 && (s.boxType() == Short128Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short128Vector.class, short.class, Short128Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 256 && (s.boxType() == Short256Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short256Vector.class, short.class, Short256Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 512 && (s.boxType() == Short512Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short512Vector.class, short.class, Short512Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); } else if ((s.bitSize() > 0) && (s.bitSize() <= 2048) ! && (s.bitSize() % 128 == 0) && (s.boxType() == ShortMaxVector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, ShortMaxVector.class, short.class, ShortMaxVector.LENGTH, --- 291,338 ---- @Override @ForceInline public ShortVector reshape(VectorSpecies<Short> s) { Objects.requireNonNull(s); ! if (s.bitSize() == 64 && (s.vectorType() == Short64Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short64Vector.class, short.class, Short64Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 128 && (s.vectorType() == Short128Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short128Vector.class, short.class, Short128Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 256 && (s.vectorType() == Short256Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short256Vector.class, short.class, Short256Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); ! } else if (s.bitSize() == 512 && (s.vectorType() == Short512Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, Short512Vector.class, short.class, Short512Vector.LENGTH, this, s, (species, vector) -> (ShortVector) vector.defaultReinterpret(species) ); } else if ((s.bitSize() > 0) && (s.bitSize() <= 2048) ! && (s.bitSize() % 128 == 0) && (s.vectorType() == ShortMaxVector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, ShortMaxVector.class, short.class, ShortMaxVector.LENGTH,
*** 655,816 **** return blend(xor(v), m); } @Override @ForceInline ! public ShortMaxVector shiftL(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_LSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) (a << (i & 15)))); } @Override @ForceInline ! public ShortMaxVector shiftL(int s, VectorMask<Short> m) { ! return blend(shiftL(s), m); } @Override @ForceInline ! public ShortMaxVector shiftR(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_URSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) ((a & 0xFFFF) >>> (i & 15)))); } @Override @ForceInline ! public ShortMaxVector shiftR(int s, VectorMask<Short> m) { ! return blend(shiftR(s), m); } @Override @ForceInline ! public ShortMaxVector aShiftR(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_RSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) (a >> (i & 15)))); } @Override @ForceInline ! public ShortMaxVector aShiftR(int s, VectorMask<Short> m) { ! return blend(aShiftR(s), m); } // Ternary operations // Type specific horizontal reductions @Override @ForceInline ! public short addAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_ADD, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a + b))); } @Override @ForceInline ! public short andAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_AND, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) -1, (i, a, b) -> (short) (a & b))); } @Override @ForceInline ! public short andAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) -1).blend(this, m).andAll(); } @Override @ForceInline ! public short minAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MIN, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp(Short.MAX_VALUE , (i, a, b) -> (short) Math.min(a, b))); } @Override @ForceInline ! public short maxAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MAX, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp(Short.MIN_VALUE , (i, a, b) -> (short) Math.max(a, b))); } @Override @ForceInline ! public short mulAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MUL, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 1, (i, a, b) -> (short) (a * b))); } @Override @ForceInline ! public short orAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_OR, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a | b))); } @Override @ForceInline ! public short orAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).orAll(); } @Override @ForceInline ! public short xorAll() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_XOR, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a ^ b))); } @Override @ForceInline ! public short xorAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).xorAll(); } @Override @ForceInline ! public short addAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).addAll(); } @Override @ForceInline ! public short mulAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 1).blend(this, m).mulAll(); } @Override @ForceInline ! public short minAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, Short.MAX_VALUE).blend(this, m).minAll(); } @Override @ForceInline ! public short maxAll(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, Short.MIN_VALUE).blend(this, m).maxAll(); } @Override @ForceInline public VectorShuffle<Short> toShuffle() { --- 655,843 ---- return blend(xor(v), m); } @Override @ForceInline ! public ShortMaxVector shiftLeft(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_LSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) (a << (i & 0xF)))); } @Override @ForceInline ! public ShortMaxVector shiftLeft(int s, VectorMask<Short> m) { ! return blend(shiftLeft(s), m); } @Override @ForceInline ! public ShortMaxVector shiftLeft(Vector<Short> s) { ! ShortMaxVector shiftv = (ShortMaxVector)s; ! // As per shift specification for Java, mask the shift count. ! shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF)); ! return this.bOp(shiftv, (i, a, b) -> (short) (a << (b & 0xF))); ! } ! ! @Override ! @ForceInline ! public ShortMaxVector shiftRight(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_URSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) ((a & 0xFFFF) >>> (i & 0xF)))); ! } ! ! @Override ! @ForceInline ! public ShortMaxVector shiftRight(int s, VectorMask<Short> m) { ! return blend(shiftRight(s), m); } @Override @ForceInline ! public ShortMaxVector shiftRight(Vector<Short> s) { ! ShortMaxVector shiftv = (ShortMaxVector)s; ! // As per shift specification for Java, mask the shift count. ! shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF)); ! return this.bOp(shiftv, (i, a, b) -> (short) (a >>> (b & 0xF))); } @Override @ForceInline ! public ShortMaxVector shiftArithmeticRight(int s) { return VectorIntrinsics.broadcastInt( VECTOR_OP_RSHIFT, ShortMaxVector.class, short.class, LENGTH, this, s, ! (v, i) -> v.uOp((__, a) -> (short) (a >> (i & 0xF)))); ! } ! ! @Override ! @ForceInline ! public ShortMaxVector shiftArithmeticRight(int s, VectorMask<Short> m) { ! return blend(shiftArithmeticRight(s), m); } @Override @ForceInline ! public ShortMaxVector shiftArithmeticRight(Vector<Short> s) { ! ShortMaxVector shiftv = (ShortMaxVector)s; ! // As per shift specification for Java, mask the shift count. ! shiftv = shiftv.and(ShortVector.broadcast(SPECIES, (short) 0xF)); ! return this.bOp(shiftv, (i, a, b) -> (short) (a >> (b & 0xF))); } // Ternary operations // Type specific horizontal reductions @Override @ForceInline ! public short addLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_ADD, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a + b))); } @Override @ForceInline ! public short andLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_AND, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) -1, (i, a, b) -> (short) (a & b))); } @Override @ForceInline ! public short andLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) -1).blend(this, m).andLanes(); } @Override @ForceInline ! public short minLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MIN, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp(Short.MAX_VALUE , (i, a, b) -> (short) Math.min(a, b))); } @Override @ForceInline ! public short maxLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MAX, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp(Short.MIN_VALUE , (i, a, b) -> (short) Math.max(a, b))); } @Override @ForceInline ! public short mulLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_MUL, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 1, (i, a, b) -> (short) (a * b))); } @Override @ForceInline ! public short orLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_OR, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a | b))); } @Override @ForceInline ! public short orLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).orLanes(); } @Override @ForceInline ! public short xorLanes() { return (short) VectorIntrinsics.reductionCoerced( VECTOR_OP_XOR, ShortMaxVector.class, short.class, LENGTH, this, v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a ^ b))); } @Override @ForceInline ! public short xorLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).xorLanes(); } @Override @ForceInline ! public short addLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 0).blend(this, m).addLanes(); } @Override @ForceInline ! public short mulLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, (short) 1).blend(this, m).mulLanes(); } @Override @ForceInline ! public short minLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, Short.MAX_VALUE).blend(this, m).minLanes(); } @Override @ForceInline ! public short maxLanes(VectorMask<Short> m) { ! return ShortVector.broadcast(SPECIES, Short.MIN_VALUE).blend(this, m).maxLanes(); } @Override @ForceInline public VectorShuffle<Short> toShuffle() {
*** 1027,1047 **** } @Override ! public ShortMaxVector rotateEL(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length(); i++){ res[(j + i) % length()] = vec[i]; } return new ShortMaxVector(res); } @Override ! public ShortMaxVector rotateER(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length(); i++){ int z = i - j; if(j < 0) { --- 1054,1074 ---- } @Override ! public ShortMaxVector rotateLanesLeft(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length(); i++){ res[(j + i) % length()] = vec[i]; } return new ShortMaxVector(res); } @Override ! public ShortMaxVector rotateLanesRight(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length(); i++){ int z = i - j; if(j < 0) {
*** 1052,1072 **** } return new ShortMaxVector(res); } @Override ! public ShortMaxVector shiftEL(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length() - j; i++) { res[i] = vec[i + j]; } return new ShortMaxVector(res); } @Override ! public ShortMaxVector shiftER(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length() - j; i++){ res[i + j] = vec[i]; } --- 1079,1099 ---- } return new ShortMaxVector(res); } @Override ! public ShortMaxVector shiftLanesLeft(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length() - j; i++) { res[i] = vec[i + j]; } return new ShortMaxVector(res); } @Override ! public ShortMaxVector shiftLanesRight(int j) { short[] vec = getElements(); short[] res = new short[length()]; for (int i = 0; i < length() - j; i++){ res[i + j] = vec[i]; }
< prev index next >