--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java 2018-04-04 14:46:18.011195623 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java 2018-04-04 14:46:17.755195717 -0700 @@ -673,9 +673,9 @@ // 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( + return VectorIntrinsics.reinterpret( Short64Vector.class, short.class, LENGTH, - species.elementType(), this, + species.elementType(), species.length(), this, (v, t) -> species.reshape(v) ); } @@ -764,9 +764,9 @@ public Mask rebracket(Species species) { Objects.requireNonNull(species); // TODO: check proper element type - return VectorIntrinsics.rebracket( + return VectorIntrinsics.reinterpret( Short64Mask.class, short.class, LENGTH, - species.elementType(), this, + species.elementType(), species.length(), this, (m, t) -> m.reshape(species) ); } @@ -863,26 +863,31 @@ } @Override + @ForceInline public int bitSize() { return BIT_SIZE; } @Override + @ForceInline public int length() { return LENGTH; } @Override + @ForceInline public Class elementType() { return Short.class; } @Override + @ForceInline public int elementSize() { return Short.SIZE; } @Override + @ForceInline public Shapes.S64Bit shape() { return Shapes.S_64_BIT; } @@ -978,5 +983,43 @@ public Short64Vector fromArray(short[] a, int ax, Mask m) { return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]); } + + @Override + @ForceInline + @SuppressWarnings("unchecked") + public Short64Vector resize(Vector o) { + Objects.requireNonNull(o); + if (o.bitSize() == 64) { + Short64Vector so = (Short64Vector)o; + return VectorIntrinsics.reinterpret( + Short64Vector.class, short.class, so.length(), + Short.class, LENGTH, so, + (v, t) -> (Short64Vector)reshape(v) + ); + } else if (o.bitSize() == 128) { + Short128Vector so = (Short128Vector)o; + return VectorIntrinsics.reinterpret( + Short128Vector.class, short.class, so.length(), + Short.class, LENGTH, so, + (v, t) -> (Short64Vector)reshape(v) + ); + } else if (o.bitSize() == 256) { + Short256Vector so = (Short256Vector)o; + return VectorIntrinsics.reinterpret( + Short256Vector.class, short.class, so.length(), + Short.class, LENGTH, so, + (v, t) -> (Short64Vector)reshape(v) + ); + } else if (o.bitSize() == 512) { + Short512Vector so = (Short512Vector)o; + return VectorIntrinsics.reinterpret( + Short512Vector.class, short.class, so.length(), + Short.class, LENGTH, so, + (v, t) -> (Short64Vector)reshape(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } } }