< prev index next >
src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template
Print this page
rev 49509 : [vector] Intrinsic support for resize
*** 897,909 ****
public <F> Vector<F, Shapes.$shape$> rebracket(Species<F, Shapes.$shape$> 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(
$vectortype$.class, $type$.class, LENGTH,
! species.elementType(), this,
(v, t) -> species.reshape(v)
);
}
// Accessors
--- 897,909 ----
public <F> Vector<F, Shapes.$shape$> rebracket(Species<F, Shapes.$shape$> 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(
$vectortype$.class, $type$.class, LENGTH,
! species.elementType(), species.length(), this,
(v, t) -> species.reshape(v)
);
}
// Accessors
*** 988,1000 ****
@ForceInline
@SuppressWarnings("unchecked")
public <Z> Mask<Z, Shapes.$shape$> rebracket(Species<Z, Shapes.$shape$> species) {
Objects.requireNonNull(species);
// TODO: check proper element type
! return VectorIntrinsics.rebracket(
$masktype$.class, $type$.class, LENGTH,
! species.elementType(), this,
(m, t) -> m.reshape(species)
);
}
// Unary operations
--- 988,1000 ----
@ForceInline
@SuppressWarnings("unchecked")
public <Z> Mask<Z, Shapes.$shape$> rebracket(Species<Z, Shapes.$shape$> species) {
Objects.requireNonNull(species);
// TODO: check proper element type
! return VectorIntrinsics.reinterpret(
$masktype$.class, $type$.class, LENGTH,
! species.elementType(), species.length(), this,
(m, t) -> m.reshape(species)
);
}
// Unary operations
*** 1087,1116 ****
--- 1087,1121 ----
sb.append("]");
return sb.toString();
}
@Override
+ @ForceInline
public int bitSize() {
return BIT_SIZE;
}
@Override
+ @ForceInline
public int length() {
return LENGTH;
}
@Override
+ @ForceInline
public Class<$Boxtype$> elementType() {
return $Boxtype$.class;
}
@Override
+ @ForceInline
public int elementSize() {
return $Boxtype$.SIZE;
}
@Override
+ @ForceInline
public Shapes.$shape$ shape() {
return Shapes.$Shape$;
}
@Override
*** 1222,1228 ****
--- 1227,1271 ----
@Override
@ForceInline
public $vectortype$ fromArray($type$[] a, int ax, Mask<$Boxtype$, Shapes.$shape$> 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> $vectortype$ resize(Vector<$Boxtype$, T> o) {
+ Objects.requireNonNull(o);
+ if (o.bitSize() == 64) {
+ $Type$64Vector so = ($Type$64Vector)o;
+ return VectorIntrinsics.reinterpret(
+ $Type$64Vector.class, $type$.class, so.length(),
+ $Boxtype$.class, LENGTH, so,
+ (v, t) -> ($vectortype$)reshape(v)
+ );
+ } else if (o.bitSize() == 128) {
+ $Type$128Vector so = ($Type$128Vector)o;
+ return VectorIntrinsics.reinterpret(
+ $Type$128Vector.class, $type$.class, so.length(),
+ $Boxtype$.class, LENGTH, so,
+ (v, t) -> ($vectortype$)reshape(v)
+ );
+ } else if (o.bitSize() == 256) {
+ $Type$256Vector so = ($Type$256Vector)o;
+ return VectorIntrinsics.reinterpret(
+ $Type$256Vector.class, $type$.class, so.length(),
+ $Boxtype$.class, LENGTH, so,
+ (v, t) -> ($vectortype$)reshape(v)
+ );
+ } else if (o.bitSize() == 512) {
+ $Type$512Vector so = ($Type$512Vector)o;
+ return VectorIntrinsics.reinterpret(
+ $Type$512Vector.class, $type$.class, so.length(),
+ $Boxtype$.class, LENGTH, so,
+ (v, t) -> ($vectortype$)reshape(v)
+ );
+ } else {
+ throw new InternalError("Unimplemented size");
+ }
+ }
}
}
< prev index next >