Skip to content

Commit f091c76

Browse files
sophia-guoPaul Hohensee
authored andcommitted
8333248: VectorGatherMaskFoldingTest.java failed when maximum vector bits is 64
Backport-of: 9b0a5c5cd056262fab99525e9260762b617152a3
1 parent 4bbc29c commit f091c76

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

test/hotspot/jtreg/compiler/vectorapi/VectorGatherMaskFoldingTest.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class VectorGatherMaskFoldingTest {
100100
for (int i = 0; i < L_SPECIES.length(); i++) {
101101
longArray[i] = i + 1;
102102
longArray2[i] = L_SPECIES.length() - i + 1;
103-
longMask[i] = i % 2 == 0;
103+
longMask[i] = L_SPECIES.length() > 1 && i % 2 == 0;
104104
longMask2[i] = i >= L_SPECIES.length() / 2;
105105
longIndices[i] = (i + L_SPECIES.length() / 2) % L_SPECIES.length();
106106
longIndices2[i] = (L_SPECIES.length() - i) % L_SPECIES.length();
@@ -126,7 +126,7 @@ public class VectorGatherMaskFoldingTest {
126126
for (int i = 0; i < D_SPECIES.length(); i++) {
127127
doubleArray[i] = (double) i + 1.0;
128128
doubleArray2[i] = (double) (D_SPECIES.length() - i) + 1.0;
129-
doubleMask[i] = i % 2 == 0;
129+
doubleMask[i] = D_SPECIES.length() > 1 && i % 2 == 0;
130130
doubleMask2[i] = i >= D_SPECIES.length() / 2;
131131
doubleIndices[i] = (i + D_SPECIES.length() / 2) % D_SPECIES.length();
132132
doubleIndices2[i] = (D_SPECIES.length() - i) % D_SPECIES.length();
@@ -168,15 +168,15 @@ public static void testTwoLongVectorLoadGatherNotEqualArray() {
168168
public static void testTwoLongVectorLoadGatherNotEqualIndices() {
169169
LongVector res = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0);
170170
LongVector res2 = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices2, 0);
171-
Asserts.assertNotEquals(res, res2);
171+
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(res2));
172172
}
173173

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

182182
@Test
@@ -232,7 +232,7 @@ public static void testTwoLongVectorLoadGatherMaskedNotEqualMask() {
232232
public static void testTwoLongVectorLoadGatherMaskedNotEqualIndices() {
233233
LongVector res = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices, 0, longVectorMask);
234234
LongVector res2 = LongVector.fromArray(L_SPECIES, longArray, 0, longIndices2, 0, longVectorMask);
235-
Asserts.assertNotEquals(res, res2);
235+
Asserts.assertFalse(L_SPECIES.length() != 1 && res.equals(res2));
236236
}
237237

238238

@@ -334,15 +334,15 @@ public static void testTwoDoubleVectorLoadGatherNotEqualArray() {
334334
public static void testTwoDoubleVectorLoadGatherNotEqualIndices() {
335335
DoubleVector res = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0);
336336
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices2, 0);
337-
Asserts.assertNotEquals(res, res2);
337+
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(res2));
338338
}
339339

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

348348
@Test
@@ -398,7 +398,7 @@ public static void testTwoDoubleVectorLoadGatherMaskedNotEqualMask() {
398398
public static void testTwoDoubleVectorLoadGatherMaskedNotEqualIndices() {
399399
DoubleVector res = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0, doubleVectorMask);
400400
DoubleVector res2 = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices2, 0, doubleVectorMask);
401-
Asserts.assertNotEquals(res, res2);
401+
Asserts.assertFalse(D_SPECIES.length() != 1 && res.equals(res2));
402402
}
403403

404404

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

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

522522
@Test
@@ -586,7 +586,7 @@ public static void testTwoLongVectorStoreScatterMaskedNotEqualIndices() {
586586
long[] res2 = new long[L_SPECIES.length()];
587587
longVector.intoArray(res, 0, longIndices, 0, longVectorMask);
588588
longVector.intoArray(res2, 0, longIndices2, 0, longVectorMask);
589-
Asserts.assertFalse(Arrays.equals(res, res2));
589+
Asserts.assertFalse(L_SPECIES.length() != 1 && Arrays.equals(res, res2));
590590
}
591591

592592

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

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

728728
@Test
@@ -792,7 +792,7 @@ public static void testTwoDoubleVectorStoreScatterMaskedNotEqualIndices() {
792792
double[] res2 = new double[D_SPECIES.length()];
793793
doubleVector.intoArray(res, 0, doubleIndices, 0, doubleVectorMask);
794794
doubleVector.intoArray(res2, 0, doubleIndices2, 0, doubleVectorMask);
795-
Asserts.assertFalse(Arrays.equals(res, res2));
795+
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, res2));
796796
}
797797

798798

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

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

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

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

969969

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

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

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

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

11011101

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

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

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

12171217
@Test
@@ -1289,7 +1289,7 @@ public static void testOneDoubleVectorLoadGatherStore() {
12891289
double[] res = new double[D_SPECIES.length()];
12901290
DoubleVector vector = DoubleVector.fromArray(D_SPECIES, doubleArray, 0, doubleIndices, 0);
12911291
vector.intoArray(res, 0);
1292-
Asserts.assertFalse(Arrays.equals(res, doubleArray));
1292+
Asserts.assertFalse(D_SPECIES.length() != 1 && Arrays.equals(res, doubleArray));
12931293
}
12941294

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

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

13311331
@Test
@@ -1398,7 +1398,7 @@ public static void testFloatVectorLoadMaskedStoreVector() {
13981398
public static void main(String[] args) {
13991399
TestFramework testFramework = new TestFramework();
14001400
testFramework.setDefaultWarmup(10000)
1401-
.addFlags("--add-modules=jdk.incubator.vector", "-XX:+IncrementalInlineForceCleanup")
1401+
.addFlags("--add-modules=jdk.incubator.vector", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:+IncrementalInlineForceCleanup")
14021402
.start();
14031403
}
14041404
}

0 commit comments

Comments
 (0)