8268151: Vector API toShuffle optimization

Reviewed-by: psandoz, vlivanov
This commit is contained in:
Sandhya Viswanathan 2021-06-04 18:16:16 +00:00
parent 64ec8b3e5c
commit 20b631278c
41 changed files with 202 additions and 234 deletions

View File

@ -406,14 +406,10 @@ void PhaseVector::expand_vunbox_node(VectorUnboxNode* vec_unbox) {
const TypeVect* vt = vec_unbox->bottom_type()->is_vect();
BasicType bt = vt->element_basic_type();
BasicType masktype = bt;
BasicType elem_bt;
if (is_vector_mask(from_kls)) {
bt = T_BOOLEAN;
} else if (is_vector_shuffle(from_kls)) {
if (vec_unbox->is_shuffle_to_vector() == true) {
elem_bt = bt;
}
bt = T_BYTE;
}
@ -459,13 +455,9 @@ void PhaseVector::expand_vunbox_node(VectorUnboxNode* vec_unbox) {
if (is_vector_mask(from_kls)) {
vec_val_load = gvn.transform(new VectorLoadMaskNode(vec_val_load, TypeVect::make(masktype, num_elem)));
} else if (is_vector_shuffle(from_kls)) {
if (vec_unbox->is_shuffle_to_vector() == false) {
assert(vec_unbox->bottom_type()->is_vect()->element_basic_type() == masktype, "expect shuffle type consistency");
vec_val_load = gvn.transform(new VectorLoadShuffleNode(vec_val_load, TypeVect::make(masktype, num_elem)));
} else {
vec_val_load = gvn.transform(VectorCastNode::make(Op_VectorCastB2X, vec_val_load, elem_bt, num_elem));
}
} else if (is_vector_shuffle(from_kls) && !vec_unbox->is_shuffle_to_vector()) {
assert(vec_unbox->bottom_type()->is_vect()->element_basic_type() == masktype, "expect shuffle type consistency");
vec_val_load = gvn.transform(new VectorLoadShuffleNode(vec_val_load, TypeVect::make(masktype, num_elem)));
}
gvn.hash_delete(vec_unbox);

View File

@ -578,7 +578,11 @@ bool LibraryCallKit::inline_vector_shuffle_to_vector() {
const TypeInstPtr* shuffle_box_type = TypeInstPtr::make_exact(TypePtr::NotNull, sbox_klass);
// Unbox shuffle with true flag to indicate its load shuffle to vector
Node* shuffle_vec = unbox_vector(shuffle, shuffle_box_type, elem_bt, num_elem, true);
// shuffle is a byte array
Node* shuffle_vec = unbox_vector(shuffle, shuffle_box_type, T_BYTE, num_elem, true);
// cast byte to target element type
shuffle_vec = gvn().transform(VectorCastNode::make(cast_vopc, shuffle_vec, elem_bt, num_elem));
ciKlass* vbox_klass = vector_klass->const_oop()->as_instance()->java_lang_Class_klass();
const TypeInstPtr* vec_box_type = TypeInstPtr::make_exact(TypePtr::NotNull, vbox_klass);
@ -1588,7 +1592,7 @@ bool LibraryCallKit::inline_vector_convert() {
ciKlass* vbox_klass_from = vector_klass_from->const_oop()->as_instance()->java_lang_Class_klass();
ciKlass* vbox_klass_to = vector_klass_to->const_oop()->as_instance()->java_lang_Class_klass();
if (is_vector_shuffle(vbox_klass_from) || is_vector_shuffle(vbox_klass_to)) {
if (is_vector_shuffle(vbox_klass_from)) {
return false; // vector shuffles aren't supported
}
bool is_mask = is_vector_mask(vbox_klass_from);

View File

@ -1243,10 +1243,7 @@ Node* VectorUnboxNode::Ideal(PhaseGVN* phase, bool can_reshape) {
value = phase->transform(VectorStoreMaskNode::make(*phase, value, in_vt->element_basic_type(), in_vt->length()));
return new VectorLoadMaskNode(value, out_vt);
} else if (is_vector_shuffle) {
if (is_shuffle_to_vector()) {
// VectorUnbox (VectorBox vshuffle) ==> VectorCastB2X vshuffle
return new VectorCastB2XNode(value, out_vt);
} else {
if (!is_shuffle_to_vector()) {
// VectorUnbox (VectorBox vshuffle) ==> VectorLoadShuffle vshuffle
return new VectorLoadShuffleNode(value, out_vt);
}

View File

@ -330,15 +330,9 @@ final class Byte128Vector extends ByteVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Byte> toShuffle() {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Byte128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Byte256Vector extends ByteVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Byte> toShuffle() {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Byte256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Byte512Vector extends ByteVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Byte> toShuffle() {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Byte512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Byte64Vector extends ByteVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Byte> toShuffle() {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Byte64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class ByteMaxVector extends ByteVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Byte> toShuffle() {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(ByteMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2166,6 +2166,29 @@ public abstract class ByteVector extends AbstractVector<Byte> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Byte> toShuffle0(ByteSpecies dsp) {
byte[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Byte> toShuffleTemplate(Class<?> shuffleType) {
ByteSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), byte.class, length(),
shuffleType, byte.class, length(),
this, vsp,
ByteVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -324,15 +324,9 @@ final class Double128Vector extends DoubleVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Double> toShuffle() {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Double128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Double256Vector extends DoubleVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Double> toShuffle() {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Double256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Double512Vector extends DoubleVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Double> toShuffle() {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Double512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Double64Vector extends DoubleVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Double> toShuffle() {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Double64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class DoubleMaxVector extends DoubleVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Double> toShuffle() {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(DoubleMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2073,6 +2073,29 @@ public abstract class DoubleVector extends AbstractVector<Double> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Double> toShuffle0(DoubleSpecies dsp) {
double[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Double> toShuffleTemplate(Class<?> shuffleType) {
DoubleSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), double.class, length(),
shuffleType, byte.class, length(),
this, vsp,
DoubleVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -324,15 +324,9 @@ final class Float128Vector extends FloatVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Float> toShuffle() {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Float128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Float256Vector extends FloatVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Float> toShuffle() {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Float256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Float512Vector extends FloatVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Float> toShuffle() {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Float512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class Float64Vector extends FloatVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Float> toShuffle() {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Float64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -324,15 +324,9 @@ final class FloatMaxVector extends FloatVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Float> toShuffle() {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(FloatMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2085,6 +2085,29 @@ public abstract class FloatVector extends AbstractVector<Float> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Float> toShuffle0(FloatSpecies dsp) {
float[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Float> toShuffleTemplate(Class<?> shuffleType) {
FloatSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), float.class, length(),
shuffleType, byte.class, length(),
this, vsp,
FloatVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -330,15 +330,9 @@ final class Int128Vector extends IntVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Integer> toShuffle() {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Int128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Int256Vector extends IntVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Integer> toShuffle() {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Int256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Int512Vector extends IntVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Integer> toShuffle() {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Int512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Int64Vector extends IntVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Integer> toShuffle() {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Int64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class IntMaxVector extends IntVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Integer> toShuffle() {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(IntMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2165,6 +2165,29 @@ public abstract class IntVector extends AbstractVector<Integer> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Integer> toShuffle0(IntSpecies dsp) {
int[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Integer> toShuffleTemplate(Class<?> shuffleType) {
IntSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), int.class, length(),
shuffleType, byte.class, length(),
this, vsp,
IntVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -325,15 +325,9 @@ final class Long128Vector extends LongVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Long> toShuffle() {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Long128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -325,15 +325,9 @@ final class Long256Vector extends LongVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Long> toShuffle() {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Long256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -325,15 +325,9 @@ final class Long512Vector extends LongVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Long> toShuffle() {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Long512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -325,15 +325,9 @@ final class Long64Vector extends LongVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Long> toShuffle() {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Long64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -325,15 +325,9 @@ final class LongMaxVector extends LongVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Long> toShuffle() {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(LongMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2036,6 +2036,29 @@ public abstract class LongVector extends AbstractVector<Long> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Long> toShuffle0(LongSpecies dsp) {
long[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Long> toShuffleTemplate(Class<?> shuffleType) {
LongSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), long.class, length(),
shuffleType, byte.class, length(),
this, vsp,
LongVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -330,15 +330,9 @@ final class Short128Vector extends ShortVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Short> toShuffle() {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Short128Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Short256Vector extends ShortVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Short> toShuffle() {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Short256Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Short512Vector extends ShortVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Short> toShuffle() {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Short512Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class Short64Vector extends ShortVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Short> toShuffle() {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(Short64Shuffle.class); // specialize
}
// Specialized unary testing

View File

@ -330,15 +330,9 @@ final class ShortMaxVector extends ShortVector {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<Short> toShuffle() {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate(ShortMaxShuffle.class); // specialize
}
// Specialized unary testing

View File

@ -2166,6 +2166,29 @@ public abstract class ShortVector extends AbstractVector<Short> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<Short> toShuffle0(ShortSpecies dsp) {
short[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<Short> toShuffleTemplate(Class<?> shuffleType) {
ShortSpecies vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), short.class, length(),
shuffleType, byte.class, length(),
this, vsp,
ShortVector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -2433,6 +2433,29 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> {
return r1.blend(r0, valid);
}
@ForceInline
private final
VectorShuffle<$Boxtype$> toShuffle0($Type$Species dsp) {
$type$[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(dsp, sa, 0);
}
/*package-private*/
@ForceInline
final
VectorShuffle<$Boxtype$> toShuffleTemplate(Class<?> shuffleType) {
$Type$Species vsp = vspecies();
return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST,
getClass(), $type$.class, length(),
shuffleType, byte.class, length(),
this, vsp,
$Type$Vector::toShuffle0);
}
/**
* {@inheritDoc} <!--workaround-->
*/

View File

@ -334,15 +334,9 @@ final class $vectortype$ extends $abstractvectortype$ {
return (long) super.reduceLanesTemplate(op, m); // specialized
}
@Override
@ForceInline
public VectorShuffle<$Boxtype$> toShuffle() {
$type$[] a = toArray();
int[] sa = new int[a.length];
for (int i = 0; i < a.length; i++) {
sa[i] = (int) a[i];
}
return VectorShuffle.fromArray(VSPECIES, sa, 0);
return super.toShuffleTemplate($shuffletype$.class); // specialize
}
// Specialized unary testing