Skip to content

Commit

Permalink
8333248: VectorGatherMaskFoldingTest.java failed when maximum vector …
Browse files Browse the repository at this point in the history
…bits is 64

Backport-of: 9b0a5c5
  • Loading branch information
sophia-guo authored and Paul Hohensee committed Nov 22, 2024
1 parent 4bbc29c commit f091c76
Showing 1 changed file with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class VectorGatherMaskFoldingTest {
for (int i = 0; i < L_SPECIES.length(); i++) {
longArray[i] = i + 1;
longArray2[i] = L_SPECIES.length() - i + 1;
longMask[i] = i % 2 == 0;
longMask[i] = L_SPECIES.length() > 1 && i % 2 == 0;
longMask2[i] = i >= L_SPECIES.length() / 2;
longIndices[i] = (i + L_SPECIES.length() / 2) % L_SPECIES.length();
longIndices2[i] = (L_SPECIES.length() - i) % L_SPECIES.length();
Expand All @@ -126,7 +126,7 @@ public class VectorGatherMaskFoldingTest {
for (int i = 0; i < D_SPECIES.length(); i++) {
doubleArray[i] = (double) i + 1.0;
doubleArray2[i] = (double) (D_SPECIES.length() - i) + 1.0;
doubleMask[i] = i % 2 == 0;
doubleMask[i] = D_SPECIES.length() > 1 && i % 2 == 0;
doubleMask2[i] = i >= D_SPECIES.length() / 2;
doubleIndices[i] = (i + D_SPECIES.length() / 2) % D_SPECIES.length();
doubleIndices2[i] = (D_SPECIES.length() - i) % D_SPECIES.length();
Expand Down Expand Up @@ -168,15 +168,15 @@ public static void testTwoLongVectorLoadGatherNotEqualArray() {
public static void testTwoLongVectorLoadGatherNotEqualIndices() {
LongVector res = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0);
LongVector res2 = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices2, 0);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(res2));
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, ">= 1", IRNode.LOAD_VECTOR_GATHER, ">= 1" }, applyIfCPUFeatureOr = {"avx2", "true", "sve", "true"})
public static void testOneLongVectorLoadGather() {
LongVector res = LongVector.fromArray(L_SPECIES, longArray, 0);
LongVector res2 = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(res2));
}

@Test
Expand Down Expand Up @@ -232,7 +232,7 @@ public static void testTwoLongVectorLoadGatherMaskedNotEqualMask() {
public static void testTwoLongVectorLoadGatherMaskedNotEqualIndices() {
LongVector res = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0, longVectorMask);
LongVector res2 = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices2, 0, longVectorMask);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(res2));
}


Expand Down Expand Up @@ -334,15 +334,15 @@ public static void testTwoDoubleVectorLoadGatherNotEqualArray() {
public static void testTwoDoubleVectorLoadGatherNotEqualIndices() {
DoubleVector res = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0);
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices2, 0);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(res2));
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_D, ">= 1", IRNode.LOAD_VECTOR_GATHER, ">= 1" }, applyIfCPUFeatureOr = {"avx2", "true", "sve", "true"})
public static void testOneDoubleVectorLoadGather() {
DoubleVector res = DoubleVector.fromArray(D_SPECIES, doubleArray, 0);
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(res2));
}

@Test
Expand Down Expand Up @@ -398,7 +398,7 @@ public static void testTwoDoubleVectorLoadGatherMaskedNotEqualMask() {
public static void testTwoDoubleVectorLoadGatherMaskedNotEqualIndices() {
DoubleVector res = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0, doubleVectorMask);
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices2, 0, doubleVectorMask);
Asserts.assertNotEquals(res, res2);
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(res2));
}


Expand Down Expand Up @@ -506,7 +506,7 @@ public static void testTwoLongVectorStoreScatterNotEqualIndices() {
long[] res2 = new long[L_SPECIES.length()];
longVector.intoArray(res, 0, longIndices, 0);
longVector.intoArray(res2, 0, longIndices2, 0);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, res2));
}

