8268293: VectorAPI cast operation on mask and shuffle is broken

Reviewed-by: psandoz, sviswanathan
This commit is contained in:
Jatin Bhateja 2021-06-22 01:31:48 +00:00
parent e2d7ec38af
commit 4099810b29
37 changed files with 353 additions and 900 deletions

View File

@ -600,18 +600,10 @@ final class Byte128Vector extends ByteVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -782,24 +774,7 @@ final class Byte128Vector extends ByteVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -632,18 +632,10 @@ final class Byte256Vector extends ByteVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -814,24 +806,7 @@ final class Byte256Vector extends ByteVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -696,18 +696,10 @@ final class Byte512Vector extends ByteVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -878,24 +870,7 @@ final class Byte512Vector extends ByteVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -584,18 +584,10 @@ final class Byte64Vector extends ByteVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -766,24 +758,7 @@ final class Byte64Vector extends ByteVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -570,18 +570,10 @@ final class ByteMaxVector extends ByteVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -752,24 +744,7 @@ final class ByteMaxVector extends ByteVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -568,18 +568,10 @@ final class Double128Vector extends DoubleVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -750,24 +742,7 @@ final class Double128Vector extends DoubleVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -572,18 +572,10 @@ final class Double256Vector extends DoubleVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -754,24 +746,7 @@ final class Double256Vector extends DoubleVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -580,18 +580,10 @@ final class Double512Vector extends DoubleVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -762,24 +754,7 @@ final class Double512Vector extends DoubleVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -566,18 +566,10 @@ final class Double64Vector extends DoubleVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -748,24 +740,7 @@ final class Double64Vector extends DoubleVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -565,18 +565,10 @@ final class DoubleMaxVector extends DoubleVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -747,24 +739,7 @@ final class DoubleMaxVector extends DoubleVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -572,18 +572,10 @@ final class Float128Vector extends FloatVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -754,24 +746,7 @@ final class Float128Vector extends FloatVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -580,18 +580,10 @@ final class Float256Vector extends FloatVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -762,24 +754,7 @@ final class Float256Vector extends FloatVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -596,18 +596,10 @@ final class Float512Vector extends FloatVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -778,24 +770,7 @@ final class Float512Vector extends FloatVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -568,18 +568,10 @@ final class Float64Vector extends FloatVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -750,24 +742,7 @@ final class Float64Vector extends FloatVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -565,18 +565,10 @@ final class FloatMaxVector extends FloatVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -747,24 +739,7 @@ final class FloatMaxVector extends FloatVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -576,18 +576,10 @@ final class Int128Vector extends IntVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -758,24 +750,7 @@ final class Int128Vector extends IntVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -584,18 +584,10 @@ final class Int256Vector extends IntVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -766,24 +758,7 @@ final class Int256Vector extends IntVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -600,18 +600,10 @@ final class Int512Vector extends IntVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -782,24 +774,7 @@ final class Int512Vector extends IntVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -572,18 +572,10 @@ final class Int64Vector extends IntVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -754,24 +746,7 @@ final class Int64Vector extends IntVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -570,18 +570,10 @@ final class IntMaxVector extends IntVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -763,24 +755,7 @@ final class IntMaxVector extends IntVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -562,18 +562,10 @@ final class Long128Vector extends LongVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -744,24 +736,7 @@ final class Long128Vector extends LongVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -566,18 +566,10 @@ final class Long256Vector extends LongVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -748,24 +740,7 @@ final class Long256Vector extends LongVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -574,18 +574,10 @@ final class Long512Vector extends LongVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -756,24 +748,7 @@ final class Long512Vector extends LongVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -560,18 +560,10 @@ final class Long64Vector extends LongVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -742,24 +734,7 @@ final class Long64Vector extends LongVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -560,18 +560,10 @@ final class LongMaxVector extends LongVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -742,24 +734,7 @@ final class LongMaxVector extends LongVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -584,18 +584,10 @@ final class Short128Vector extends ShortVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte128Vector.Byte128Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short128Vector.Short128Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int128Vector.Int128Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long128Vector.Long128Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float128Vector.Float128Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double128Vector.Double128Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -766,24 +758,7 @@ final class Short128Vector extends ShortVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte128Vector.Byte128Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short128Vector.Short128Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int128Vector.Int128Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long128Vector.Long128Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float128Vector.Float128Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double128Vector.Double128Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -600,18 +600,10 @@ final class Short256Vector extends ShortVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte256Vector.Byte256Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short256Vector.Short256Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int256Vector.Int256Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long256Vector.Long256Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float256Vector.Float256Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double256Vector.Double256Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -782,24 +774,7 @@ final class Short256Vector extends ShortVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte256Vector.Byte256Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short256Vector.Short256Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int256Vector.Int256Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long256Vector.Long256Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float256Vector.Float256Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double256Vector.Double256Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -632,18 +632,10 @@ final class Short512Vector extends ShortVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte512Vector.Byte512Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short512Vector.Short512Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int512Vector.Int512Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long512Vector.Long512Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float512Vector.Float512Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double512Vector.Double512Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -814,24 +806,7 @@ final class Short512Vector extends ShortVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte512Vector.Byte512Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short512Vector.Short512Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int512Vector.Int512Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long512Vector.Long512Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float512Vector.Float512Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double512Vector.Double512Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -576,18 +576,10 @@ final class Short64Vector extends ShortVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte64Vector.Byte64Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short64Vector.Short64Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int64Vector.Int64Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long64Vector.Long64Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float64Vector.Float64Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double64Vector.Double64Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -758,24 +750,7 @@ final class Short64Vector extends ShortVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte64Vector.Byte64Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short64Vector.Short64Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int64Vector.Int64Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long64Vector.Long64Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float64Vector.Float64Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double64Vector.Double64Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -570,18 +570,10 @@ final class ShortMaxVector extends ShortVector {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new ByteMaxVector.ByteMaxMask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new ShortMaxVector.ShortMaxMask(maskArray).check(dsp);
case LaneType.SK_INT -> new IntMaxVector.IntMaxMask(maskArray).check(dsp);
case LaneType.SK_LONG -> new LongMaxVector.LongMaxMask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new FloatMaxVector.FloatMaxMask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new DoubleMaxVector.DoubleMaxMask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -752,24 +744,7 @@ final class ShortMaxVector extends ShortVector {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new ByteMaxVector.ByteMaxShuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new ShortMaxVector.ShortMaxShuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new IntMaxVector.IntMaxShuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new LongMaxVector.LongMaxShuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new FloatMaxVector.FloatMaxShuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new DoubleMaxVector.DoubleMaxShuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -843,18 +843,10 @@ final class $vectortype$ extends $abstractvectortype$ {
@ForceInline
private final <E>
VectorMask<E> defaultMaskCast(AbstractSpecies<E> dsp) {
assert(length() == dsp.laneCount());
if (length() != dsp.laneCount())
throw new IllegalArgumentException("VectorMask length and species length differ");
boolean[] maskArray = toArray();
// enum-switches don't optimize properly JDK-8161245
return switch (dsp.laneType.switchKey) {
case LaneType.SK_BYTE -> new Byte$bits$Vector.Byte$bits$Mask(maskArray).check(dsp);
case LaneType.SK_SHORT -> new Short$bits$Vector.Short$bits$Mask(maskArray).check(dsp);
case LaneType.SK_INT -> new Int$bits$Vector.Int$bits$Mask(maskArray).check(dsp);
case LaneType.SK_LONG -> new Long$bits$Vector.Long$bits$Mask(maskArray).check(dsp);
case LaneType.SK_FLOAT -> new Float$bits$Vector.Float$bits$Mask(maskArray).check(dsp);
case LaneType.SK_DOUBLE -> new Double$bits$Vector.Double$bits$Mask(maskArray).check(dsp);
default -> throw new AssertionError(dsp);
};
return dsp.maskFactory(maskArray).check(dsp);
}
@Override
@ -1040,24 +1032,7 @@ final class $vectortype$ extends $abstractvectortype$ {
if (length() != species.laneCount())
throw new IllegalArgumentException("VectorShuffle length and species length differ");
int[] shuffleArray = toArray();
// enum-switches don't optimize properly JDK-8161245
switch (species.laneType.switchKey) {
case LaneType.SK_BYTE:
return new Byte$bits$Vector.Byte$bits$Shuffle(shuffleArray).check(species);
case LaneType.SK_SHORT:
return new Short$bits$Vector.Short$bits$Shuffle(shuffleArray).check(species);
case LaneType.SK_INT:
return new Int$bits$Vector.Int$bits$Shuffle(shuffleArray).check(species);
case LaneType.SK_LONG:
return new Long$bits$Vector.Long$bits$Shuffle(shuffleArray).check(species);
case LaneType.SK_FLOAT:
return new Float$bits$Vector.Float$bits$Shuffle(shuffleArray).check(species);
case LaneType.SK_DOUBLE:
return new Double$bits$Vector.Double$bits$Shuffle(shuffleArray).check(species);
}
// Should not reach here.
throw new AssertionError(species);
return s.shuffleFromArray(shuffleArray, 0).check(s);
}
@ForceInline

View File

@ -24,7 +24,9 @@
import jdk.incubator.vector.Vector;
import jdk.incubator.vector.VectorOperators;
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorSpecies;
import jdk.incubator.vector.VectorShuffle;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
@ -241,6 +243,21 @@ abstract class AbstractVectorConversionTest {
return args.toArray(Object[][]::new);
}
static Object[][] fixedShapeXSegmentedCastSpeciesArgs(VectorShape srcShape, boolean legal) {
List<Object[]> args = new ArrayList<>();
for (Class<?> srcE : List.of(byte.class, short.class, int.class, long.class, float.class, double.class)) {
VectorSpecies<?> src = VectorSpecies.of(srcE, srcShape);
for (VectorShape dstShape : VectorShape.values()) {
for (Class<?> dstE : List.of(byte.class, short.class, int.class, long.class, float.class, double.class)) {
VectorSpecies<?> dst = VectorSpecies.of(dstE, dstShape);
if (legal == (dst.length() == src.length())) {
args.add(new Object[]{src, dst});
}
}
}
}
return args.toArray(Object[][]::new);
}
public enum ConvAPI {CONVERT, CONVERTSHAPE, CASTSHAPE, REINTERPRETSHAPE}
@ -488,4 +505,46 @@ abstract class AbstractVectorConversionTest {
Assert.assertEquals(actual, expected);
}
static <E,F> void legal_mask_cast_kernel(VectorSpecies<E> src, VectorSpecies<F> dst) {
for(int i = 0; i < INVOC_COUNT; i++) {
VectorMask<E> mask = VectorMask.fromLong(src, i);
VectorMask<F> res = mask.cast(dst);
Assert.assertEquals(res.toLong(), mask.toLong());
}
}
static <E,F> void illegal_mask_cast_kernel(VectorSpecies<E> src, VectorSpecies<F> dst) {
VectorMask<E> mask = VectorMask.fromLong(src, -1);
try {
mask.cast(dst);
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
static <E,F> void legal_shuffle_cast_kernel(VectorSpecies<E> src, VectorSpecies<F> dst) {
int [] arr = new int[src.length()*INVOC_COUNT];
for(int i = 0; i < arr.length; i++) {
arr[i] = i;
}
for(int i = 0; i < INVOC_COUNT; i++) {
VectorShuffle<E> shuffle = VectorShuffle.fromArray(src, arr, i);
VectorShuffle<F> res = shuffle.cast(dst);
Assert.assertEquals(res.toArray(), shuffle.toArray());
}
}
static <E,F> void illegal_shuffle_cast_kernel(VectorSpecies<E> src, VectorSpecies<F> dst) {
int [] arr = new int[src.length()];
for(int i = 0; i < arr.length; i++) {
arr[i] = i;
}
VectorShuffle<E> shuffle = VectorShuffle.fromArray(src, arr, 0);
try {
shuffle.cast(dst);
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
}

View File

@ -22,11 +22,15 @@
*/
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.VectorSpecies;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.util.function.IntFunction;
import java.util.List;
/**
* @test
@ -52,6 +56,16 @@ public class Vector128ConversionTests extends AbstractVectorConversionTest {
return fixedShapeXShapeSpeciesArgs(SHAPE);
}
@DataProvider
public Object[][] fixedShapeXSegmentedLegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, true);
}
@DataProvider
public Object[][] fixedShapeXSegmentedIllegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, false);
}
@Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(BUFFER_SIZE);
@ -75,4 +89,24 @@ public class Vector128ConversionTests extends AbstractVectorConversionTest {
Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void shuffleCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void shuffleCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void maskCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_mask_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void maskCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_mask_cast_kernel(src, dst);
}
}

View File

@ -22,11 +22,15 @@
*/
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.VectorSpecies;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.util.function.IntFunction;
import java.util.List;
/**
* @test
@ -52,6 +56,16 @@ public class Vector256ConversionTests extends AbstractVectorConversionTest {
return fixedShapeXShapeSpeciesArgs(SHAPE);
}
@DataProvider
public Object[][] fixedShapeXSegmentedLegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, true);
}
@DataProvider
public Object[][] fixedShapeXSegmentedIllegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, false);
}
@Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(BUFFER_SIZE);
@ -75,4 +89,24 @@ public class Vector256ConversionTests extends AbstractVectorConversionTest {
Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void shuffleCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void shuffleCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void maskCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_mask_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void maskCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_mask_cast_kernel(src, dst);
}
}

View File

@ -22,11 +22,15 @@
*/
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.VectorSpecies;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.util.function.IntFunction;
import java.util.List;
/**
* @test
@ -52,6 +56,16 @@ public class Vector512ConversionTests extends AbstractVectorConversionTest {
return fixedShapeXShapeSpeciesArgs(SHAPE);
}
@DataProvider
public Object[][] fixedShapeXSegmentedLegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, true);
}
@DataProvider
public Object[][] fixedShapeXSegmentedIllegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, false);
}
@Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(BUFFER_SIZE);
@ -75,4 +89,24 @@ public class Vector512ConversionTests extends AbstractVectorConversionTest {
Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void shuffleCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void shuffleCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void maskCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_mask_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void maskCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_mask_cast_kernel(src, dst);
}
}

View File

@ -22,12 +22,15 @@
*/
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.VectorSpecies;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.util.function.IntFunction;
import java.util.List;
/**
* @test
@ -74,6 +77,16 @@ public class Vector64ConversionTests extends AbstractVectorConversionTest {
return fixedShapeXShapeSpeciesArgs(SHAPE);
}
@DataProvider
public Object[][] fixedShapeXSegmentedLegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, true);
}
@DataProvider
public Object[][] fixedShapeXSegmentedIllegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, false);
}
@Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(BUFFER_SIZE);
@ -97,4 +110,24 @@ public class Vector64ConversionTests extends AbstractVectorConversionTest {
Object a = fa.apply(BUFFER_SIZE);
reinterpret_kernel(src, dst, a);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void shuffleCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void shuffleCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void maskCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_mask_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void maskCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_mask_cast_kernel(src, dst);
}
}

View File

@ -22,11 +22,15 @@
*/
import jdk.incubator.vector.VectorShape;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorShuffle;
import jdk.incubator.vector.VectorSpecies;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.util.function.IntFunction;
import java.util.List;
/**
* @test
@ -51,6 +55,16 @@ public class VectorMaxConversionTests extends AbstractVectorConversionTest {
return fixedShapeXShapeSpeciesArgs(SHAPE);
}
@DataProvider
public Object[][] fixedShapeXSegmentedLegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, true);
}
@DataProvider
public Object[][] fixedShapeXSegmentedIllegalCastSpecies() {
return fixedShapeXSegmentedCastSpeciesArgs(SHAPE, false);
}
@Test(dataProvider = "fixedShapeXfixedShape")
static <I, O> void convert(VectorSpecies<I> src, VectorSpecies<O> dst, IntFunction<?> fa) {
Object a = fa.apply(1024);
@ -74,4 +88,24 @@ public class VectorMaxConversionTests extends AbstractVectorConversionTest {
Object a = fa.apply(1024);
reinterpret_kernel(src, dst, a);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void shuffleCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void shuffleCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_shuffle_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedLegalCastSpecies")
static <E,F> void maskCast(VectorSpecies<E> src, VectorSpecies<F> dst) {
legal_mask_cast_kernel(src, dst);
}
@Test(dataProvider = "fixedShapeXSegmentedIllegalCastSpecies")
static <E,F> void maskCastNeg(VectorSpecies<E> src, VectorSpecies<F> dst) {
illegal_mask_cast_kernel(src, dst);
}
}