< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java
Print this page
rev 49509 : [vector] Intrinsic support for resize
*** 671,683 ****
public <F> Vector<F, Shapes.S128Bit> rebracket(Species<F, Shapes.S128Bit> 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(
Byte128Vector.class, byte.class, LENGTH,
! species.elementType(), this,
(v, t) -> species.reshape(v)
);
}
// Accessors
--- 671,683 ----
public <F> Vector<F, Shapes.S128Bit> rebracket(Species<F, Shapes.S128Bit> 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(
Byte128Vector.class, byte.class, LENGTH,
! species.elementType(), species.length(), this,
(v, t) -> species.reshape(v)
);
}
// Accessors
*** 762,774 ****
@ForceInline
@SuppressWarnings("unchecked")
public <Z> Mask<Z, Shapes.S128Bit> rebracket(Species<Z, Shapes.S128Bit> species) {
Objects.requireNonNull(species);
// TODO: check proper element type
! return VectorIntrinsics.rebracket(
Byte128Mask.class, byte.class, LENGTH,
! species.elementType(), this,
(m, t) -> m.reshape(species)
);
}
// Unary operations
--- 762,774 ----
@ForceInline
@SuppressWarnings("unchecked")
public <Z> Mask<Z, Shapes.S128Bit> rebracket(Species<Z, Shapes.S128Bit> species) {
Objects.requireNonNull(species);
// TODO: check proper element type
! return VectorIntrinsics.reinterpret(
Byte128Mask.class, byte.class, LENGTH,
! species.elementType(), species.length(), this,
(m, t) -> m.reshape(species)
);
}
// Unary operations
*** 861,890 ****
--- 861,895 ----
sb.append("]");
return sb.toString();
}
@Override
+ @ForceInline
public int bitSize() {
return BIT_SIZE;
}
@Override
+ @ForceInline
public int length() {
return LENGTH;
}
@Override
+ @ForceInline
public Class<Byte> elementType() {
return Byte.class;
}
@Override
+ @ForceInline
public int elementSize() {
return Byte.SIZE;
}
@Override
+ @ForceInline
public Shapes.S128Bit shape() {
return Shapes.S_128_BIT;
}
@Override
*** 976,982 ****
--- 981,1025 ----
@Override
@ForceInline
public Byte128Vector fromArray(byte[] a, int ax, Mask<Byte, Shapes.S128Bit> 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> Byte128Vector resize(Vector<Byte, T> 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");
+ }
+ }
}
}
< prev index next >