@Test
Expand All @@ -516,7 +516,7 @@ public static void testOneLongVectorStoreScatter() {
long[] res2 = new long[L_SPECIES.length()];
longVector.intoArray(res, 0);
longVector.intoArray(res2, 0, longIndices, 0);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, res2));
}

@Test
Expand Down Expand Up @@ -586,7 +586,7 @@ public static void testTwoLongVectorStoreScatterMaskedNotEqualIndices() {
long[] res2 = new long[L_SPECIES.length()];
longVector.intoArray(res, 0, longIndices, 0, longVectorMask);
longVector.intoArray(res2, 0, longIndices2, 0, longVectorMask);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, res2));
}


Expand Down Expand Up @@ -712,7 +712,7 @@ public static void testTwoDoubleVectorStoreScatterNotEqualIndices() {
double[] res2 = new double[D_SPECIES.length()];
doubleVector.intoArray(res, 0, doubleIndices, 0);
doubleVector.intoArray(res2, 0, doubleIndices2, 0);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, res2));
}

@Test
Expand All @@ -722,7 +722,7 @@ public static void testOneDoubleVectorStoreScatter() {
double[] res2 = new double[D_SPECIES.length()];
doubleVector.intoArray(res, 0);
doubleVector.intoArray(res2, 0, doubleIndices, 0);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, res2));
}

@Test
Expand Down Expand Up @@ -792,7 +792,7 @@ public static void testTwoDoubleVectorStoreScatterMaskedNotEqualIndices() {
double[] res2 = new double[D_SPECIES.length()];
doubleVector.intoArray(res, 0, doubleIndices, 0, doubleVectorMask);
doubleVector.intoArray(res2, 0, doubleIndices2, 0, doubleVectorMask);
Asserts.assertFalse(Arrays.equals(res, res2));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, res2));
}


Expand Down Expand Up @@ -909,7 +909,7 @@ public static void testOneLongVectorStoreLoadGather() {
long[] array = new long[L_SPECIES.length()];
longVector.intoArray(array, 0);
LongVector res = LongVector.fromArray(L_SPECIES, array, 0, longIndices, 0);
Asserts.assertNotEquals(res, longVector);
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(longVector));
}

@Test
Expand All @@ -918,7 +918,7 @@ public static void testOneLongVectorStoreScatterLoad() {
long[] array = new long[L_SPECIES.length()];
longVector.intoArray(array, 0, longIndices, 0);
LongVector res = LongVector.fromArray(L_SPECIES, array, 0);
Asserts.assertNotEquals(res, longVector);
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(longVector));
}

@Test
Expand All @@ -945,7 +945,7 @@ public static void testLongVectorLoadGatherStoreScatterDuplicateIndicesVector()
long[] res = new long[L_SPECIES.length()];
longVector.intoArray(res, 0, duplicateLongIndices, 0);
LongVector res2 = LongVector.fromArray(L_SPECIES, res, 0, duplicateLongIndices, 0);
Asserts.assertNotEquals(res2, longVector);
Asserts.assertFalse(L_SPECIES.length() != 1 && res2.equals(longVector));
}

@Test
Expand All @@ -963,7 +963,7 @@ public static void testStoreLoadLongVectorDifferentSpeciesVector() {
long[] res = new long[L_SPECIES.length()];
longVector.intoArray(res, 0);
LongVector res2 = LongVector.fromArray(LongVector.SPECIES_64, res, 0);
Asserts.assertNotEquals(res2, longVector);
Asserts.assertFalse(L_SPECIES.length() != 1 && res2.equals(longVector));
}


Expand Down Expand Up @@ -1041,7 +1041,7 @@ public static void testOneDoubleVectorStoreLoadGather() {
double[] array = new double[D_SPECIES.length()];
doubleVector.intoArray(array, 0);
DoubleVector res = DoubleVector.fromArray(D_SPECIES, array, 0, doubleIndices, 0);
Asserts.assertNotEquals(res, doubleVector);
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(doubleVector));
}

@Test
Expand All @@ -1050,7 +1050,7 @@ public static void testOneDoubleVectorStoreScatterLoad() {
double[] array = new double[D_SPECIES.length()];
doubleVector.intoArray(array, 0, doubleIndices, 0);
DoubleVector res = DoubleVector.fromArray(D_SPECIES, array, 0);
Asserts.assertNotEquals(res, doubleVector);
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(doubleVector));
}

