Skip to content

Commit 16dcf15

Browse files
committed
8348263: C2 SuperWord: TestMemorySegment.java has failing IR rules with AlignVector after JDK-8343685
Reviewed-by: chagedorn, thartmann
1 parent 6187356 commit 16dcf15

File tree

1 file changed

+49
-16
lines changed

1 file changed

+49
-16
lines changed

test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
* @run driver compiler.loopopts.superword.TestMemorySegment ByteArray
4040
*/
4141

42+
/*
43+
* @test id=byte-array-AlignVector
44+
* @bug 8329273 8348263
45+
* @summary Test vectorization of loops over MemorySegment
46+
* @library /test/lib /
47+
* @run driver compiler.loopopts.superword.TestMemorySegment ByteArray AlignVector
48+
*/
49+
4250
/*
4351
* @test id=char-array
4452
* @bug 8329273
@@ -63,6 +71,14 @@
6371
* @run driver compiler.loopopts.superword.TestMemorySegment IntArray
6472
*/
6573

74+
/*
75+
* @test id=int-array-AlignVector
76+
* @bug 8329273 8348263
77+
* @summary Test vectorization of loops over MemorySegment
78+
* @library /test/lib /
79+
* @run driver compiler.loopopts.superword.TestMemorySegment IntArray AlignVector
80+
*/
81+
6682
/*
6783
* @test id=long-array
6884
* @bug 8329273
@@ -71,6 +87,14 @@
7187
* @run driver compiler.loopopts.superword.TestMemorySegment LongArray
7288
*/
7389

90+
/*
91+
* @test id=long-array-AlignVector
92+
* @bug 8329273 8348263
93+
* @summary Test vectorization of loops over MemorySegment
94+
* @library /test/lib /
95+
* @run driver compiler.loopopts.superword.TestMemorySegment LongArray AlignVector
96+
*/
97+
7498
/*
7599
* @test id=float-array
76100
* @bug 8329273
@@ -111,6 +135,14 @@
111135
* @run driver compiler.loopopts.superword.TestMemorySegment Native
112136
*/
113137

138+
/*
139+
* @test id=native-AlignVector
140+
* @bug 8329273 8348263
141+
* @summary Test vectorization of loops over MemorySegment
142+
* @library /test/lib /
143+
* @run driver compiler.loopopts.superword.TestMemorySegment Native AlignVector
144+
*/
145+
114146
// FAILS: mixed providers currently do not vectorize. Maybe there is some inlining issue.
115147
// /*
116148
// * @test id=mixed-array
@@ -140,6 +172,9 @@ public class TestMemorySegment {
140172
public static void main(String[] args) {
141173
TestFramework framework = new TestFramework(TestMemorySegmentImpl.class);
142174
framework.addFlags("-DmemorySegmentProviderNameForTestVM=" + args[0]);
175+
if (args.length > 1 && args[1].equals("AlignVector")) {
176+
framework.addFlags("-XX:+AlignVector");
177+
}
143178
framework.setDefaultWarmup(100);
144179
framework.start();
145180
}
@@ -556,6 +591,7 @@ static Object[] testIntLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, lon
556591
IRNode.ADD_VI, "> 0",
557592
IRNode.STORE_VECTOR, "> 0"},
558593
applyIfPlatform = {"64-bit", "true"},
594+
applyIf = {"AlignVector", "false"},
559595
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
560596
static Object[] testIntLoop_longIndex_intInvar_int(MemorySegment a, int invar) {
561597
for (int i = 0; i < (int)a.byteSize()/4; i++) {
@@ -572,6 +608,7 @@ static Object[] testIntLoop_longIndex_intInvar_int(MemorySegment a, int invar) {
572608
IRNode.ADD_VI, "> 0",
573609
IRNode.STORE_VECTOR, "> 0"},
574610
applyIfPlatform = {"64-bit", "true"},
611+
applyIf = {"AlignVector", "false"},
575612
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
576613
static Object[] testIntLoop_longIndex_longInvar_int(MemorySegment a, long invar) {
577614
for (int i = 0; i < (int)a.byteSize()/4; i++) {
@@ -705,14 +742,12 @@ static Object[] testLongLoop_iv_int(MemorySegment a) {
705742
}
706743

707744
@Test
708-
//@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
709-
// IRNode.ADD_VI, "> 0",
710-
// IRNode.STORE_VECTOR, "> 0"},
711-
// applyIfPlatform = {"64-bit", "true"},
712-
// applyIf = {"AlignVector", "false"},
713-
// applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
714-
// FAILS: for native memory. I think it is because of invariants, but need investigation.
715-
// The long -> int loop conversion introduces extra invariants.
745+
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
746+
IRNode.ADD_VI, "> 0",
747+
IRNode.STORE_VECTOR, "> 0"},
748+
applyIfPlatform = {"64-bit", "true"},
749+
applyIf = {"AlignVector", "false"},
750+
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
716751
static Object[] testLongLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) {
717752
for (long i = 0; i < a.byteSize()/4; i++) {
718753
long adr = 4L * (long)(i) + 4L * (long)(invar);
@@ -723,14 +758,12 @@ static Object[] testLongLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int
723758
}
724759

725760
@Test
726-
//@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
727-
// IRNode.ADD_VI, "> 0",
728-
// IRNode.STORE_VECTOR, "> 0"},
729-
// applyIfPlatform = {"64-bit", "true"},
730-
// applyIf = {"AlignVector", "false"},
731-
// applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
732-
// FAILS: for native memory. I think it is because of invariants, but need investigation.
733-
// The long -> int loop conversion introduces extra invariants.
761+
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
762+
IRNode.ADD_VI, "> 0",
763+
IRNode.STORE_VECTOR, "> 0"},
764+
applyIfPlatform = {"64-bit", "true"},
765+
applyIf = {"AlignVector", "false"},
766+
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
734767
static Object[] testLongLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) {
735768
for (long i = 0; i < a.byteSize()/4; i++) {
736769
long adr = 4L * (long)(i) + 4L * (long)(invar);

0 commit comments

Comments
 (0)