< prev index next >

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

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

*** 36,57 **** import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class Long128Vector extends LongVector { ! private static final Species<Long> SPECIES = LongVector.SPECIES_128; static final Long128Vector ZERO = new Long128Vector(); static final int LENGTH = SPECIES.length(); // Index vector species private static final IntVector.IntSpecies INDEX_SPECIES; static { int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH); ! INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(Shape.forBitSize(bitSize)); } private final long[] vec; // Don't access directly, use getElements() instead. private long[] getElements() { --- 36,57 ---- import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class Long128Vector extends LongVector { ! private static final VectorSpecies<Long> SPECIES = LongVector.SPECIES_128; static final Long128Vector ZERO = new Long128Vector(); static final int LENGTH = SPECIES.length(); // Index vector species private static final IntVector.IntSpecies INDEX_SPECIES; static { int bitSize = Vector.bitSizeForVectorLength(int.class, LENGTH); ! INDEX_SPECIES = (IntVector.IntSpecies) IntVector.species(VectorShape.forBitSize(bitSize)); } private final long[] vec; // Don't access directly, use getElements() instead. private long[] getElements() {
*** 80,90 **** } return new Long128Vector(res); } @Override ! Long128Vector uOp(Mask<Long> o, FUnOp f) { long[] vec = getElements(); long[] res = new long[length()]; boolean[] mbits = ((Long128Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i]; --- 80,90 ---- } return new Long128Vector(res); } @Override ! Long128Vector uOp(VectorMask<Long> o, FUnOp f) { long[] vec = getElements(); long[] res = new long[length()]; boolean[] mbits = ((Long128Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i];
*** 104,114 **** } return new Long128Vector(res); } @Override ! Long128Vector bOp(Vector<Long> o1, Mask<Long> o2, FBinOp f) { long[] res = new long[length()]; long[] vec1 = this.getElements(); long[] vec2 = ((Long128Vector)o1).getElements(); boolean[] mbits = ((Long128Mask)o2).getBits(); for (int i = 0; i < length(); i++) { --- 104,114 ---- } return new Long128Vector(res); } @Override ! Long128Vector bOp(Vector<Long> o1, VectorMask<Long> o2, FBinOp f) { long[] res = new long[length()]; long[] vec1 = this.getElements(); long[] vec2 = ((Long128Vector)o1).getElements(); boolean[] mbits = ((Long128Mask)o2).getBits(); for (int i = 0; i < length(); i++) {
*** 130,140 **** } return new Long128Vector(res); } @Override ! Long128Vector tOp(Vector<Long> o1, Vector<Long> o2, Mask<Long> o3, FTriOp f) { long[] res = new long[length()]; long[] vec1 = getElements(); long[] vec2 = ((Long128Vector)o1).getElements(); long[] vec3 = ((Long128Vector)o2).getElements(); boolean[] mbits = ((Long128Mask)o3).getBits(); --- 130,140 ---- } return new Long128Vector(res); } @Override ! Long128Vector tOp(Vector<Long> o1, Vector<Long> o2, VectorMask<Long> o3, FTriOp f) { long[] res = new long[length()]; long[] vec1 = getElements(); long[] vec2 = ((Long128Vector)o1).getElements(); long[] vec3 = ((Long128Vector)o2).getElements(); boolean[] mbits = ((Long128Mask)o3).getBits();
*** 153,163 **** 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( --- 153,163 ---- 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(
*** 170,242 **** ); } @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(long.class)) { ! return (Vector<F>) reshape((Species<Long>)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( --- 170,242 ---- ); } @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(long.class)) { ! return (Vector<F>) reshape((VectorSpecies<Long>)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(
*** 297,307 **** } } @Override @ForceInline ! public LongVector reshape(Species<Long> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Long64Vector.class)) { return VectorIntrinsics.reinterpret( Long128Vector.class, long.class, LENGTH, --- 297,307 ---- } } @Override @ForceInline ! public LongVector reshape(VectorSpecies<Long> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Long64Vector.class)) { return VectorIntrinsics.reinterpret( Long128Vector.class, long.class, LENGTH,
*** 360,370 **** return add((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector add(long o, Mask<Long> m) { return add((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 360,370 ---- return add((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector add(long o, VectorMask<Long> m) { return add((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 372,382 **** return sub((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector sub(long o, Mask<Long> m) { return sub((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 372,382 ---- return sub((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector sub(long o, VectorMask<Long> m) { return sub((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 384,394 **** return mul((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector mul(long o, Mask<Long> m) { return mul((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 384,394 ---- return mul((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector mul(long o, VectorMask<Long> m) { return mul((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 402,448 **** return max((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> equal(long o) { return equal((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> notEqual(long o) { return notEqual((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> lessThan(long o) { return lessThan((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> lessThanEq(long o) { return lessThanEq((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> greaterThan(long o) { return greaterThan((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Long> greaterThanEq(long o) { return greaterThanEq((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector blend(long o, Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override --- 402,448 ---- return max((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> equal(long o) { return equal((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> notEqual(long o) { return notEqual((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> lessThan(long o) { return lessThan((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> lessThanEq(long o) { return lessThanEq((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> greaterThan(long o) { return greaterThan((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Long> greaterThanEq(long o) { return greaterThanEq((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector blend(long o, VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override
*** 451,461 **** return and((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector and(long o, Mask<Long> m) { return and((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 451,461 ---- return and((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector and(long o, VectorMask<Long> m) { return and((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 463,473 **** return or((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector or(long o, Mask<Long> m) { return or((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 463,473 ---- return or((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector or(long o, VectorMask<Long> m) { return or((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 475,485 **** return xor((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector xor(long o, Mask<Long> m) { return xor((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 475,485 ---- return xor((Long128Vector)LongVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public LongVector xor(long o, VectorMask<Long> m) { return xor((Long128Vector)LongVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 489,499 **** // Unary operations @ForceInline @Override ! public Long128Vector neg(Mask<Long> m) { return blend(neg(), m); } @Override @ForceInline --- 489,499 ---- // Unary operations @ForceInline @Override ! public Long128Vector neg(VectorMask<Long> m) { return blend(neg(), m); } @Override @ForceInline
*** 504,514 **** v1 -> v1.uOp((i, a) -> (long) Math.abs(a))); } @ForceInline @Override ! public Long128Vector abs(Mask<Long> m) { return blend(abs(), m); } @Override --- 504,514 ---- v1 -> v1.uOp((i, a) -> (long) Math.abs(a))); } @ForceInline @Override ! public Long128Vector abs(VectorMask<Long> m) { return blend(abs(), m); } @Override
*** 520,530 **** v1 -> v1.uOp((i, a) -> (long) ~a)); } @ForceInline @Override ! public Long128Vector not(Mask<Long> m) { return blend(not(), m); } // Binary operations @Override --- 520,530 ---- v1 -> v1.uOp((i, a) -> (long) ~a)); } @ForceInline @Override ! public Long128Vector not(VectorMask<Long> m) { return blend(not(), m); } // Binary operations @Override
*** 538,548 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a + b))); } @Override @ForceInline ! public Long128Vector add(Vector<Long> v, Mask<Long> m) { return blend(add(v), m); } @Override @ForceInline --- 538,548 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a + b))); } @Override @ForceInline ! public Long128Vector add(Vector<Long> v, VectorMask<Long> m) { return blend(add(v), m); } @Override @ForceInline
*** 555,565 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a - b))); } @Override @ForceInline ! public Long128Vector sub(Vector<Long> v, Mask<Long> m) { return blend(sub(v), m); } @Override @ForceInline --- 555,565 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a - b))); } @Override @ForceInline ! public Long128Vector sub(Vector<Long> v, VectorMask<Long> m) { return blend(sub(v), m); } @Override @ForceInline
*** 572,582 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a * b))); } @Override @ForceInline ! public Long128Vector mul(Vector<Long> v, Mask<Long> m) { return blend(mul(v), m); } @Override @ForceInline --- 572,582 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a * b))); } @Override @ForceInline ! public Long128Vector mul(Vector<Long> v, VectorMask<Long> m) { return blend(mul(v), m); } @Override @ForceInline
*** 589,599 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long) Math.min(a, b))); } @Override @ForceInline ! public Long128Vector min(Vector<Long> v, Mask<Long> m) { return blend(min(v), m); } @Override @ForceInline --- 589,599 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long) Math.min(a, b))); } @Override @ForceInline ! public Long128Vector min(Vector<Long> v, VectorMask<Long> m) { return blend(min(v), m); } @Override @ForceInline
*** 606,616 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long) Math.max(a, b))); } @Override @ForceInline ! public Long128Vector max(Vector<Long> v, Mask<Long> m) { return blend(max(v), m); } @Override @ForceInline --- 606,616 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long) Math.max(a, b))); } @Override @ForceInline ! public Long128Vector max(Vector<Long> v, VectorMask<Long> m) { return blend(max(v), m); } @Override @ForceInline
*** 645,667 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a ^ b))); } @Override @ForceInline ! public Long128Vector and(Vector<Long> v, Mask<Long> m) { return blend(and(v), m); } @Override @ForceInline ! public Long128Vector or(Vector<Long> v, Mask<Long> m) { return blend(or(v), m); } @Override @ForceInline ! public Long128Vector xor(Vector<Long> v, Mask<Long> m) { return blend(xor(v), m); } @Override @ForceInline --- 645,667 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (long)(a ^ b))); } @Override @ForceInline ! public Long128Vector and(Vector<Long> v, VectorMask<Long> m) { return blend(and(v), m); } @Override @ForceInline ! public Long128Vector or(Vector<Long> v, VectorMask<Long> m) { return blend(or(v), m); } @Override @ForceInline ! public Long128Vector xor(Vector<Long> v, VectorMask<Long> m) { return blend(xor(v), m); } @Override @ForceInline
*** 672,682 **** (v, i) -> v.uOp((__, a) -> (long) (a << i))); } @Override @ForceInline ! public Long128Vector shiftL(int s, Mask<Long> m) { return blend(shiftL(s), m); } @Override @ForceInline --- 672,682 ---- (v, i) -> v.uOp((__, a) -> (long) (a << i))); } @Override @ForceInline ! public Long128Vector shiftL(int s, VectorMask<Long> m) { return blend(shiftL(s), m); } @Override @ForceInline
*** 687,697 **** (v, i) -> v.uOp((__, a) -> (long) (a >>> i))); } @Override @ForceInline ! public Long128Vector shiftR(int s, Mask<Long> m) { return blend(shiftR(s), m); } @Override @ForceInline --- 687,697 ---- (v, i) -> v.uOp((__, a) -> (long) (a >>> i))); } @Override @ForceInline ! public Long128Vector shiftR(int s, VectorMask<Long> m) { return blend(shiftR(s), m); } @Override @ForceInline
*** 702,712 **** (v, i) -> v.uOp((__, a) -> (long) (a >> i))); } @Override @ForceInline ! public Long128Vector aShiftR(int s, Mask<Long> m) { return blend(aShiftR(s), m); } @Override @ForceInline --- 702,712 ---- (v, i) -> v.uOp((__, a) -> (long) (a >> i))); } @Override @ForceInline ! public Long128Vector aShiftR(int s, VectorMask<Long> m) { return blend(aShiftR(s), m); } @Override @ForceInline
*** 766,776 **** v -> (long) v.rOp((long) -1, (i, a, b) -> (long) (a & b))); } @Override @ForceInline ! public long andAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) -1), m).andAll(); } @Override @ForceInline --- 766,776 ---- v -> (long) v.rOp((long) -1, (i, a, b) -> (long) (a & b))); } @Override @ForceInline ! public long andAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) -1), m).andAll(); } @Override @ForceInline
*** 808,818 **** v -> (long) v.rOp((long) 0, (i, a, b) -> (long) (a | b))); } @Override @ForceInline ! public long orAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).orAll(); } @Override @ForceInline --- 808,818 ---- v -> (long) v.rOp((long) 0, (i, a, b) -> (long) (a | b))); } @Override @ForceInline ! public long orAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).orAll(); } @Override @ForceInline
*** 823,871 **** v -> (long) v.rOp((long) 0, (i, a, b) -> (long) (a ^ b))); } @Override @ForceInline ! public long xorAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).xorAll(); } @Override @ForceInline ! public long addAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).addAll(); } @Override @ForceInline ! public long mulAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 1), m).mulAll(); } @Override @ForceInline ! public long minAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public long maxAll(Mask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, Long.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public Shuffle<Long> toShuffle() { long[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } ! return LongVector.shuffleFromArray(SPECIES, sa, 0); } // Memory operations private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_LONG_INDEX_SCALE); --- 823,871 ---- v -> (long) v.rOp((long) 0, (i, a, b) -> (long) (a ^ b))); } @Override @ForceInline ! public long xorAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).xorAll(); } @Override @ForceInline ! public long addAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 0), m).addAll(); } @Override @ForceInline ! public long mulAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, (long) 1), m).mulAll(); } @Override @ForceInline ! public long minAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, Long.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public long maxAll(VectorMask<Long> m) { return blend((Long128Vector)LongVector.broadcast(SPECIES, Long.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public VectorShuffle<Long> toShuffle() { long[] 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_LONG_INDEX_SCALE);
*** 883,893 **** (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(long[] a, int ax, Mask<Long> m) { LongVector oldVal = LongVector.fromArray(SPECIES, a, ax); LongVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } @Override --- 883,893 ---- (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(long[] a, int ax, VectorMask<Long> m) { LongVector oldVal = LongVector.fromArray(SPECIES, a, ax); LongVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } @Override
*** 908,918 **** (arr, idx, v, indexMap, idy) -> v.forEach((i, e) -> arr[idx+indexMap[idy+i]] = e)); } @Override @ForceInline ! public final void intoArray(long[] a, int ax, Mask<Long> m, int[] b, int iy) { // @@@ This can result in out of bounds errors for unset mask lanes LongVector oldVal = LongVector.fromArray(SPECIES, a, ax, b, iy); LongVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax, b, iy); } --- 908,918 ---- (arr, idx, v, indexMap, idy) -> v.forEach((i, e) -> arr[idx+indexMap[idy+i]] = e)); } @Override @ForceInline ! public final void intoArray(long[] a, int ax, VectorMask<Long> m, int[] b, int iy) { // @@@ This can result in out of bounds errors for unset mask lanes LongVector oldVal = LongVector.fromArray(SPECIES, a, ax, b, iy); LongVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax, b, iy); }
*** 933,943 **** }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, Mask<Long> m) { Long128Vector oldVal = (Long128Vector) LongVector.fromByteArray(SPECIES, a, ix); Long128Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); } --- 933,943 ---- }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, VectorMask<Long> m) { Long128Vector oldVal = (Long128Vector) LongVector.fromByteArray(SPECIES, a, ix); Long128Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); }
*** 962,972 **** }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, Mask<Long> m) { Long128Vector oldVal = (Long128Vector) LongVector.fromByteBuffer(SPECIES, bb, ix); Long128Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); } --- 962,972 ---- }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Long> m) { Long128Vector oldVal = (Long128Vector) LongVector.fromByteBuffer(SPECIES, bb, ix); Long128Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); }
*** 1087,1097 **** f.apply(i, vec[i]); } } @Override ! void forEach(Mask<Long> o, FUnCon f) { boolean[] mbits = ((Long128Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); } --- 1087,1097 ---- f.apply(i, vec[i]); } } @Override ! void forEach(VectorMask<Long> o, FUnCon f) { boolean[] mbits = ((Long128Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); }
*** 1152,1168 **** } @Override @ForceInline public Long128Vector rearrange(Vector<Long> v, ! Shuffle<Long> s, Mask<Long> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Long128Vector rearrange(Shuffle<Long> o1) { Objects.requireNonNull(o1); Long128Shuffle s = (Long128Shuffle)o1; return VectorIntrinsics.rearrangeOp( Long128Vector.class, Long128Shuffle.class, long.class, LENGTH, --- 1152,1168 ---- } @Override @ForceInline public Long128Vector rearrange(Vector<Long> v, ! VectorShuffle<Long> s, VectorMask<Long> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Long128Vector rearrange(VectorShuffle<Long> o1) { Objects.requireNonNull(o1); Long128Shuffle s = (Long128Shuffle)o1; return VectorIntrinsics.rearrangeOp( Long128Vector.class, Long128Shuffle.class, long.class, LENGTH,
*** 1173,1183 **** })); } @Override @ForceInline ! public Long128Vector blend(Vector<Long> o1, Mask<Long> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Long128Vector v = (Long128Vector)o1; Long128Mask m = (Long128Mask)o2; --- 1173,1183 ---- })); } @Override @ForceInline ! public Long128Vector blend(Vector<Long> o1, VectorMask<Long> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Long128Vector v = (Long128Vector)o1; Long128Mask m = (Long128Mask)o2;
*** 1257,1278 **** } return new Long128Mask(res); } @Override ! Long128Mask bOp(Mask<Long> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Long128Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Long128Mask(res); } @Override ! public Species<Long> species() { return SPECIES; } @Override public Long128Vector toVector() { --- 1257,1278 ---- } return new Long128Mask(res); } @Override ! Long128Mask bOp(VectorMask<Long> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Long128Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Long128Mask(res); } @Override ! public VectorSpecies<Long> species() { return SPECIES; } @Override public Long128Vector toVector() {
*** 1287,1313 **** } @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 Byte128Vector.Byte128Mask(maskArray); } else if (stype == short.class) { ! return (Mask <E>) new Short128Vector.Short128Mask(maskArray); } else if (stype == int.class) { ! return (Mask <E>) new Int128Vector.Int128Mask(maskArray); } else if (stype == long.class) { ! return (Mask <E>) new Long128Vector.Long128Mask(maskArray); } else if (stype == float.class) { ! return (Mask <E>) new Float128Vector.Float128Mask(maskArray); } else if (stype == double.class) { ! return (Mask <E>) new Double128Vector.Double128Mask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } --- 1287,1313 ---- } @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 Byte128Vector.Byte128Mask(maskArray); } else if (stype == short.class) { ! return (VectorMask <E>) new Short128Vector.Short128Mask(maskArray); } else if (stype == int.class) { ! return (VectorMask <E>) new Int128Vector.Int128Mask(maskArray); } else if (stype == long.class) { ! return (VectorMask <E>) new Long128Vector.Long128Mask(maskArray); } else if (stype == float.class) { ! return (VectorMask <E>) new Float128Vector.Float128Mask(maskArray); } else if (stype == double.class) { ! return (VectorMask <E>) new Double128Vector.Double128Mask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } }
*** 1324,1344 **** // Binary operations @Override @ForceInline ! public Long128Mask and(Mask<Long> o) { Objects.requireNonNull(o); Long128Mask m = (Long128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Long128Mask.class, long.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Long128Mask or(Mask<Long> o) { Objects.requireNonNull(o); Long128Mask m = (Long128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long128Mask.class, long.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b)); --- 1324,1344 ---- // Binary operations @Override @ForceInline ! public Long128Mask and(VectorMask<Long> o) { Objects.requireNonNull(o); Long128Mask m = (Long128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Long128Mask.class, long.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Long128Mask or(VectorMask<Long> o) { Objects.requireNonNull(o); Long128Mask m = (Long128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Long128Mask.class, long.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
*** 1356,1366 **** @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Long128Mask.class, long.class, LENGTH, ! this, LongVector.maskAllTrue(species()), (m, __) -> allTrueHelper(((Long128Mask)m).getBits())); } } // Shuffle --- 1356,1366 ---- @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Long128Mask.class, long.class, LENGTH, ! this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((Long128Mask)m).getBits())); } } // Shuffle
*** 1381,1391 **** public Long128Shuffle(IntUnaryOperator f) { super(f); } @Override ! public Species<Long> species() { return SPECIES; } @Override public LongVector toVector() { --- 1381,1391 ---- public Long128Shuffle(IntUnaryOperator f) { super(f); } @Override ! public VectorSpecies<Long> species() { return SPECIES; } @Override public LongVector toVector() {
*** 1397,1441 **** } @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 Byte128Vector.Byte128Shuffle(shuffleArray); } else if (stype == short.class) { ! return (Shuffle<F>) new Short128Vector.Short128Shuffle(shuffleArray); } else if (stype == int.class) { ! return (Shuffle<F>) new Int128Vector.Int128Shuffle(shuffleArray); } else if (stype == long.class) { ! return (Shuffle<F>) new Long128Vector.Long128Shuffle(shuffleArray); } else if (stype == float.class) { ! return (Shuffle<F>) new Float128Vector.Float128Shuffle(shuffleArray); } else if (stype == double.class) { ! return (Shuffle<F>) new Double128Vector.Double128Shuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public Long128Shuffle rearrange(Vector.Shuffle<Long> o) { Long128Shuffle s = (Long128Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Long128Shuffle(r); } } ! // Species @Override ! public Species<Long> species() { return SPECIES; } } --- 1397,1441 ---- } @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 Byte128Vector.Byte128Shuffle(shuffleArray); } else if (stype == short.class) { ! return (VectorShuffle<F>) new Short128Vector.Short128Shuffle(shuffleArray); } else if (stype == int.class) { ! return (VectorShuffle<F>) new Int128Vector.Int128Shuffle(shuffleArray); } else if (stype == long.class) { ! return (VectorShuffle<F>) new Long128Vector.Long128Shuffle(shuffleArray); } else if (stype == float.class) { ! return (VectorShuffle<F>) new Float128Vector.Float128Shuffle(shuffleArray); } else if (stype == double.class) { ! return (VectorShuffle<F>) new Double128Vector.Double128Shuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public Long128Shuffle rearrange(VectorShuffle<Long> o) { Long128Shuffle s = (Long128Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Long128Shuffle(r); } } ! // VectorSpecies @Override ! public VectorSpecies<Long> species() { return SPECIES; } }
< prev index next >