< prev index next >

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

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

*** 35,45 **** import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class Byte512Vector extends ByteVector { ! private static final Species<Byte> SPECIES = ByteVector.SPECIES_512; static final Byte512Vector ZERO = new Byte512Vector(); static final int LENGTH = SPECIES.length(); --- 35,45 ---- import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class Byte512Vector extends ByteVector { ! private static final VectorSpecies<Byte> SPECIES = ByteVector.SPECIES_512; static final Byte512Vector ZERO = new Byte512Vector(); static final int LENGTH = SPECIES.length();
*** 71,81 **** } return new Byte512Vector(res); } @Override ! Byte512Vector uOp(Mask<Byte> o, FUnOp f) { byte[] vec = getElements(); byte[] res = new byte[length()]; boolean[] mbits = ((Byte512Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i]; --- 71,81 ---- } return new Byte512Vector(res); } @Override ! Byte512Vector uOp(VectorMask<Byte> o, FUnOp f) { byte[] vec = getElements(); byte[] res = new byte[length()]; boolean[] mbits = ((Byte512Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i];
*** 95,105 **** } return new Byte512Vector(res); } @Override ! Byte512Vector bOp(Vector<Byte> o1, Mask<Byte> o2, FBinOp f) { byte[] res = new byte[length()]; byte[] vec1 = this.getElements(); byte[] vec2 = ((Byte512Vector)o1).getElements(); boolean[] mbits = ((Byte512Mask)o2).getBits(); for (int i = 0; i < length(); i++) { --- 95,105 ---- } return new Byte512Vector(res); } @Override ! Byte512Vector bOp(Vector<Byte> o1, VectorMask<Byte> o2, FBinOp f) { byte[] res = new byte[length()]; byte[] vec1 = this.getElements(); byte[] vec2 = ((Byte512Vector)o1).getElements(); boolean[] mbits = ((Byte512Mask)o2).getBits(); for (int i = 0; i < length(); i++) {
*** 121,131 **** } return new Byte512Vector(res); } @Override ! Byte512Vector tOp(Vector<Byte> o1, Vector<Byte> o2, Mask<Byte> o3, FTriOp f) { byte[] res = new byte[length()]; byte[] vec1 = getElements(); byte[] vec2 = ((Byte512Vector)o1).getElements(); byte[] vec3 = ((Byte512Vector)o2).getElements(); boolean[] mbits = ((Byte512Mask)o3).getBits(); --- 121,131 ---- } return new Byte512Vector(res); } @Override ! Byte512Vector tOp(Vector<Byte> o1, Vector<Byte> o2, VectorMask<Byte> o3, FTriOp f) { byte[] res = new byte[length()]; byte[] vec1 = getElements(); byte[] vec2 = ((Byte512Vector)o1).getElements(); byte[] vec3 = ((Byte512Vector)o2).getElements(); boolean[] mbits = ((Byte512Mask)o3).getBits();
*** 144,154 **** 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( --- 144,154 ---- 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(
*** 161,233 **** ); } @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(byte.class)) { ! return (Vector<F>) reshape((Species<Byte>)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( --- 161,233 ---- ); } @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(byte.class)) { ! return (Vector<F>) reshape((VectorSpecies<Byte>)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(
*** 288,298 **** } } @Override @ForceInline ! public ByteVector reshape(Species<Byte> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Byte64Vector.class)) { return VectorIntrinsics.reinterpret( Byte512Vector.class, byte.class, LENGTH, --- 288,298 ---- } } @Override @ForceInline ! public ByteVector reshape(VectorSpecies<Byte> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Byte64Vector.class)) { return VectorIntrinsics.reinterpret( Byte512Vector.class, byte.class, LENGTH,
*** 351,361 **** return add((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector add(byte o, Mask<Byte> m) { return add((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 351,361 ---- return add((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector add(byte o, VectorMask<Byte> m) { return add((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 363,373 **** return sub((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector sub(byte o, Mask<Byte> m) { return sub((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 363,373 ---- return sub((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector sub(byte o, VectorMask<Byte> m) { return sub((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 375,385 **** return mul((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector mul(byte o, Mask<Byte> m) { return mul((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 375,385 ---- return mul((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector mul(byte o, VectorMask<Byte> m) { return mul((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 393,439 **** return max((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> equal(byte o) { return equal((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> notEqual(byte o) { return notEqual((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> lessThan(byte o) { return lessThan((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> lessThanEq(byte o) { return lessThanEq((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> greaterThan(byte o) { return greaterThan((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Byte> greaterThanEq(byte o) { return greaterThanEq((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector blend(byte o, Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override --- 393,439 ---- return max((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> equal(byte o) { return equal((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> notEqual(byte o) { return notEqual((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> lessThan(byte o) { return lessThan((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> lessThanEq(byte o) { return lessThanEq((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> greaterThan(byte o) { return greaterThan((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Byte> greaterThanEq(byte o) { return greaterThanEq((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector blend(byte o, VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override
*** 442,452 **** return and((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector and(byte o, Mask<Byte> m) { return and((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 442,452 ---- return and((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector and(byte o, VectorMask<Byte> m) { return and((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 454,464 **** return or((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector or(byte o, Mask<Byte> m) { return or((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 454,464 ---- return or((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector or(byte o, VectorMask<Byte> m) { return or((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 466,476 **** return xor((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector xor(byte o, Mask<Byte> m) { return xor((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 466,476 ---- return xor((Byte512Vector)ByteVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public ByteVector xor(byte o, VectorMask<Byte> m) { return xor((Byte512Vector)ByteVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 480,490 **** // Unary operations @ForceInline @Override ! public Byte512Vector neg(Mask<Byte> m) { return blend(neg(), m); } @Override @ForceInline --- 480,490 ---- // Unary operations @ForceInline @Override ! public Byte512Vector neg(VectorMask<Byte> m) { return blend(neg(), m); } @Override @ForceInline
*** 495,505 **** v1 -> v1.uOp((i, a) -> (byte) Math.abs(a))); } @ForceInline @Override ! public Byte512Vector abs(Mask<Byte> m) { return blend(abs(), m); } @Override --- 495,505 ---- v1 -> v1.uOp((i, a) -> (byte) Math.abs(a))); } @ForceInline @Override ! public Byte512Vector abs(VectorMask<Byte> m) { return blend(abs(), m); } @Override
*** 511,521 **** v1 -> v1.uOp((i, a) -> (byte) ~a)); } @ForceInline @Override ! public Byte512Vector not(Mask<Byte> m) { return blend(not(), m); } // Binary operations @Override --- 511,521 ---- v1 -> v1.uOp((i, a) -> (byte) ~a)); } @ForceInline @Override ! public Byte512Vector not(VectorMask<Byte> m) { return blend(not(), m); } // Binary operations @Override
*** 529,539 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a + b))); } @Override @ForceInline ! public Byte512Vector add(Vector<Byte> v, Mask<Byte> m) { return blend(add(v), m); } @Override @ForceInline --- 529,539 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a + b))); } @Override @ForceInline ! public Byte512Vector add(Vector<Byte> v, VectorMask<Byte> m) { return blend(add(v), m); } @Override @ForceInline
*** 546,556 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a - b))); } @Override @ForceInline ! public Byte512Vector sub(Vector<Byte> v, Mask<Byte> m) { return blend(sub(v), m); } @Override @ForceInline --- 546,556 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a - b))); } @Override @ForceInline ! public Byte512Vector sub(Vector<Byte> v, VectorMask<Byte> m) { return blend(sub(v), m); } @Override @ForceInline
*** 563,573 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a * b))); } @Override @ForceInline ! public Byte512Vector mul(Vector<Byte> v, Mask<Byte> m) { return blend(mul(v), m); } @Override @ForceInline --- 563,573 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a * b))); } @Override @ForceInline ! public Byte512Vector mul(Vector<Byte> v, VectorMask<Byte> m) { return blend(mul(v), m); } @Override @ForceInline
*** 580,590 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte) Math.min(a, b))); } @Override @ForceInline ! public Byte512Vector min(Vector<Byte> v, Mask<Byte> m) { return blend(min(v), m); } @Override @ForceInline --- 580,590 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte) Math.min(a, b))); } @Override @ForceInline ! public Byte512Vector min(Vector<Byte> v, VectorMask<Byte> m) { return blend(min(v), m); } @Override @ForceInline
*** 597,607 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte) Math.max(a, b))); } @Override @ForceInline ! public Byte512Vector max(Vector<Byte> v, Mask<Byte> m) { return blend(max(v), m); } @Override @ForceInline --- 597,607 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte) Math.max(a, b))); } @Override @ForceInline ! public Byte512Vector max(Vector<Byte> v, VectorMask<Byte> m) { return blend(max(v), m); } @Override @ForceInline
*** 636,658 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a ^ b))); } @Override @ForceInline ! public Byte512Vector and(Vector<Byte> v, Mask<Byte> m) { return blend(and(v), m); } @Override @ForceInline ! public Byte512Vector or(Vector<Byte> v, Mask<Byte> m) { return blend(or(v), m); } @Override @ForceInline ! public Byte512Vector xor(Vector<Byte> v, Mask<Byte> m) { return blend(xor(v), m); } @Override @ForceInline --- 636,658 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (byte)(a ^ b))); } @Override @ForceInline ! public Byte512Vector and(Vector<Byte> v, VectorMask<Byte> m) { return blend(and(v), m); } @Override @ForceInline ! public Byte512Vector or(Vector<Byte> v, VectorMask<Byte> m) { return blend(or(v), m); } @Override @ForceInline ! public Byte512Vector xor(Vector<Byte> v, VectorMask<Byte> m) { return blend(xor(v), m); } @Override @ForceInline
*** 663,673 **** (v, i) -> v.uOp((__, a) -> (byte) (a << (i & 7)))); } @Override @ForceInline ! public Byte512Vector shiftL(int s, Mask<Byte> m) { return blend(shiftL(s), m); } @Override @ForceInline --- 663,673 ---- (v, i) -> v.uOp((__, a) -> (byte) (a << (i & 7)))); } @Override @ForceInline ! public Byte512Vector shiftL(int s, VectorMask<Byte> m) { return blend(shiftL(s), m); } @Override @ForceInline
*** 678,688 **** (v, i) -> v.uOp((__, a) -> (byte) ((a & 0xFF) >>> (i & 7)))); } @Override @ForceInline ! public Byte512Vector shiftR(int s, Mask<Byte> m) { return blend(shiftR(s), m); } @Override @ForceInline --- 678,688 ---- (v, i) -> v.uOp((__, a) -> (byte) ((a & 0xFF) >>> (i & 7)))); } @Override @ForceInline ! public Byte512Vector shiftR(int s, VectorMask<Byte> m) { return blend(shiftR(s), m); } @Override @ForceInline
*** 693,703 **** (v, i) -> v.uOp((__, a) -> (byte) (a >> (i & 7)))); } @Override @ForceInline ! public Byte512Vector aShiftR(int s, Mask<Byte> m) { return blend(aShiftR(s), m); } // Ternary operations --- 693,703 ---- (v, i) -> v.uOp((__, a) -> (byte) (a >> (i & 7)))); } @Override @ForceInline ! public Byte512Vector aShiftR(int s, VectorMask<Byte> m) { return blend(aShiftR(s), m); } // Ternary operations
*** 721,731 **** v -> (long) v.rOp((byte) -1, (i, a, b) -> (byte) (a & b))); } @Override @ForceInline ! public byte andAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) -1), m).andAll(); } @Override @ForceInline --- 721,731 ---- v -> (long) v.rOp((byte) -1, (i, a, b) -> (byte) (a & b))); } @Override @ForceInline ! public byte andAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) -1), m).andAll(); } @Override @ForceInline
*** 763,773 **** v -> (long) v.rOp((byte) 0, (i, a, b) -> (byte) (a | b))); } @Override @ForceInline ! public byte orAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).orAll(); } @Override @ForceInline --- 763,773 ---- v -> (long) v.rOp((byte) 0, (i, a, b) -> (byte) (a | b))); } @Override @ForceInline ! public byte orAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).orAll(); } @Override @ForceInline
*** 778,826 **** v -> (long) v.rOp((byte) 0, (i, a, b) -> (byte) (a ^ b))); } @Override @ForceInline ! public byte xorAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).xorAll(); } @Override @ForceInline ! public byte addAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).addAll(); } @Override @ForceInline ! public byte mulAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 1), m).mulAll(); } @Override @ForceInline ! public byte minAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, Byte.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public byte maxAll(Mask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, Byte.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public Shuffle<Byte> toShuffle() { byte[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } ! return ByteVector.shuffleFromArray(SPECIES, sa, 0); } // Memory operations private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BYTE_INDEX_SCALE); --- 778,826 ---- v -> (long) v.rOp((byte) 0, (i, a, b) -> (byte) (a ^ b))); } @Override @ForceInline ! public byte xorAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).xorAll(); } @Override @ForceInline ! public byte addAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 0), m).addAll(); } @Override @ForceInline ! public byte mulAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, (byte) 1), m).mulAll(); } @Override @ForceInline ! public byte minAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, Byte.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public byte maxAll(VectorMask<Byte> m) { return blend((Byte512Vector)ByteVector.broadcast(SPECIES, Byte.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public VectorShuffle<Byte> toShuffle() { byte[] 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_BYTE_INDEX_SCALE);
*** 838,848 **** (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(byte[] a, int ax, Mask<Byte> m) { ByteVector oldVal = ByteVector.fromArray(SPECIES, a, ax); ByteVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } --- 838,848 ---- (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(byte[] a, int ax, VectorMask<Byte> m) { ByteVector oldVal = ByteVector.fromArray(SPECIES, a, ax); ByteVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); }
*** 862,872 **** }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, Mask<Byte> m) { Byte512Vector oldVal = (Byte512Vector) ByteVector.fromByteArray(SPECIES, a, ix); Byte512Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); } --- 862,872 ---- }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, VectorMask<Byte> m) { Byte512Vector oldVal = (Byte512Vector) ByteVector.fromByteArray(SPECIES, a, ix); Byte512Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); }
*** 891,901 **** }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, Mask<Byte> m) { Byte512Vector oldVal = (Byte512Vector) ByteVector.fromByteBuffer(SPECIES, bb, ix); Byte512Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); } --- 891,901 ---- }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Byte> m) { Byte512Vector oldVal = (Byte512Vector) ByteVector.fromByteBuffer(SPECIES, bb, ix); Byte512Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); }
*** 1016,1026 **** f.apply(i, vec[i]); } } @Override ! void forEach(Mask<Byte> o, FUnCon f) { boolean[] mbits = ((Byte512Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); } --- 1016,1026 ---- f.apply(i, vec[i]); } } @Override ! void forEach(VectorMask<Byte> o, FUnCon f) { boolean[] mbits = ((Byte512Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); }
*** 1073,1089 **** } @Override @ForceInline public Byte512Vector rearrange(Vector<Byte> v, ! Shuffle<Byte> s, Mask<Byte> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Byte512Vector rearrange(Shuffle<Byte> o1) { Objects.requireNonNull(o1); Byte512Shuffle s = (Byte512Shuffle)o1; return VectorIntrinsics.rearrangeOp( Byte512Vector.class, Byte512Shuffle.class, byte.class, LENGTH, --- 1073,1089 ---- } @Override @ForceInline public Byte512Vector rearrange(Vector<Byte> v, ! VectorShuffle<Byte> s, VectorMask<Byte> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Byte512Vector rearrange(VectorShuffle<Byte> o1) { Objects.requireNonNull(o1); Byte512Shuffle s = (Byte512Shuffle)o1; return VectorIntrinsics.rearrangeOp( Byte512Vector.class, Byte512Shuffle.class, byte.class, LENGTH,
*** 1094,1104 **** })); } @Override @ForceInline ! public Byte512Vector blend(Vector<Byte> o1, Mask<Byte> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Byte512Vector v = (Byte512Vector)o1; Byte512Mask m = (Byte512Mask)o2; --- 1094,1104 ---- })); } @Override @ForceInline ! public Byte512Vector blend(Vector<Byte> o1, VectorMask<Byte> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Byte512Vector v = (Byte512Vector)o1; Byte512Mask m = (Byte512Mask)o2;
*** 1178,1199 **** } return new Byte512Mask(res); } @Override ! Byte512Mask bOp(Mask<Byte> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Byte512Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Byte512Mask(res); } @Override ! public Species<Byte> species() { return SPECIES; } @Override public Byte512Vector toVector() { --- 1178,1199 ---- } return new Byte512Mask(res); } @Override ! Byte512Mask bOp(VectorMask<Byte> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Byte512Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Byte512Mask(res); } @Override ! public VectorSpecies<Byte> species() { return SPECIES; } @Override public Byte512Vector toVector() {
*** 1208,1234 **** } @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 Byte512Vector.Byte512Mask(maskArray); } else if (stype == short.class) { ! return (Mask <E>) new Short512Vector.Short512Mask(maskArray); } else if (stype == int.class) { ! return (Mask <E>) new Int512Vector.Int512Mask(maskArray); } else if (stype == long.class) { ! return (Mask <E>) new Long512Vector.Long512Mask(maskArray); } else if (stype == float.class) { ! return (Mask <E>) new Float512Vector.Float512Mask(maskArray); } else if (stype == double.class) { ! return (Mask <E>) new Double512Vector.Double512Mask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } --- 1208,1234 ---- } @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 Byte512Vector.Byte512Mask(maskArray); } else if (stype == short.class) { ! return (VectorMask <E>) new Short512Vector.Short512Mask(maskArray); } else if (stype == int.class) { ! return (VectorMask <E>) new Int512Vector.Int512Mask(maskArray); } else if (stype == long.class) { ! return (VectorMask <E>) new Long512Vector.Long512Mask(maskArray); } else if (stype == float.class) { ! return (VectorMask <E>) new Float512Vector.Float512Mask(maskArray); } else if (stype == double.class) { ! return (VectorMask <E>) new Double512Vector.Double512Mask(maskArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } }
*** 1245,1265 **** // Binary operations @Override @ForceInline ! public Byte512Mask and(Mask<Byte> o) { Objects.requireNonNull(o); Byte512Mask m = (Byte512Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Byte512Mask.class, byte.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Byte512Mask or(Mask<Byte> o) { Objects.requireNonNull(o); Byte512Mask m = (Byte512Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Byte512Mask.class, byte.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b)); --- 1245,1265 ---- // Binary operations @Override @ForceInline ! public Byte512Mask and(VectorMask<Byte> o) { Objects.requireNonNull(o); Byte512Mask m = (Byte512Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Byte512Mask.class, byte.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Byte512Mask or(VectorMask<Byte> o) { Objects.requireNonNull(o); Byte512Mask m = (Byte512Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Byte512Mask.class, byte.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
*** 1277,1287 **** @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Byte512Mask.class, byte.class, LENGTH, ! this, ByteVector.maskAllTrue(species()), (m, __) -> allTrueHelper(((Byte512Mask)m).getBits())); } } // Shuffle --- 1277,1287 ---- @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Byte512Mask.class, byte.class, LENGTH, ! this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((Byte512Mask)m).getBits())); } } // Shuffle
*** 1302,1312 **** public Byte512Shuffle(IntUnaryOperator f) { super(f); } @Override ! public Species<Byte> species() { return SPECIES; } @Override public ByteVector toVector() { --- 1302,1312 ---- public Byte512Shuffle(IntUnaryOperator f) { super(f); } @Override ! public VectorSpecies<Byte> species() { return SPECIES; } @Override public ByteVector toVector() {
*** 1318,1362 **** } @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 Byte512Vector.Byte512Shuffle(shuffleArray); } else if (stype == short.class) { ! return (Shuffle<F>) new Short512Vector.Short512Shuffle(shuffleArray); } else if (stype == int.class) { ! return (Shuffle<F>) new Int512Vector.Int512Shuffle(shuffleArray); } else if (stype == long.class) { ! return (Shuffle<F>) new Long512Vector.Long512Shuffle(shuffleArray); } else if (stype == float.class) { ! return (Shuffle<F>) new Float512Vector.Float512Shuffle(shuffleArray); } else if (stype == double.class) { ! return (Shuffle<F>) new Double512Vector.Double512Shuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public Byte512Shuffle rearrange(Vector.Shuffle<Byte> o) { Byte512Shuffle s = (Byte512Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Byte512Shuffle(r); } } ! // Species @Override ! public Species<Byte> species() { return SPECIES; } } --- 1318,1362 ---- } @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 Byte512Vector.Byte512Shuffle(shuffleArray); } else if (stype == short.class) { ! return (VectorShuffle<F>) new Short512Vector.Short512Shuffle(shuffleArray); } else if (stype == int.class) { ! return (VectorShuffle<F>) new Int512Vector.Int512Shuffle(shuffleArray); } else if (stype == long.class) { ! return (VectorShuffle<F>) new Long512Vector.Long512Shuffle(shuffleArray); } else if (stype == float.class) { ! return (VectorShuffle<F>) new Float512Vector.Float512Shuffle(shuffleArray); } else if (stype == double.class) { ! return (VectorShuffle<F>) new Double512Vector.Double512Shuffle(shuffleArray); } else { throw new UnsupportedOperationException("Bad lane type for casting."); } } @Override ! public Byte512Shuffle rearrange(VectorShuffle<Byte> o) { Byte512Shuffle s = (Byte512Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Byte512Shuffle(r); } } ! // VectorSpecies @Override ! public VectorSpecies<Byte> species() { return SPECIES; } }
< prev index next >