--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java 2018-04-04 14:45:55.731203766 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java 2018-04-04 14:45:55.475203861 -0700 @@ -719,9 +719,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( Double128Vector.class, double.class, LENGTH, - species.elementType(), this, + species.elementType(), species.length(), this, (v, t) -> species.reshape(v) ); } @@ -810,9 +810,9 @@ public Mask rebracket(Species species) { Objects.requireNonNull(species); // TODO: check proper element type - return VectorIntrinsics.rebracket( + return VectorIntrinsics.reinterpret( Double128Mask.class, double.class, LENGTH, - species.elementType(), this, + species.elementType(), species.length(), this, (m, t) -> m.reshape(species) ); } @@ -909,26 +909,31 @@ } @Override + @ForceInline public int bitSize() { return BIT_SIZE; } @Override + @ForceInline public int length() { return LENGTH; } @Override + @ForceInline public Class elementType() { return Double.class; } @Override + @ForceInline public int elementSize() { return Double.SIZE; } @Override + @ForceInline public Shapes.S128Bit shape() { return Shapes.S_128_BIT; } @@ -1024,5 +1029,43 @@ public Double128Vector fromArray(double[] 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 Double128Vector resize(Vector o) { + Objects.requireNonNull(o); + if (o.bitSize() == 64) { + Double64Vector so = (Double64Vector)o; + return VectorIntrinsics.reinterpret( + Double64Vector.class, double.class, so.length(), + Double.class, LENGTH, so, + (v, t) -> (Double128Vector)reshape(v) + ); + } else if (o.bitSize() == 128) { + Double128Vector so = (Double128Vector)o; + return VectorIntrinsics.reinterpret( + Double128Vector.class, double.class, so.length(), + Double.class, LENGTH, so, + (v, t) -> (Double128Vector)reshape(v) + ); + } else if (o.bitSize() == 256) { + Double256Vector so = (Double256Vector)o; + return VectorIntrinsics.reinterpret( + Double256Vector.class, double.class, so.length(), + Double.class, LENGTH, so, + (v, t) -> (Double128Vector)reshape(v) + ); + } else if (o.bitSize() == 512) { + Double512Vector so = (Double512Vector)o; + return VectorIntrinsics.reinterpret( + Double512Vector.class, double.class, so.length(), + Double.class, LENGTH, so, + (v, t) -> (Double128Vector)reshape(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } } }