< prev index next >

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

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level

*** 36,46 **** import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class ShortMaxVector extends ShortVector { ! private static final Species<Short> SPECIES = ShortVector.SPECIES_MAX; static final ShortMaxVector ZERO = new ShortMaxVector(); static final int LENGTH = SPECIES.length(); --- 36,46 ---- import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class ShortMaxVector extends ShortVector { ! private static final VectorSpecies<Short> SPECIES = ShortVector.SPECIES_MAX; static final ShortMaxVector ZERO = new ShortMaxVector(); static final int LENGTH = SPECIES.length();
*** 72,82 **** } return new ShortMaxVector(res); } @Override ! ShortMaxVector uOp(Mask<Short> o, FUnOp f) { short[] vec = getElements(); short[] res = new short[length()]; boolean[] mbits = ((ShortMaxMask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i]; --- 72,82 ---- } return new ShortMaxVector(res); } @Override ! ShortMaxVector uOp(VectorMask<Short> o, FUnOp f) { short[] vec = getElements(); short[] res = new short[length()]; boolean[] mbits = ((ShortMaxMask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i];
*** 96,106 **** } return new ShortMaxVector(res); } @Override ! ShortMaxVector bOp(Vector<Short> o1, Mask<Short> o2, FBinOp f) { short[] res = new short[length()]; short[] vec1 = this.getElements(); short[] vec2 = ((ShortMaxVector)o1).getElements(); boolean[] mbits = ((ShortMaxMask)o2).getBits(); for (int i = 0; i < length(); i++) { --- 96,106 ---- } return new ShortMaxVector(res); } @Override ! ShortMaxVector bOp(Vector<Short> o1, VectorMask<Short> o2, FBinOp f) { short[] res = new short[length()]; short[] vec1 = this.getElements(); short[] vec2 = ((ShortMaxVector)o1).getElements(); boolean[] mbits = ((ShortMaxMask)o2).getBits(); for (int i = 0; i < length(); i++) {
*** 122,132 **** } return new ShortMaxVector(res); } @Override ! ShortMaxVector tOp(Vector<Short> o1, Vector<Short> o2, Mask<Short> o3, FTriOp f) { short[] res = new short[length()]; short[] vec1 = getElements(); short[] vec2 = ((ShortMaxVector)o1).getElements(); short[] vec3 = ((ShortMaxVector)o2).getElements(); boolean[] mbits = ((ShortMaxMask)o3).getBits(); --- 122,132 ---- } return new ShortMaxVector(res); } @Override ! ShortMaxVector tOp(Vector<Short> o1, Vector<Short> o2, VectorMask<Short> o3, FTriOp f) { short[] res = new short[length()]; short[] vec1 = getElements(); short[] vec2 = ((ShortMaxVector)o1).getElements(); short[] vec3 = ((ShortMaxVector)o2).getElements(); boolean[] mbits = ((ShortMaxMask)o3).getBits();
*** 145,155 **** return v; } @Override @ForceInline ! public <F> Vector<F> cast(Species<F> s) { Objects.requireNonNull(s); if (s.length() != LENGTH) throw new IllegalArgumentException("Vector length this species length differ"); return VectorIntrinsics.cast( --- 145,155 ---- return v; } @Override @ForceInline ! public <F> Vector<F> cast(VectorSpecies<F> s) { Objects.requireNonNull(s); if (s.length() != LENGTH) throw new IllegalArgumentException("Vector length this species length differ"); return VectorIntrinsics.cast(
*** 162,234 **** ); } @SuppressWarnings("unchecked") @ForceInline ! private <F> Vector<F> castDefault(Species<F> s) { int limit = s.length(); Class<?> stype = s.elementType(); if (stype == byte.class) { byte[] a = new byte[limit]; for (int i = 0; i < limit; i++) { a[i] = (byte) this.get(i); } ! return (Vector) ByteVector.fromArray((Species<Byte>) 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<Short>) 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<Integer>) 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<Long>) 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<Float>) 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<Double>) s, a, 0); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override @ForceInline @SuppressWarnings("unchecked") ! public <F> Vector<F> reinterpret(Species<F> s) { Objects.requireNonNull(s); if(s.elementType().equals(short.class)) { ! return (Vector<F>) reshape((Species<Short>)s); } if(s.bitSize() == bitSize()) { return reinterpretType(s); } return defaultReinterpret(s); } @ForceInline ! private <F> Vector<F> reinterpretType(Species<F> s) { Objects.requireNonNull(s); Class<?> stype = s.elementType(); if (stype == byte.class) { return VectorIntrinsics.reinterpret( --- 162,234 ---- ); } @SuppressWarnings("unchecked") @ForceInline ! private <F> Vector<F> castDefault(VectorSpecies<F> s) { int limit = s.length(); Class<?> stype = s.elementType(); if (stype == byte.class) { byte[] a = new byte[limit]; for (int i = 0; i < limit; i++) { a[i] = (byte) this.get(i); } ! return (Vector) ByteVector.fromArray((VectorSpecies<Byte>) 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((VectorSpecies<Short>) 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((VectorSpecies<Integer>) 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((VectorSpecies<Long>) 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((VectorSpecies<Float>) 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((VectorSpecies<Double>) s, a, 0); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override @ForceInline @SuppressWarnings("unchecked") ! public <F> Vector<F> reinterpret(VectorSpecies<F> s) { Objects.requireNonNull(s); if(s.elementType().equals(short.class)) { ! return (Vector<F>) reshape((VectorSpecies<Short>)s); } if(s.bitSize() == bitSize()) { return reinterpretType(s); } return defaultReinterpret(s); } @ForceInline ! private <F> Vector<F> reinterpretType(VectorSpecies<F> s) { Objects.requireNonNull(s); Class<?> stype = s.elementType(); if (stype == byte.class) { return VectorIntrinsics.reinterpret(
*** 289,299 **** } } @Override @ForceInline ! public ShortVector reshape(Species<Short> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Short64Vector.class)) { return VectorIntrinsics.reinterpret( ShortMaxVector.class, short.class, LENGTH, --- 289,299 ---- } } @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,
*** 352,362 **** return add((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector add(short o, Mask<Short> m) { return add((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 352,362 ---- return add((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector add(short o, VectorMask<Short> m) { return add((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 364,374 **** return sub((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector sub(short o, Mask<Short> m) { return sub((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 364,374 ---- return sub((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector sub(short o, VectorMask<Short> m) { return sub((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 376,386 **** return mul((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector mul(short o, Mask<Short> m) { return mul((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 376,386 ---- return mul((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector mul(short o, VectorMask<Short> m) { return mul((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 394,440 **** return max((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> equal(short o) { return equal((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> notEqual(short o) { return notEqual((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> lessThan(short o) { return lessThan((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> lessThanEq(short o) { return lessThanEq((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> greaterThan(short o) { return greaterThan((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Short> greaterThanEq(short o) { return greaterThanEq((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector blend(short o, Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override --- 394,440 ---- return max((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> equal(short o) { return equal((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> notEqual(short o) { return notEqual((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> lessThan(short o) { return lessThan((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> lessThanEq(short o) { return lessThanEq((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> greaterThan(short o) { return greaterThan((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Short> greaterThanEq(short o) { return greaterThanEq((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector blend(short o, VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override
*** 443,453 **** return and((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector and(short o, Mask<Short> m) { return and((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 443,453 ---- return and((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector and(short o, VectorMask<Short> m) { return and((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 455,465 **** return or((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector or(short o, Mask<Short> m) { return or((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 455,465 ---- return or((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector or(short o, VectorMask<Short> m) { return or((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 467,477 **** return xor((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector xor(short o, Mask<Short> m) { return xor((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 467,477 ---- return xor((ShortMaxVector)ShortVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ShortVector xor(short o, VectorMask<Short> m) { return xor((ShortMaxVector)ShortVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 481,491 **** // Unary operations @ForceInline @Override ! public ShortMaxVector neg(Mask<Short> m) { return blend(neg(), m); } @Override @ForceInline --- 481,491 ---- // Unary operations @ForceInline @Override ! public ShortMaxVector neg(VectorMask<Short> m) { return blend(neg(), m); } @Override @ForceInline
*** 496,506 **** v1 -> v1.uOp((i, a) -> (short) Math.abs(a))); } @ForceInline @Override ! public ShortMaxVector abs(Mask<Short> m) { return blend(abs(), m); } @Override --- 496,506 ---- v1 -> v1.uOp((i, a) -> (short) Math.abs(a))); } @ForceInline @Override ! public ShortMaxVector abs(VectorMask<Short> m) { return blend(abs(), m); } @Override
*** 512,522 **** v1 -> v1.uOp((i, a) -> (short) ~a)); } @ForceInline @Override ! public ShortMaxVector not(Mask<Short> m) { return blend(not(), m); } // Binary operations @Override --- 512,522 ---- v1 -> v1.uOp((i, a) -> (short) ~a)); } @ForceInline @Override ! public ShortMaxVector not(VectorMask<Short> m) { return blend(not(), m); } // Binary operations @Override
*** 530,540 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a + b))); } @Override @ForceInline ! public ShortMaxVector add(Vector<Short> v, Mask<Short> m) { return blend(add(v), m); } @Override @ForceInline --- 530,540 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a + b))); } @Override @ForceInline ! public ShortMaxVector add(Vector<Short> v, VectorMask<Short> m) { return blend(add(v), m); } @Override @ForceInline
*** 547,557 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a - b))); } @Override @ForceInline ! public ShortMaxVector sub(Vector<Short> v, Mask<Short> m) { return blend(sub(v), m); } @Override @ForceInline --- 547,557 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a - b))); } @Override @ForceInline ! public ShortMaxVector sub(Vector<Short> v, VectorMask<Short> m) { return blend(sub(v), m); } @Override @ForceInline
*** 564,574 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a * b))); } @Override @ForceInline ! public ShortMaxVector mul(Vector<Short> v, Mask<Short> m) { return blend(mul(v), m); } @Override @ForceInline --- 564,574 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a * b))); } @Override @ForceInline ! public ShortMaxVector mul(Vector<Short> v, VectorMask<Short> m) { return blend(mul(v), m); } @Override @ForceInline
*** 581,591 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short) Math.min(a, b))); } @Override @ForceInline ! public ShortMaxVector min(Vector<Short> v, Mask<Short> m) { return blend(min(v), m); } @Override @ForceInline --- 581,591 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short) Math.min(a, b))); } @Override @ForceInline ! public ShortMaxVector min(Vector<Short> v, VectorMask<Short> m) { return blend(min(v), m); } @Override @ForceInline
*** 598,608 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short) Math.max(a, b))); } @Override @ForceInline ! public ShortMaxVector max(Vector<Short> v, Mask<Short> m) { return blend(max(v), m); } @Override @ForceInline --- 598,608 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short) Math.max(a, b))); } @Override @ForceInline ! public ShortMaxVector max(Vector<Short> v, VectorMask<Short> m) { return blend(max(v), m); } @Override @ForceInline
*** 637,659 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a ^ b))); } @Override @ForceInline ! public ShortMaxVector and(Vector<Short> v, Mask<Short> m) { return blend(and(v), m); } @Override @ForceInline ! public ShortMaxVector or(Vector<Short> v, Mask<Short> m) { return blend(or(v), m); } @Override @ForceInline ! public ShortMaxVector xor(Vector<Short> v, Mask<Short> m) { return blend(xor(v), m); } @Override @ForceInline --- 637,659 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (short)(a ^ b))); } @Override @ForceInline ! public ShortMaxVector and(Vector<Short> v, VectorMask<Short> m) { return blend(and(v), m); } @Override @ForceInline ! public ShortMaxVector or(Vector<Short> v, VectorMask<Short> m) { return blend(or(v), m); } @Override @ForceInline ! public ShortMaxVector xor(Vector<Short> v, VectorMask<Short> m) { return blend(xor(v), m); } @Override @ForceInline
*** 664,674 **** (v, i) -> v.uOp((__, a) -> (short) (a << (i & 15)))); } @Override @ForceInline ! public ShortMaxVector shiftL(int s, Mask<Short> m) { return blend(shiftL(s), m); } @Override @ForceInline --- 664,674 ---- (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
*** 679,689 **** (v, i) -> v.uOp((__, a) -> (short) ((a & 0xFFFF) >>> (i & 15)))); } @Override @ForceInline ! public ShortMaxVector shiftR(int s, Mask<Short> m) { return blend(shiftR(s), m); } @Override @ForceInline --- 679,689 ---- (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
*** 694,704 **** (v, i) -> v.uOp((__, a) -> (short) (a >> (i & 15)))); } @Override @ForceInline ! public ShortMaxVector aShiftR(int s, Mask<Short> m) { return blend(aShiftR(s), m); } // Ternary operations --- 694,704 ---- (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
*** 722,732 **** v -> (long) v.rOp((short) -1, (i, a, b) -> (short) (a & b))); } @Override @ForceInline ! public short andAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) -1), m).andAll(); } @Override @ForceInline --- 722,732 ---- v -> (long) v.rOp((short) -1, (i, a, b) -> (short) (a & b))); } @Override @ForceInline ! public short andAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) -1), m).andAll(); } @Override @ForceInline
*** 764,774 **** v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a | b))); } @Override @ForceInline ! public short orAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).orAll(); } @Override @ForceInline --- 764,774 ---- v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a | b))); } @Override @ForceInline ! public short orAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).orAll(); } @Override @ForceInline
*** 779,827 **** v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a ^ b))); } @Override @ForceInline ! public short xorAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).xorAll(); } @Override @ForceInline ! public short addAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).addAll(); } @Override @ForceInline ! public short mulAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 1), m).mulAll(); } @Override @ForceInline ! public short minAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, Short.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public short maxAll(Mask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, Short.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public Shuffle<Short> toShuffle() { short[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } ! return ShortVector.shuffleFromArray(SPECIES, sa, 0); } // Memory operations private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_SHORT_INDEX_SCALE); --- 779,827 ---- v -> (long) v.rOp((short) 0, (i, a, b) -> (short) (a ^ b))); } @Override @ForceInline ! public short xorAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).xorAll(); } @Override @ForceInline ! public short addAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 0), m).addAll(); } @Override @ForceInline ! public short mulAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, (short) 1), m).mulAll(); } @Override @ForceInline ! public short minAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, Short.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public short maxAll(VectorMask<Short> m) { return blend((ShortMaxVector)ShortVector.broadcast(SPECIES, Short.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public VectorShuffle<Short> toShuffle() { short[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } ! return VectorShuffle.fromArray(SPECIES, sa, 0); } // Memory operations private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_SHORT_INDEX_SCALE);
*** 839,849 **** (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(short[] a, int ax, Mask<Short> m) { ShortVector oldVal = ShortVector.fromArray(SPECIES, a, ax); ShortVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } --- 839,849 ---- (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(short[] a, int ax, VectorMask<Short> m) { ShortVector oldVal = ShortVector.fromArray(SPECIES, a, ax); ShortVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); }
*** 863,873 **** }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, Mask<Short> m) { ShortMaxVector oldVal = (ShortMaxVector) ShortVector.fromByteArray(SPECIES, a, ix); ShortMaxVector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); } --- 863,873 ---- }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, VectorMask<Short> m) { ShortMaxVector oldVal = (ShortMaxVector) ShortVector.fromByteArray(SPECIES, a, ix); ShortMaxVector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); }
*** 892,902 **** }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, Mask<Short> m) { ShortMaxVector oldVal = (ShortMaxVector) ShortVector.fromByteBuffer(SPECIES, bb, ix); ShortMaxVector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); } --- 892,902 ---- }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Short> m) { ShortMaxVector oldVal = (ShortMaxVector) ShortVector.fromByteBuffer(SPECIES, bb, ix); ShortMaxVector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); }
*** 1017,1027 **** f.apply(i, vec[i]); } } @Override ! void forEach(Mask<Short> o, FUnCon f) { boolean[] mbits = ((ShortMaxMask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); } --- 1017,1027 ---- f.apply(i, vec[i]); } } @Override ! void forEach(VectorMask<Short> o, FUnCon f) { boolean[] mbits = ((ShortMaxMask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); }
*** 1074,1090 **** } @Override @ForceInline public ShortMaxVector rearrange(Vector<Short> v, ! Shuffle<Short> s, Mask<Short> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public ShortMaxVector rearrange(Shuffle<Short> o1) { Objects.requireNonNull(o1); ShortMaxShuffle s = (ShortMaxShuffle)o1; return VectorIntrinsics.rearrangeOp( ShortMaxVector.class, ShortMaxShuffle.class, short.class, LENGTH, --- 1074,1090 ---- } @Override @ForceInline public ShortMaxVector rearrange(Vector<Short> v, ! VectorShuffle<Short> s, VectorMask<Short> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public ShortMaxVector rearrange(VectorShuffle<Short> o1) { Objects.requireNonNull(o1); ShortMaxShuffle s = (ShortMaxShuffle)o1; return VectorIntrinsics.rearrangeOp( ShortMaxVector.class, ShortMaxShuffle.class, short.class, LENGTH,
*** 1095,1105 **** })); } @Override @ForceInline ! public ShortMaxVector blend(Vector<Short> o1, Mask<Short> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); ShortMaxVector v = (ShortMaxVector)o1; ShortMaxMask m = (ShortMaxMask)o2; --- 1095,1105 ---- })); } @Override @ForceInline ! public ShortMaxVector blend(Vector<Short> o1, VectorMask<Short> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); ShortMaxVector v = (ShortMaxVector)o1; ShortMaxMask m = (ShortMaxMask)o2;
*** 1179,1200 **** } return new ShortMaxMask(res); } @Override ! ShortMaxMask bOp(Mask<Short> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((ShortMaxMask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new ShortMaxMask(res); } @Override ! public Species<Short> species() { return SPECIES; } @Override public ShortMaxVector toVector() { --- 1179,1200 ---- } return new ShortMaxMask(res); } @Override ! ShortMaxMask bOp(VectorMask<Short> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((ShortMaxMask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new ShortMaxMask(res); } @Override ! public VectorSpecies<Short> species() { return SPECIES; } @Override public ShortMaxVector toVector() {
*** 1209,1235 **** } @Override @ForceInline @SuppressWarnings("unchecked") ! public <E> Mask<E> cast(Species<E> species) { if (length() != species.length()) ! throw new IllegalArgumentException("Mask length and species length differ"); Class<?> stype = species.elementType(); boolean [] maskArray = toArray(); if (stype == byte.class) { ! return (Mask <E>) new ByteMaxVector.ByteMaxMask(maskArray); } else if (stype == short.class) { ! return (Mask <E>) new ShortMaxVector.ShortMaxMask(maskArray); } else if (stype == int.class) { ! return (Mask <E>) new IntMaxVector.IntMaxMask(maskArray); } else if (stype == long.class) { ! return (Mask <E>) new LongMaxVector.LongMaxMask(maskArray); } else if (stype == float.class) { ! return (Mask <E>) new FloatMaxVector.FloatMaxMask(maskArray); } else if (stype == double.class) { ! return (Mask <E>) new DoubleMaxVector.DoubleMaxMask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } --- 1209,1235 ---- } @Override @ForceInline @SuppressWarnings("unchecked") ! public <E> VectorMask<E> cast(VectorSpecies<E> species) { if (length() != species.length()) ! throw new IllegalArgumentException("VectorMask length and species length differ"); Class<?> stype = species.elementType(); boolean [] maskArray = toArray(); if (stype == byte.class) { ! return (VectorMask <E>) new ByteMaxVector.ByteMaxMask(maskArray); } else if (stype == short.class) { ! return (VectorMask <E>) new ShortMaxVector.ShortMaxMask(maskArray); } else if (stype == int.class) { ! return (VectorMask <E>) new IntMaxVector.IntMaxMask(maskArray); } else if (stype == long.class) { ! return (VectorMask <E>) new LongMaxVector.LongMaxMask(maskArray); } else if (stype == float.class) { ! return (VectorMask <E>) new FloatMaxVector.FloatMaxMask(maskArray); } else if (stype == double.class) { ! return (VectorMask <E>) new DoubleMaxVector.DoubleMaxMask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } }
*** 1246,1266 **** // Binary operations @Override @ForceInline ! public ShortMaxMask and(Mask<Short> o) { Objects.requireNonNull(o); ShortMaxMask m = (ShortMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, short.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public ShortMaxMask or(Mask<Short> o) { Objects.requireNonNull(o); ShortMaxMask m = (ShortMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, short.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b)); --- 1246,1266 ---- // Binary operations @Override @ForceInline ! public ShortMaxMask and(VectorMask<Short> o) { Objects.requireNonNull(o); ShortMaxMask m = (ShortMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, short.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public ShortMaxMask or(VectorMask<Short> o) { Objects.requireNonNull(o); ShortMaxMask m = (ShortMaxMask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, short.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
*** 1278,1288 **** @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, ShortMaxMask.class, short.class, LENGTH, ! this, ShortVector.maskAllTrue(species()), (m, __) -> allTrueHelper(((ShortMaxMask)m).getBits())); } } // Shuffle --- 1278,1288 ---- @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, ShortMaxMask.class, short.class, LENGTH, ! this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((ShortMaxMask)m).getBits())); } } // Shuffle
*** 1303,1313 **** public ShortMaxShuffle(IntUnaryOperator f) { super(f); } @Override ! public Species<Short> species() { return SPECIES; } @Override public ShortVector toVector() { --- 1303,1313 ---- public ShortMaxShuffle(IntUnaryOperator f) { super(f); } @Override ! public VectorSpecies<Short> species() { return SPECIES; } @Override public ShortVector toVector() {
*** 1319,1363 **** } @Override @ForceInline @SuppressWarnings("unchecked") ! public <F> Shuffle<F> cast(Species<F> 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<F>) new ByteMaxVector.ByteMaxShuffle(shuffleArray); } else if (stype == short.class) { ! return (Shuffle<F>) new ShortMaxVector.ShortMaxShuffle(shuffleArray); } else if (stype == int.class) { ! return (Shuffle<F>) new IntMaxVector.IntMaxShuffle(shuffleArray); } else if (stype == long.class) { ! return (Shuffle<F>) new LongMaxVector.LongMaxShuffle(shuffleArray); } else if (stype == float.class) { ! return (Shuffle<F>) new FloatMaxVector.FloatMaxShuffle(shuffleArray); } else if (stype == double.class) { ! return (Shuffle<F>) new DoubleMaxVector.DoubleMaxShuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public ShortMaxShuffle rearrange(Vector.Shuffle<Short> o) { ShortMaxShuffle s = (ShortMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new ShortMaxShuffle(r); } } ! // Species @Override ! public Species<Short> species() { return SPECIES; } } --- 1319,1363 ---- } @Override @ForceInline @SuppressWarnings("unchecked") ! public <F> VectorShuffle<F> cast(VectorSpecies<F> 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 (VectorShuffle<F>) new ByteMaxVector.ByteMaxShuffle(shuffleArray); } else if (stype == short.class) { ! return (VectorShuffle<F>) new ShortMaxVector.ShortMaxShuffle(shuffleArray); } else if (stype == int.class) { ! return (VectorShuffle<F>) new IntMaxVector.IntMaxShuffle(shuffleArray); } else if (stype == long.class) { ! return (VectorShuffle<F>) new LongMaxVector.LongMaxShuffle(shuffleArray); } else if (stype == float.class) { ! return (VectorShuffle<F>) new FloatMaxVector.FloatMaxShuffle(shuffleArray); } else if (stype == double.class) { ! return (VectorShuffle<F>) new DoubleMaxVector.DoubleMaxShuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public ShortMaxShuffle rearrange(VectorShuffle<Short> o) { ShortMaxShuffle s = (ShortMaxShuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new ShortMaxShuffle(r); } } ! // VectorSpecies @Override ! public VectorSpecies<Short> species() { return SPECIES; } }
< prev index next >