8348263: C2 SuperWord: TestMemorySegment.java has failing IR rules with AlignVector after JDK-8343685

Reviewed-by: chagedorn, thartmann
This commit is contained in:
Emanuel Peter 2025-01-22 12:02:39 +00:00
parent 61873564a4
commit 16dcf15a14

View File

@ -39,6 +39,14 @@ import java.lang.foreign.*;
* @run driver compiler.loopopts.superword.TestMemorySegment ByteArray
*/
/*
* @test id=byte-array-AlignVector
* @bug 8329273 8348263
* @summary Test vectorization of loops over MemorySegment
* @library /test/lib /
* @run driver compiler.loopopts.superword.TestMemorySegment ByteArray AlignVector
*/
/*
* @test id=char-array
* @bug 8329273
@ -63,6 +71,14 @@ import java.lang.foreign.*;
* @run driver compiler.loopopts.superword.TestMemorySegment IntArray
*/
/*
* @test id=int-array-AlignVector
* @bug 8329273 8348263
* @summary Test vectorization of loops over MemorySegment
* @library /test/lib /
* @run driver compiler.loopopts.superword.TestMemorySegment IntArray AlignVector
*/
/*
* @test id=long-array
* @bug 8329273
@ -71,6 +87,14 @@ import java.lang.foreign.*;
* @run driver compiler.loopopts.superword.TestMemorySegment LongArray
*/
/*
* @test id=long-array-AlignVector
* @bug 8329273 8348263
* @summary Test vectorization of loops over MemorySegment
* @library /test/lib /
* @run driver compiler.loopopts.superword.TestMemorySegment LongArray AlignVector
*/
/*
* @test id=float-array
* @bug 8329273
@ -111,6 +135,14 @@ import java.lang.foreign.*;
* @run driver compiler.loopopts.superword.TestMemorySegment Native
*/
/*
* @test id=native-AlignVector
* @bug 8329273 8348263
* @summary Test vectorization of loops over MemorySegment
* @library /test/lib /
* @run driver compiler.loopopts.superword.TestMemorySegment Native AlignVector
*/
// FAILS: mixed providers currently do not vectorize. Maybe there is some inlining issue.
// /*
// * @test id=mixed-array
@ -140,6 +172,9 @@ public class TestMemorySegment {
public static void main(String[] args) {
TestFramework framework = new TestFramework(TestMemorySegmentImpl.class);
framework.addFlags("-DmemorySegmentProviderNameForTestVM=" + args[0]);
if (args.length > 1 && args[1].equals("AlignVector")) {
framework.addFlags("-XX:+AlignVector");
}
framework.setDefaultWarmup(100);
framework.start();
}
@ -556,6 +591,7 @@ class TestMemorySegmentImpl {
IRNode.ADD_VI, "> 0",
IRNode.STORE_VECTOR, "> 0"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static Object[] testIntLoop_longIndex_intInvar_int(MemorySegment a, int invar) {
for (int i = 0; i < (int)a.byteSize()/4; i++) {
@ -572,6 +608,7 @@ class TestMemorySegmentImpl {
IRNode.ADD_VI, "> 0",
IRNode.STORE_VECTOR, "> 0"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static Object[] testIntLoop_longIndex_longInvar_int(MemorySegment a, long invar) {
for (int i = 0; i < (int)a.byteSize()/4; i++) {
@ -705,14 +742,12 @@ class TestMemorySegmentImpl {
}
@Test
//@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
// IRNode.ADD_VI, "> 0",
// IRNode.STORE_VECTOR, "> 0"},
// applyIfPlatform = {"64-bit", "true"},
// applyIf = {"AlignVector", "false"},
// applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
// FAILS: for native memory. I think it is because of invariants, but need investigation.
// The long -> int loop conversion introduces extra invariants.
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
IRNode.ADD_VI, "> 0",
IRNode.STORE_VECTOR, "> 0"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static Object[] testLongLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) {
for (long i = 0; i < a.byteSize()/4; i++) {
long adr = 4L * (long)(i) + 4L * (long)(invar);
@ -723,14 +758,12 @@ class TestMemorySegmentImpl {
}
@Test
//@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
// IRNode.ADD_VI, "> 0",
// IRNode.STORE_VECTOR, "> 0"},
// applyIfPlatform = {"64-bit", "true"},
// applyIf = {"AlignVector", "false"},
// applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
// FAILS: for native memory. I think it is because of invariants, but need investigation.
// The long -> int loop conversion introduces extra invariants.
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
IRNode.ADD_VI, "> 0",
IRNode.STORE_VECTOR, "> 0"},
applyIfPlatform = {"64-bit", "true"},
applyIf = {"AlignVector", "false"},
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
static Object[] testLongLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) {
for (long i = 0; i < a.byteSize()/4; i++) {
long adr = 4L * (long)(i) + 4L * (long)(invar);