--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java 2018-04-04 14:45:50.879205541 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java 2018-04-04 14:45:50.623205633 -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( Byte128Vector.class, byte.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( Byte128Mask.class, byte.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 Byte.class; } @Override + @ForceInline public int elementSize() { return Byte.SIZE; } @Override + @ForceInline public Shapes.S128Bit shape() { return Shapes.S_128_BIT; } @@ -978,5 +983,43 @@ public Byte128Vector fromArray(byte[] 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 Byte128Vector resize(Vector o) { + Objects.requireNonNull(o); + if (o.bitSize() == 64) { + Byte64Vector so = (Byte64Vector)o; + return VectorIntrinsics.reinterpret( + Byte64Vector.class, byte.class, so.length(), + Byte.class, LENGTH, so, + (v, t) -> (Byte128Vector)reshape(v) + ); + } else if (o.bitSize() == 128) { + Byte128Vector so = (Byte128Vector)o; + return VectorIntrinsics.reinterpret( + Byte128Vector.class, byte.class, so.length(), + Byte.class, LENGTH, so, + (v, t) -> (Byte128Vector)reshape(v) + ); + } else if (o.bitSize() == 256) { + Byte256Vector so = (Byte256Vector)o; + return VectorIntrinsics.reinterpret( + Byte256Vector.class, byte.class, so.length(), + Byte.class, LENGTH, so, + (v, t) -> (Byte128Vector)reshape(v) + ); + } else if (o.bitSize() == 512) { + Byte512Vector so = (Byte512Vector)o; + return VectorIntrinsics.reinterpret( + Byte512Vector.class, byte.class, so.length(), + Byte.class, LENGTH, so, + (v, t) -> (Byte128Vector)reshape(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } } }