< prev index next >

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

Print this page
rev 49509 : [vector] Intrinsic support for resize

*** 705,717 **** public <F> Vector<F, Shapes.S256Bit> rebracket(Species<F, Shapes.S256Bit> species) { Objects.requireNonNull(species); // TODO: check proper element type // TODO: update to pass the two species as an arguments and ideally // push down intrinsic call into species implementation ! return VectorIntrinsics.rebracket( Long256Vector.class, long.class, LENGTH, ! species.elementType(), this, (v, t) -> species.reshape(v) ); } // Accessors --- 705,717 ---- public <F> Vector<F, Shapes.S256Bit> rebracket(Species<F, Shapes.S256Bit> species) { Objects.requireNonNull(species); // TODO: check proper element type // TODO: update to pass the two species as an arguments and ideally // push down intrinsic call into species implementation ! return VectorIntrinsics.reinterpret( Long256Vector.class, long.class, LENGTH, ! species.elementType(), species.length(), this, (v, t) -> species.reshape(v) ); } // Accessors
*** 796,808 **** @ForceInline @SuppressWarnings("unchecked") public <Z> Mask<Z, Shapes.S256Bit> rebracket(Species<Z, Shapes.S256Bit> species) { Objects.requireNonNull(species); // TODO: check proper element type ! return VectorIntrinsics.rebracket( Long256Mask.class, long.class, LENGTH, ! species.elementType(), this, (m, t) -> m.reshape(species) ); } // Unary operations --- 796,808 ---- @ForceInline @SuppressWarnings("unchecked") public <Z> Mask<Z, Shapes.S256Bit> rebracket(Species<Z, Shapes.S256Bit> species) { Objects.requireNonNull(species); // TODO: check proper element type ! return VectorIntrinsics.reinterpret( Long256Mask.class, long.class, LENGTH, ! species.elementType(), species.length(), this, (m, t) -> m.reshape(species) ); } // Unary operations
*** 895,924 **** --- 895,929 ---- sb.append("]"); return sb.toString(); } @Override + @ForceInline public int bitSize() { return BIT_SIZE; } @Override + @ForceInline public int length() { return LENGTH; } @Override + @ForceInline public Class<Long> elementType() { return Long.class; } @Override + @ForceInline public int elementSize() { return Long.SIZE; } @Override + @ForceInline public Shapes.S256Bit shape() { return Shapes.S_256_BIT; } @Override
*** 1010,1016 **** --- 1015,1059 ---- @Override @ForceInline public Long256Vector fromArray(long[] a, int ax, Mask<Long, Shapes.S256Bit> m) { return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]); } + + @Override + @ForceInline + @SuppressWarnings("unchecked") + public <T extends Shape> Long256Vector resize(Vector<Long, T> o) { + Objects.requireNonNull(o); + if (o.bitSize() == 64) { + Long64Vector so = (Long64Vector)o; + return VectorIntrinsics.reinterpret( + Long64Vector.class, long.class, so.length(), + Long.class, LENGTH, so, + (v, t) -> (Long256Vector)reshape(v) + ); + } else if (o.bitSize() == 128) { + Long128Vector so = (Long128Vector)o; + return VectorIntrinsics.reinterpret( + Long128Vector.class, long.class, so.length(), + Long.class, LENGTH, so, + (v, t) -> (Long256Vector)reshape(v) + ); + } else if (o.bitSize() == 256) { + Long256Vector so = (Long256Vector)o; + return VectorIntrinsics.reinterpret( + Long256Vector.class, long.class, so.length(), + Long.class, LENGTH, so, + (v, t) -> (Long256Vector)reshape(v) + ); + } else if (o.bitSize() == 512) { + Long512Vector so = (Long512Vector)o; + return VectorIntrinsics.reinterpret( + Long512Vector.class, long.class, so.length(), + Long.class, LENGTH, so, + (v, t) -> (Long256Vector)reshape(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } } }
< prev index next >