< prev index next >

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

Print this page

        

*** 110,120 **** * @return a zero vector of given species */ @ForceInline @SuppressWarnings("unchecked") public static FloatVector zero(VectorSpecies<Float> species) { ! return VectorIntrinsics.broadcastCoerced((Class<FloatVector>) species.boxType(), float.class, species.length(), Float.floatToIntBits(0.0f), species, ((bits, s) -> ((FloatSpecies)s).op(i -> Float.intBitsToFloat((int)bits)))); } /** --- 110,120 ---- * @return a zero vector of given species */ @ForceInline @SuppressWarnings("unchecked") public static FloatVector zero(VectorSpecies<Float> species) { ! return VectorIntrinsics.broadcastCoerced((Class<FloatVector>) species.vectorType(), float.class, species.length(), Float.floatToIntBits(0.0f), species, ((bits, s) -> ((FloatSpecies)s).op(i -> Float.intBitsToFloat((int)bits)))); } /**
*** 140,150 **** @ForceInline @SuppressWarnings("unchecked") public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int offset) { Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); ! return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(), a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET, a, offset, species, (c, idx, s) -> { ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder()); FloatBuffer tb = bbc.asFloatBuffer(); --- 140,150 ---- @ForceInline @SuppressWarnings("unchecked") public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int offset) { Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); ! return VectorIntrinsics.load((Class<FloatVector>) species.vectorType(), float.class, species.length(), a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET, a, offset, species, (c, idx, s) -> { ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder()); FloatBuffer tb = bbc.asFloatBuffer();
*** 198,208 **** @ForceInline @SuppressWarnings("unchecked") public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int offset){ Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); ! return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(), a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_FLOAT_BASE_OFFSET, a, offset, species, (c, idx, s) -> ((FloatSpecies)s).op(n -> c[idx + n])); } --- 198,208 ---- @ForceInline @SuppressWarnings("unchecked") public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int offset){ Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); ! return VectorIntrinsics.load((Class<FloatVector>) species.vectorType(), float.class, species.length(), a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_FLOAT_BASE_OFFSET, a, offset, species, (c, idx, s) -> ((FloatSpecies)s).op(n -> c[idx + n])); }
*** 261,272 **** // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k] IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset); vix = VectorIntrinsics.checkIndex(vix, a.length); ! return VectorIntrinsics.loadWithMap((Class<FloatVector>) species.boxType(), float.class, species.length(), ! IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_FLOAT_BASE_OFFSET, vix, a, a_offset, indexMap, i_offset, species, (float[] c, int idx, int[] iMap, int idy, VectorSpecies<Float> s) -> ((FloatSpecies)s).op(n -> c[idx + iMap[idy+n]])); } --- 261,272 ---- // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k] IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset); vix = VectorIntrinsics.checkIndex(vix, a.length); ! return VectorIntrinsics.loadWithMap((Class<FloatVector>) species.vectorType(), float.class, species.length(), ! IntVector.species(species.indexShape()).vectorType(), a, Unsafe.ARRAY_FLOAT_BASE_OFFSET, vix, a, a_offset, indexMap, i_offset, species, (float[] c, int idx, int[] iMap, int idy, VectorSpecies<Float> s) -> ((FloatSpecies)s).op(n -> c[idx + iMap[idy+n]])); }
*** 331,341 **** public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); ! return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(), U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset, bb, offset, species, (c, idx, s) -> { ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder()); FloatBuffer tb = bbc.asFloatBuffer(); --- 331,341 ---- public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); ! return VectorIntrinsics.load((Class<FloatVector>) species.vectorType(), float.class, species.length(), U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset, bb, offset, species, (c, idx, s) -> { ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder()); FloatBuffer tb = bbc.asFloatBuffer();
*** 395,405 **** */ @ForceInline @SuppressWarnings("unchecked") public static FloatVector broadcast(VectorSpecies<Float> species, float e) { return VectorIntrinsics.broadcastCoerced( ! (Class<FloatVector>) species.boxType(), float.class, species.length(), Float.floatToIntBits(e), species, ((bits, sp) -> ((FloatSpecies)sp).op(i -> Float.intBitsToFloat((int)bits)))); } /** --- 395,405 ---- */ @ForceInline @SuppressWarnings("unchecked") public static FloatVector broadcast(VectorSpecies<Float> species, float e) { return VectorIntrinsics.broadcastCoerced( ! (Class<FloatVector>) species.vectorType(), float.class, species.length(), Float.floatToIntBits(e), species, ((bits, sp) -> ((FloatSpecies)sp).op(i -> Float.intBitsToFloat((int)bits)))); } /**
*** 419,429 **** @ForceInline @SuppressWarnings("unchecked") public static FloatVector scalars(VectorSpecies<Float> species, float... es) { Objects.requireNonNull(es); int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); ! return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(), es, Unsafe.ARRAY_FLOAT_BASE_OFFSET, es, ix, species, (c, idx, sp) -> ((FloatSpecies)sp).op(n -> c[idx + n])); } --- 419,429 ---- @ForceInline @SuppressWarnings("unchecked") public static FloatVector scalars(VectorSpecies<Float> species, float... es) { Objects.requireNonNull(es); int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); ! return VectorIntrinsics.load((Class<FloatVector>) species.vectorType(), float.class, species.length(), es, Unsafe.ARRAY_FLOAT_BASE_OFFSET, es, ix, species, (c, idx, sp) -> ((FloatSpecies)sp).op(n -> c[idx + n])); }
*** 797,825 **** /** * {@inheritDoc} */ @Override ! public abstract FloatVector rotateEL(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector rotateER(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector shiftEL(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector shiftER(int i); /** * Divides this vector by an input vector. * <p> * This is a lane-wise binary operation which applies the primitive division --- 797,825 ---- /** * {@inheritDoc} */ @Override ! public abstract FloatVector rotateLanesLeft(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector rotateLanesRight(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector shiftLanesLeft(int i); /** * {@inheritDoc} */ @Override ! public abstract FloatVector shiftLanesRight(int i); /** * Divides this vector by an input vector. * <p> * This is a lane-wise binary operation which applies the primitive division
*** 1975,1991 **** */ static final class FloatSpecies extends AbstractSpecies<Float> { final Function<float[], FloatVector> vectorFactory; private FloatSpecies(VectorShape shape, ! Class<?> boxType, Class<?> maskType, Function<float[], FloatVector> vectorFactory, Function<boolean[], VectorMask<Float>> maskFactory, Function<IntUnaryOperator, VectorShuffle<Float>> shuffleFromArrayFactory, fShuffleFromArray<Float> shuffleFromOpFactory) { ! super(shape, float.class, Float.SIZE, boxType, maskType, maskFactory, shuffleFromArrayFactory, shuffleFromOpFactory); this.vectorFactory = vectorFactory; } interface FOp { --- 1975,1991 ---- */ static final class FloatSpecies extends AbstractSpecies<Float> { final Function<float[], FloatVector> vectorFactory; private FloatSpecies(VectorShape shape, ! Class<?> vectorType, Class<?> maskType, Function<float[], FloatVector> vectorFactory, Function<boolean[], VectorMask<Float>> maskFactory, Function<IntUnaryOperator, VectorShuffle<Float>> shuffleFromArrayFactory, fShuffleFromArray<Float> shuffleFromOpFactory) { ! super(shape, float.class, Float.SIZE, vectorType, maskType, maskFactory, shuffleFromArrayFactory, shuffleFromOpFactory); this.vectorFactory = vectorFactory; } interface FOp {
< prev index next >