--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java 2018-04-27 15:31:12.149887462 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java 2018-04-27 15:31:11.853884738 -0700 @@ -1124,6 +1124,250 @@ return zero().blend(fromArray(a, ax), m); // TODO: use better default impl: op(m, i -> a[ax + i]); } + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromByte(ByteVector o) { + if (o.bitSize() == 64) { + Byte64Vector so = (Byte64Vector)o; + return VectorIntrinsics.cast( + Byte64Vector.class, byte.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Byte128Vector so = (Byte128Vector)o; + return VectorIntrinsics.cast( + Byte128Vector.class, byte.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Byte256Vector so = (Byte256Vector)o; + return VectorIntrinsics.cast( + Byte256Vector.class, byte.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Byte512Vector so = (Byte512Vector)o; + return VectorIntrinsics.cast( + Byte512Vector.class, byte.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromShort(ShortVector o) { + if (o.bitSize() == 64) { + Short64Vector so = (Short64Vector)o; + return VectorIntrinsics.cast( + Short64Vector.class, short.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Short128Vector so = (Short128Vector)o; + return VectorIntrinsics.cast( + Short128Vector.class, short.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Short256Vector so = (Short256Vector)o; + return VectorIntrinsics.cast( + Short256Vector.class, short.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Short512Vector so = (Short512Vector)o; + return VectorIntrinsics.cast( + Short512Vector.class, short.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromInt(IntVector o) { + if (o.bitSize() == 64) { + Int64Vector so = (Int64Vector)o; + return VectorIntrinsics.cast( + Int64Vector.class, int.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Int128Vector so = (Int128Vector)o; + return VectorIntrinsics.cast( + Int128Vector.class, int.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Int256Vector so = (Int256Vector)o; + return VectorIntrinsics.cast( + Int256Vector.class, int.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Int512Vector so = (Int512Vector)o; + return VectorIntrinsics.cast( + Int512Vector.class, int.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromLong(LongVector o) { + if (o.bitSize() == 64) { + Long64Vector so = (Long64Vector)o; + return VectorIntrinsics.cast( + Long64Vector.class, long.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Long128Vector so = (Long128Vector)o; + return VectorIntrinsics.cast( + Long128Vector.class, long.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Long256Vector so = (Long256Vector)o; + return VectorIntrinsics.cast( + Long256Vector.class, long.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Long512Vector so = (Long512Vector)o; + return VectorIntrinsics.cast( + Long512Vector.class, long.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromFloat(FloatVector o) { + if (o.bitSize() == 64) { + Float64Vector so = (Float64Vector)o; + return VectorIntrinsics.cast( + Float64Vector.class, float.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Float128Vector so = (Float128Vector)o; + return VectorIntrinsics.cast( + Float128Vector.class, float.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Float256Vector so = (Float256Vector)o; + return VectorIntrinsics.cast( + Float256Vector.class, float.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Float512Vector so = (Float512Vector)o; + return VectorIntrinsics.cast( + Float512Vector.class, float.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @ForceInline + @SuppressWarnings("unchecked") + private Int512Vector castFromDouble(DoubleVector o) { + if (o.bitSize() == 64) { + Double64Vector so = (Double64Vector)o; + return VectorIntrinsics.cast( + Double64Vector.class, double.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 128) { + Double128Vector so = (Double128Vector)o; + return VectorIntrinsics.cast( + Double128Vector.class, double.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 256) { + Double256Vector so = (Double256Vector)o; + return VectorIntrinsics.cast( + Double256Vector.class, double.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else if (o.bitSize() == 512) { + Double512Vector so = (Double512Vector)o; + return VectorIntrinsics.cast( + Double512Vector.class, double.class, so.length(), + int.class, LENGTH, so, + (v, t) -> (Int512Vector)super.cast(v) + ); + } else { + throw new InternalError("Unimplemented size"); + } + } + + @Override + @ForceInline + @SuppressWarnings("unchecked") + public Int512Vector cast(Vector o) { + Objects.requireNonNull(o); + if (o.elementType() == byte.class) { + ByteVector so = (ByteVector)o; + return castFromByte(so); + } else if (o.elementType() == short.class) { + ShortVector so = (ShortVector)o; + return castFromShort(so); + } else if (o.elementType() == int.class) { + IntVector so = (IntVector)o; + return castFromInt(so); + } else if (o.elementType() == long.class) { + LongVector so = (LongVector)o; + return castFromLong(so); + } else if (o.elementType() == float.class) { + FloatVector so = (FloatVector)o; + return castFromFloat(so); + } else if (o.elementType() == double.class) { + DoubleVector so = (DoubleVector)o; + return castFromDouble(so); + } else { + throw new InternalError("Unimplemented type"); + } + } + @Override @ForceInline @SuppressWarnings("unchecked") @@ -1172,7 +1416,7 @@ (v, t) -> (Int512Vector)reshape(v) ); } else { - throw new InternalError("Unimplemented size"); + throw new InternalError("Unimplemented type"); } }