mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-25 15:20:11 +00:00
8314612: TestUnorderedReduction.java fails with -XX:MaxVectorSize=32 and -XX:+AlignVector
Reviewed-by: chagedorn, kvn
This commit is contained in:
parent
f8df754b9a
commit
f804f8652d
@ -4275,6 +4275,12 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) {
|
||||
break; // Chain traversal fails.
|
||||
}
|
||||
|
||||
assert(current->vect_type() != nullptr, "must have vector type");
|
||||
if (current->vect_type() != last_ur->vect_type()) {
|
||||
// Reductions do not have the same vector type (length and element type).
|
||||
break; // Chain traversal fails.
|
||||
}
|
||||
|
||||
// Expect single use of UnorderedReduction, except for last_ur.
|
||||
if (current == last_ur) {
|
||||
// Expect all uses to be outside the loop, except phi.
|
||||
|
||||
@ -22,11 +22,39 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8302652
|
||||
* @test id=Vanilla-Unaligned
|
||||
* @bug 8302652 8314612
|
||||
* @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
|
||||
* @requires vm.compiler2.enabled
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestUnorderedReduction
|
||||
* @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Unaligned
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test id=Vanilla-Aligned
|
||||
* @bug 8302652 8314612
|
||||
* @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
|
||||
* @requires vm.compiler2.enabled
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Aligned
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test id=MaxVectorSize16-Unaligned
|
||||
* @bug 8302652 8314612
|
||||
* @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
|
||||
* @requires vm.compiler2.enabled
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize16-Unaligned
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test id=MaxVectorSize32-Aligned
|
||||
* @bug 8302652 8314612
|
||||
* @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
|
||||
* @requires vm.compiler2.enabled
|
||||
* @library /test/lib /
|
||||
* @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize32-Aligned
|
||||
*/
|
||||
|
||||
package compiler.loopopts.superword;
|
||||
@ -38,9 +66,22 @@ public class TestUnorderedReduction {
|
||||
static final int ITER = 10;
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestFramework.runWithFlags("-Xbatch",
|
||||
"-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestUnorderedReduction::test*",
|
||||
"-XX:MaxVectorSize=16");
|
||||
TestFramework framework = new TestFramework(TestUnorderedReduction.class);
|
||||
framework.addFlags("-Xbatch",
|
||||
"-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestUnorderedReduction::test*");
|
||||
|
||||
if (args.length != 1) {
|
||||
throw new RuntimeException("Test requires exactly one argument!");
|
||||
}
|
||||
|
||||
switch (args[0]) {
|
||||
case "Vanilla-Unaligned" -> { framework.addFlags("-XX:-AlignVector"); }
|
||||
case "Vanilla-Aligned" -> { framework.addFlags("-XX:+AlignVector"); }
|
||||
case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:-AlignVector", "-XX:MaxVectorSize=16"); }
|
||||
case "MaxVectorSize32-Aligned" -> { framework.addFlags("-XX:+AlignVector", "-XX:MaxVectorSize=32"); }
|
||||
default -> { throw new RuntimeException("Test argument not recognized: " + args[0]); }
|
||||
}
|
||||
framework.start();
|
||||
}
|
||||
|
||||
@Run(test = {"test1", "test2", "test3"})
|
||||
@ -78,6 +119,7 @@ public class TestUnorderedReduction {
|
||||
@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
|
||||
IRNode.ADD_VI, "= 0",
|
||||
IRNode.ADD_REDUCTION_VI, "> 0"}, // count can be high
|
||||
applyIfAnd = {"MaxVectorSize", "=16", "AlignVector", "false"},
|
||||
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
|
||||
static int test1(int[] data, int sum) {
|
||||
// Vectorizes, but the UnorderedReduction cannot be moved out of the loop,
|
||||
@ -118,6 +160,7 @@ public class TestUnorderedReduction {
|
||||
IRNode.ADD_VI, "> 0",
|
||||
IRNode.ADD_REDUCTION_VI, "> 0",
|
||||
IRNode.ADD_REDUCTION_VI, "<= 2"}, // count must be low
|
||||
applyIfAnd = {"MaxVectorSize", "=16", "AlignVector", "false"},
|
||||
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
|
||||
static int test2(int[] data, int sum) {
|
||||
for (int i = 0; i < RANGE; i+=8) {
|
||||
@ -153,6 +196,7 @@ public class TestUnorderedReduction {
|
||||
IRNode.MUL_VI, "> 0",
|
||||
IRNode.ADD_VI, "= 0", // reduction not moved out of loop
|
||||
IRNode.ADD_REDUCTION_VI, "> 0",},
|
||||
applyIfAnd = {"MaxVectorSize", "=16", "AlignVector", "false"},
|
||||
applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
|
||||
static int test3(int[] data, int sum) {
|
||||
for (int i = 0; i < RANGE; i+=8) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user