8306008: Several Vector API tests fail for client VM after JDK-8304450

Reviewed-by: psandoz
This commit is contained in:
Quan Anh Mai 2023-04-25 16:13:45 +00:00
parent e8f62de1cf
commit 0ff3a2784e
11 changed files with 275 additions and 70 deletions

View file

@ -805,13 +805,31 @@ final class Double128Vector extends DoubleVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -809,13 +809,31 @@ final class Double256Vector extends DoubleVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -817,13 +817,31 @@ final class Double512Vector extends DoubleVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -803,7 +803,31 @@ final class Double64Vector extends DoubleVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
a[offset] = laneSource(0);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -802,13 +802,31 @@ final class DoubleMaxVector extends DoubleVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -806,13 +806,31 @@ final class Long128Vector extends LongVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -810,13 +810,31 @@ final class Long256Vector extends LongVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -818,13 +818,31 @@ final class Long512Vector extends LongVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -804,7 +804,31 @@ final class Long64Vector extends LongVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
a[offset] = laneSource(0);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -804,13 +804,31 @@ final class LongMaxVector extends LongVector {
@Override
@ForceInline
public void intoArray(int[] a, int offset) {
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
}
private static long[] prepare(int[] indices, int offset) {

View file

@ -1132,18 +1132,31 @@ final class $vectortype$ extends $abstractvectortype$ {
toBitsVector().intoArray(a, offset);
#end[intOrFloat]
#if[longOrDouble]
#if[!1L]
VectorSpecies<Integer> species = VectorSpecies.of(
int.class,
VectorShape.forBitSize(length() * Integer.SIZE));
Vector<Long> v = toBitsVector();
v.convertShape(VectorOperators.L2I, species, 0)
.reinterpretAsInts()
.intoArray(a, offset);
#end[!1L]
#if[1L]
a[offset] = laneSource(0);
#end[1L]
switch (length()) {
case 1 -> a[offset] = laneSource(0);
case 2 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_64, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 4 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_128, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 8 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_256, 0)
.reinterpretAsInts()
.intoArray(a, offset);
case 16 -> toBitsVector()
.convertShape(VectorOperators.L2I, IntVector.SPECIES_512, 0)
.reinterpretAsInts()
.intoArray(a, offset);
default -> {
VectorIntrinsics.checkFromIndexSize(offset, length(), a.length);
for (int i = 0; i < length(); i++) {
a[offset + i] = laneSource(i);
}
}
}
#end[longOrDouble]
}