< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.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 Float128Vector extends FloatVector { ! private static final Species<Float> SPECIES = FloatVector.SPECIES_128; static final Float128Vector ZERO = new Float128Vector(); 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 float[] vec; // Don't access directly, use getElements() instead. private float[] getElements() { --- 36,57 ---- import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; @SuppressWarnings("cast") final class Float128Vector extends FloatVector { ! private static final VectorSpecies<Float> SPECIES = FloatVector.SPECIES_128; static final Float128Vector ZERO = new Float128Vector(); 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 float[] vec; // Don't access directly, use getElements() instead. private float[] getElements() {
*** 80,90 **** } return new Float128Vector(res); } @Override ! Float128Vector uOp(Mask<Float> o, FUnOp f) { float[] vec = getElements(); float[] res = new float[length()]; boolean[] mbits = ((Float128Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i]; --- 80,90 ---- } return new Float128Vector(res); } @Override ! Float128Vector uOp(VectorMask<Float> o, FUnOp f) { float[] vec = getElements(); float[] res = new float[length()]; boolean[] mbits = ((Float128Mask)o).getBits(); for (int i = 0; i < length(); i++) { res[i] = mbits[i] ? f.apply(i, vec[i]) : vec[i];
*** 104,114 **** } return new Float128Vector(res); } @Override ! Float128Vector bOp(Vector<Float> o1, Mask<Float> o2, FBinOp f) { float[] res = new float[length()]; float[] vec1 = this.getElements(); float[] vec2 = ((Float128Vector)o1).getElements(); boolean[] mbits = ((Float128Mask)o2).getBits(); for (int i = 0; i < length(); i++) { --- 104,114 ---- } return new Float128Vector(res); } @Override ! Float128Vector bOp(Vector<Float> o1, VectorMask<Float> o2, FBinOp f) { float[] res = new float[length()]; float[] vec1 = this.getElements(); float[] vec2 = ((Float128Vector)o1).getElements(); boolean[] mbits = ((Float128Mask)o2).getBits(); for (int i = 0; i < length(); i++) {
*** 130,140 **** } return new Float128Vector(res); } @Override ! Float128Vector tOp(Vector<Float> o1, Vector<Float> o2, Mask<Float> o3, FTriOp f) { float[] res = new float[length()]; float[] vec1 = getElements(); float[] vec2 = ((Float128Vector)o1).getElements(); float[] vec3 = ((Float128Vector)o2).getElements(); boolean[] mbits = ((Float128Mask)o3).getBits(); --- 130,140 ---- } return new Float128Vector(res); } @Override ! Float128Vector tOp(Vector<Float> o1, Vector<Float> o2, VectorMask<Float> o3, FTriOp f) { float[] res = new float[length()]; float[] vec1 = getElements(); float[] vec2 = ((Float128Vector)o1).getElements(); float[] vec3 = ((Float128Vector)o2).getElements(); boolean[] mbits = ((Float128Mask)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(float.class)) { ! return (Vector<F>) reshape((Species<Float>)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(float.class)) { ! return (Vector<F>) reshape((VectorSpecies<Float>)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 FloatVector reshape(Species<Float> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Float64Vector.class)) { return VectorIntrinsics.reinterpret( Float128Vector.class, float.class, LENGTH, --- 297,307 ---- } } @Override @ForceInline ! public FloatVector reshape(VectorSpecies<Float> s) { Objects.requireNonNull(s); if (s.bitSize() == 64 && (s.boxType() == Float64Vector.class)) { return VectorIntrinsics.reinterpret( Float128Vector.class, float.class, LENGTH,
*** 360,370 **** return add((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector add(float o, Mask<Float> m) { return add((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 360,370 ---- return add((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector add(float o, VectorMask<Float> m) { return add((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 372,382 **** return sub((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector sub(float o, Mask<Float> m) { return sub((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 372,382 ---- return sub((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector sub(float o, VectorMask<Float> m) { return sub((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 384,394 **** return mul((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector mul(float o, Mask<Float> m) { return mul((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 384,394 ---- return mul((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector mul(float o, VectorMask<Float> m) { return mul((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 402,448 **** return max((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> equal(float o) { return equal((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> notEqual(float o) { return notEqual((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> lessThan(float o) { return lessThan((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> lessThanEq(float o) { return lessThanEq((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> greaterThan(float o) { return greaterThan((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public Mask<Float> greaterThanEq(float o) { return greaterThanEq((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector blend(float o, Mask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 402,448 ---- return max((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> equal(float o) { return equal((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> notEqual(float o) { return notEqual((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> lessThan(float o) { return lessThan((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> lessThanEq(float o) { return lessThanEq((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> greaterThan(float o) { return greaterThan((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public VectorMask<Float> greaterThanEq(float o) { return greaterThanEq((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector blend(float o, VectorMask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 450,466 **** return div((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector div(float o, Mask<Float> m) { return div((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline ! public Float128Vector div(Vector<Float> v, Mask<Float> m) { return blend(div(v), m); } @Override @ForceInline --- 450,466 ---- return div((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector div(float o, VectorMask<Float> m) { return div((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline ! public Float128Vector div(Vector<Float> v, VectorMask<Float> m) { return blend(div(v), m); } @Override @ForceInline
*** 468,478 **** return atan2((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector atan2(float o, Mask<Float> m) { return atan2((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 468,478 ---- return atan2((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector atan2(float o, VectorMask<Float> m) { return atan2((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 480,490 **** return pow((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector pow(float o, Mask<Float> m) { return pow((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline --- 480,490 ---- return pow((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector pow(float o, VectorMask<Float> m) { return pow((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } @Override @ForceInline
*** 492,502 **** return fma((Float128Vector)FloatVector.broadcast(SPECIES, o1), (Float128Vector)FloatVector.broadcast(SPECIES, o2)); } @Override @ForceInline ! public FloatVector fma(float o1, float o2, Mask<Float> m) { return fma((Float128Vector)FloatVector.broadcast(SPECIES, o1), (Float128Vector)FloatVector.broadcast(SPECIES, o2), m); } @Override @ForceInline --- 492,502 ---- return fma((Float128Vector)FloatVector.broadcast(SPECIES, o1), (Float128Vector)FloatVector.broadcast(SPECIES, o2)); } @Override @ForceInline ! public FloatVector fma(float o1, float o2, VectorMask<Float> m) { return fma((Float128Vector)FloatVector.broadcast(SPECIES, o1), (Float128Vector)FloatVector.broadcast(SPECIES, o2), m); } @Override @ForceInline
*** 504,523 **** return hypot((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector hypot(float o, Mask<Float> m) { return hypot((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } // Unary operations @ForceInline @Override ! public Float128Vector neg(Mask<Float> m) { return blend(neg(), m); } @Override @ForceInline --- 504,523 ---- return hypot((Float128Vector)FloatVector.broadcast(SPECIES, o)); } @Override @ForceInline ! public FloatVector hypot(float o, VectorMask<Float> m) { return hypot((Float128Vector)FloatVector.broadcast(SPECIES, o), m); } // Unary operations @ForceInline @Override ! public Float128Vector neg(VectorMask<Float> m) { return blend(neg(), m); } @Override @ForceInline
*** 528,538 **** v1 -> v1.uOp((i, a) -> (float) Math.abs(a))); } @ForceInline @Override ! public Float128Vector abs(Mask<Float> m) { return blend(abs(), m); } @Override @ForceInline --- 528,538 ---- v1 -> v1.uOp((i, a) -> (float) Math.abs(a))); } @ForceInline @Override ! public Float128Vector abs(VectorMask<Float> m) { return blend(abs(), m); } @Override @ForceInline
*** 745,755 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a + b))); } @Override @ForceInline ! public Float128Vector add(Vector<Float> v, Mask<Float> m) { return blend(add(v), m); } @Override @ForceInline --- 745,755 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a + b))); } @Override @ForceInline ! public Float128Vector add(Vector<Float> v, VectorMask<Float> m) { return blend(add(v), m); } @Override @ForceInline
*** 762,772 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a - b))); } @Override @ForceInline ! public Float128Vector sub(Vector<Float> v, Mask<Float> m) { return blend(sub(v), m); } @Override @ForceInline --- 762,772 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a - b))); } @Override @ForceInline ! public Float128Vector sub(Vector<Float> v, VectorMask<Float> m) { return blend(sub(v), m); } @Override @ForceInline
*** 779,789 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a * b))); } @Override @ForceInline ! public Float128Vector mul(Vector<Float> v, Mask<Float> m) { return blend(mul(v), m); } @Override @ForceInline --- 779,789 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float)(a * b))); } @Override @ForceInline ! public Float128Vector mul(Vector<Float> v, VectorMask<Float> m) { return blend(mul(v), m); } @Override @ForceInline
*** 796,806 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float) Math.min(a, b))); } @Override @ForceInline ! public Float128Vector min(Vector<Float> v, Mask<Float> m) { return blend(min(v), m); } @Override @ForceInline --- 796,806 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float) Math.min(a, b))); } @Override @ForceInline ! public Float128Vector min(Vector<Float> v, VectorMask<Float> m) { return blend(min(v), m); } @Override @ForceInline
*** 813,823 **** (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float) Math.max(a, b))); } @Override @ForceInline ! public Float128Vector max(Vector<Float> v, Mask<Float> m) { return blend(max(v), m); } // Ternary operations --- 813,823 ---- (v1, v2) -> v1.bOp(v2, (i, a, b) -> (float) Math.max(a, b))); } @Override @ForceInline ! public Float128Vector max(Vector<Float> v, VectorMask<Float> m) { return blend(max(v), m); } // Ternary operations
*** 890,931 **** } @Override @ForceInline ! public float addAll(Mask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, (float) 0), m).addAll(); } @Override @ForceInline ! public float mulAll(Mask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, (float) 1), m).mulAll(); } @Override @ForceInline ! public float minAll(Mask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, Float.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public float maxAll(Mask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, Float.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public Shuffle<Float> toShuffle() { float[] a = toArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } ! return FloatVector.shuffleFromArray(SPECIES, sa, 0); } // Memory operations private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_FLOAT_INDEX_SCALE); --- 890,931 ---- } @Override @ForceInline ! public float addAll(VectorMask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, (float) 0), m).addAll(); } @Override @ForceInline ! public float mulAll(VectorMask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, (float) 1), m).mulAll(); } @Override @ForceInline ! public float minAll(VectorMask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, Float.MAX_VALUE), m).minAll(); } @Override @ForceInline ! public float maxAll(VectorMask<Float> m) { return blend((Float128Vector)FloatVector.broadcast(SPECIES, Float.MIN_VALUE), m).maxAll(); } @Override @ForceInline ! public VectorShuffle<Float> toShuffle() { float[] 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_FLOAT_INDEX_SCALE);
*** 943,953 **** (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(float[] a, int ax, Mask<Float> m) { FloatVector oldVal = FloatVector.fromArray(SPECIES, a, ax); FloatVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } @Override --- 943,953 ---- (arr, idx, v) -> v.forEach((i, e) -> arr[idx + i] = e)); } @Override @ForceInline ! public final void intoArray(float[] a, int ax, VectorMask<Float> m) { FloatVector oldVal = FloatVector.fromArray(SPECIES, a, ax); FloatVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax); } @Override
*** 968,978 **** (arr, idx, v, indexMap, idy) -> v.forEach((i, e) -> arr[idx+indexMap[idy+i]] = e)); } @Override @ForceInline ! public final void intoArray(float[] a, int ax, Mask<Float> m, int[] b, int iy) { // @@@ This can result in out of bounds errors for unset mask lanes FloatVector oldVal = FloatVector.fromArray(SPECIES, a, ax, b, iy); FloatVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax, b, iy); } --- 968,978 ---- (arr, idx, v, indexMap, idy) -> v.forEach((i, e) -> arr[idx+indexMap[idy+i]] = e)); } @Override @ForceInline ! public final void intoArray(float[] a, int ax, VectorMask<Float> m, int[] b, int iy) { // @@@ This can result in out of bounds errors for unset mask lanes FloatVector oldVal = FloatVector.fromArray(SPECIES, a, ax, b, iy); FloatVector newVal = oldVal.blend(this, m); newVal.intoArray(a, ax, b, iy); }
*** 993,1003 **** }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, Mask<Float> m) { Float128Vector oldVal = (Float128Vector) FloatVector.fromByteArray(SPECIES, a, ix); Float128Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); } --- 993,1003 ---- }); } @Override @ForceInline ! public final void intoByteArray(byte[] a, int ix, VectorMask<Float> m) { Float128Vector oldVal = (Float128Vector) FloatVector.fromByteArray(SPECIES, a, ix); Float128Vector newVal = oldVal.blend(this, m); newVal.intoByteArray(a, ix); }
*** 1022,1032 **** }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, Mask<Float> m) { Float128Vector oldVal = (Float128Vector) FloatVector.fromByteBuffer(SPECIES, bb, ix); Float128Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); } --- 1022,1032 ---- }); } @Override @ForceInline ! public void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Float> m) { Float128Vector oldVal = (Float128Vector) FloatVector.fromByteBuffer(SPECIES, bb, ix); Float128Vector newVal = oldVal.blend(this, m); newVal.intoByteBuffer(bb, ix); }
*** 1147,1157 **** f.apply(i, vec[i]); } } @Override ! void forEach(Mask<Float> o, FUnCon f) { boolean[] mbits = ((Float128Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); } --- 1147,1157 ---- f.apply(i, vec[i]); } } @Override ! void forEach(VectorMask<Float> o, FUnCon f) { boolean[] mbits = ((Float128Mask)o).getBits(); forEach((i, a) -> { if (mbits[i]) { f.apply(i, a); } }); }
*** 1212,1228 **** } @Override @ForceInline public Float128Vector rearrange(Vector<Float> v, ! Shuffle<Float> s, Mask<Float> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Float128Vector rearrange(Shuffle<Float> o1) { Objects.requireNonNull(o1); Float128Shuffle s = (Float128Shuffle)o1; return VectorIntrinsics.rearrangeOp( Float128Vector.class, Float128Shuffle.class, float.class, LENGTH, --- 1212,1228 ---- } @Override @ForceInline public Float128Vector rearrange(Vector<Float> v, ! VectorShuffle<Float> s, VectorMask<Float> m) { return this.rearrange(s).blend(v.rearrange(s), m); } @Override @ForceInline ! public Float128Vector rearrange(VectorShuffle<Float> o1) { Objects.requireNonNull(o1); Float128Shuffle s = (Float128Shuffle)o1; return VectorIntrinsics.rearrangeOp( Float128Vector.class, Float128Shuffle.class, float.class, LENGTH,
*** 1233,1243 **** })); } @Override @ForceInline ! public Float128Vector blend(Vector<Float> o1, Mask<Float> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Float128Vector v = (Float128Vector)o1; Float128Mask m = (Float128Mask)o2; --- 1233,1243 ---- })); } @Override @ForceInline ! public Float128Vector blend(Vector<Float> o1, VectorMask<Float> o2) { Objects.requireNonNull(o1); Objects.requireNonNull(o2); Float128Vector v = (Float128Vector)o1; Float128Mask m = (Float128Mask)o2;
*** 1318,1339 **** } return new Float128Mask(res); } @Override ! Float128Mask bOp(Mask<Float> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Float128Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Float128Mask(res); } @Override ! public Species<Float> species() { return SPECIES; } @Override public Float128Vector toVector() { --- 1318,1339 ---- } return new Float128Mask(res); } @Override ! Float128Mask bOp(VectorMask<Float> o, MBinOp f) { boolean[] res = new boolean[species().length()]; boolean[] bits = getBits(); boolean[] mbits = ((Float128Mask)o).getBits(); for (int i = 0; i < species().length(); i++) { res[i] = f.apply(i, bits[i], mbits[i]); } return new Float128Mask(res); } @Override ! public VectorSpecies<Float> species() { return SPECIES; } @Override public Float128Vector toVector() {
*** 1348,1374 **** } @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."); } } --- 1348,1374 ---- } @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."); } }
*** 1385,1405 **** // Binary operations @Override @ForceInline ! public Float128Mask and(Mask<Float> o) { Objects.requireNonNull(o); Float128Mask m = (Float128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Float128Mask.class, int.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Float128Mask or(Mask<Float> o) { Objects.requireNonNull(o); Float128Mask m = (Float128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Float128Mask.class, int.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b)); --- 1385,1405 ---- // Binary operations @Override @ForceInline ! public Float128Mask and(VectorMask<Float> o) { Objects.requireNonNull(o); Float128Mask m = (Float128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_AND, Float128Mask.class, int.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a & b)); } @Override @ForceInline ! public Float128Mask or(VectorMask<Float> o) { Objects.requireNonNull(o); Float128Mask m = (Float128Mask)o; return VectorIntrinsics.binaryOp(VECTOR_OP_OR, Float128Mask.class, int.class, LENGTH, this, m, (m1, m2) -> m1.bOp(m2, (i, a, b) -> a | b));
*** 1417,1427 **** @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Float128Mask.class, int.class, LENGTH, ! this, FloatVector.maskAllTrue(species()), (m, __) -> allTrueHelper(((Float128Mask)m).getBits())); } } // Shuffle --- 1417,1427 ---- @Override @ForceInline public boolean allTrue() { return VectorIntrinsics.test(BT_overflow, Float128Mask.class, int.class, LENGTH, ! this, VectorMask.maskAllTrue(species()), (m, __) -> allTrueHelper(((Float128Mask)m).getBits())); } } // Shuffle
*** 1442,1452 **** public Float128Shuffle(IntUnaryOperator f) { super(f); } @Override ! public Species<Float> species() { return SPECIES; } @Override public FloatVector toVector() { --- 1442,1452 ---- public Float128Shuffle(IntUnaryOperator f) { super(f); } @Override ! public VectorSpecies<Float> species() { return SPECIES; } @Override public FloatVector toVector() {
*** 1458,1502 **** } @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 Float128Shuffle rearrange(Vector.Shuffle<Float> o) { Float128Shuffle s = (Float128Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Float128Shuffle(r); } } ! // Species @Override ! public Species<Float> species() { return SPECIES; } } --- 1458,1502 ---- } @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 Float128Shuffle rearrange(VectorShuffle<Float> o) { Float128Shuffle s = (Float128Shuffle) o; byte[] r = new byte[reorder.length]; for (int i = 0; i < reorder.length; i++) { r[i] = reorder[s.reorder[i]]; } return new Float128Shuffle(r); } } ! // VectorSpecies @Override ! public VectorSpecies<Float> species() { return SPECIES; } }
< prev index next >