@Test
Expand All @@ -1077,7 +1077,7 @@ public static void testDoubleVectorLoadGatherStoreScatterDuplicateIndicesVector(
double[] res = new double[D_SPECIES.length()];
doubleVector.intoArray(res, 0, duplicateDoubleIndices, 0);
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, res, 0, duplicateDoubleIndices, 0);
Asserts.assertNotEquals(res2, doubleVector);
Asserts.assertFalse(D_SPECIES.length() != 1 && res2.equals(doubleVector));
}

@Test
Expand All @@ -1095,7 +1095,7 @@ public static void testStoreLoadDoubleVectorDifferentSpeciesVector() {
double[] res = new double[D_SPECIES.length()];
doubleVector.intoArray(res, 0);
DoubleVector res2 = DoubleVector.fromArray(DoubleVector.SPECIES_64, res, 0);
Asserts.assertNotEquals(res2, doubleVector);
Asserts.assertFalse(D_SPECIES.length() != 1 && res2.equals(doubleVector));
}


Expand Down Expand Up @@ -1175,7 +1175,7 @@ public static void testOneLongVectorLoadGatherStore() {
long[] res = new long[L_SPECIES.length()];
LongVector vector = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0);
vector.intoArray(res, 0);
Asserts.assertFalse(Arrays.equals(res, longArray));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, longArray));
}

@Test
Expand All @@ -1184,7 +1184,7 @@ public static void testOneLongVectorLoadStoreScatter() {
long[] res = new long[L_SPECIES.length()];
LongVector vector = LongVector.fromArray(L_SPECIES, longArray, 0);
vector.intoArray(res, 0, longIndices, 0);
Asserts.assertFalse(Arrays.equals(res, longArray));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, longArray));
}

@Test
Expand All @@ -1211,7 +1211,7 @@ public static void testLongVectorStoreScatterLoadGatherDuplicateIndicesVector()
long[] res = new long[L_SPECIES.length()];
LongVector vector = LongVector.fromArray(L_SPECIES, longArray, 0, duplicateLongIndices, 0);
vector.intoArray(res, 0, duplicateLongIndices, 0);
Asserts.assertFalse(Arrays.equals(res, longArray));
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, longArray));
}

@Test
Expand Down Expand Up @@ -1289,7 +1289,7 @@ public static void testOneDoubleVectorLoadGatherStore() {
double[] res = new double[D_SPECIES.length()];
DoubleVector vector = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0);
vector.intoArray(res, 0);
Asserts.assertFalse(Arrays.equals(res, doubleArray));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, doubleArray));
}

@Test
Expand All @@ -1298,7 +1298,7 @@ public static void testOneDoubleVectorLoadStoreScatter() {
double[] res = new double[D_SPECIES.length()];
DoubleVector vector = DoubleVector.fromArray(D_SPECIES, doubleArray, 0);
vector.intoArray(res, 0, doubleIndices, 0);
Asserts.assertFalse(Arrays.equals(res, doubleArray));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, doubleArray));
}

@Test
Expand All @@ -1325,7 +1325,7 @@ public static void testDoubleVectorStoreScatterLoadGatherDuplicateIndicesVector(
double[] res = new double[D_SPECIES.length()];
DoubleVector vector = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, duplicateDoubleIndices, 0);
vector.intoArray(res, 0, duplicateDoubleIndices, 0);
Asserts.assertFalse(Arrays.equals(res, doubleArray));
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, doubleArray));
}

@Test
Expand Down Expand Up @@ -1398,7 +1398,7 @@ public static void testFloatVectorLoadMaskedStoreVector() {
public static void main(String[] args) {
TestFramework testFramework = new TestFramework();
testFramework.setDefaultWarmup(10000)
.addFlags("--add-modules=jdk.incubator.vector", "-XX:+IncrementalInlineForceCleanup")
.addFlags("--add-modules=jdk.incubator.vector", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+IncrementalInlineForceCleanup")
.start();
}
}

0 comments on commit f091c76

Please sign in to comment.