diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestIfMinMax.java b/test/hotspot/jtreg/compiler/c2/irTests/TestIfMinMax.java index bb0a1200a7f..fdc0a83fb8b 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestIfMinMax.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestIfMinMax.java @@ -296,7 +296,11 @@ public class TestIfMinMax { @Test @IR(applyIf = { "SuperWordReductions", "true" }, - applyIfCPUFeatureOr = { "avx512", "true", "rvv", "true" }, + applyIfCPUFeature = { "avx512", "true" }, + counts = { IRNode.MAX_REDUCTION_V, "> 0" }) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfAnd = { "SuperWordReductions", "true", "MaxVectorSize", ">=32" }, + applyIfCPUFeature = { "rvv", "true" }, counts = { IRNode.MAX_REDUCTION_V, "> 0" }) @Arguments(setup = "setupLongArrays") public Object[] testMaxLongReduction(long[] a, long[] b) { @@ -331,7 +335,11 @@ public class TestIfMinMax { @Test @IR(applyIf = { "SuperWordReductions", "true" }, - applyIfCPUFeatureOr = { "avx512", "true", "rvv", "true" }, + applyIfCPUFeature = { "avx512", "true" }, + counts = { IRNode.MIN_REDUCTION_V, "> 0" }) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfAnd = { "SuperWordReductions", "true", "MaxVectorSize", ">=32" }, + applyIfCPUFeature = { "rvv", "true" }, counts = { IRNode.MIN_REDUCTION_V, "> 0" }) @Arguments(setup = "setupLongArrays") public Object[] testMinLongReduction(long[] a, long[] b) { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java index 10cd32bbbc7..cd8e0aa8b7f 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java @@ -140,7 +140,7 @@ public class RedTest_long { counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop public static long sumReductionImplement( long[] a, @@ -162,7 +162,7 @@ public class RedTest_long { counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long orReductionImplement( long[] a, @@ -184,7 +184,7 @@ public class RedTest_long { counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long andReductionImplement( long[] a, @@ -206,7 +206,7 @@ public class RedTest_long { counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop public static long xorReductionImplement( long[] a, @@ -228,7 +228,7 @@ public class RedTest_long { counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop public static long mulReductionImplement( long[] a, diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Long.java b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Long.java index e803b33bd4f..64ec0941b22 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Long.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/SumRed_Long.java @@ -98,7 +98,7 @@ public class SumRed_Long { counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop @IR(applyIfPlatform = {"riscv64", "true"}, applyIfCPUFeature = {"rvv", "true"}, - applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"}, + applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"}, counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop public static long sumReductionImplement( long[] a, diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java index 92bc4f17446..bda0979a70b 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java @@ -81,10 +81,14 @@ public class TestGeneralizedReductions { } @Test - @IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}, + applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"}, + counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnGlobalAccumulator(long[] array) { acc = 0; for (int i = 0; i < array.length; i++) { @@ -94,10 +98,14 @@ public class TestGeneralizedReductions { } @Test - @IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}, + applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"}, + counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnPartiallyUnrolledLoop(long[] array) { int sum = 0; for (int i = 0; i < array.length / 2; i++) { @@ -108,10 +116,14 @@ public class TestGeneralizedReductions { } @Test - @IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"}, applyIfPlatform = {"64-bit", "true"}, counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}, + applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"}, + counts = {IRNode.ADD_REDUCTION_VI, ">= 1"}) private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) { int sum = 0; for (int i = 0; i < array.length / 8; i++) { diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java index 0a0f0c3114e..c862704da26 100644 --- a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java +++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java @@ -66,7 +66,19 @@ public class TestUnorderedReductionPartialVectorization { IRNode.OR_REDUCTION_V, "> 0",}, applyIfOr = {"AlignVector", "false", "UseCompactObjectHeaders", "false"}, applyIfPlatform = {"64-bit", "true"}, - applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"}) + applyIfCPUFeature = {"avx2", "true"}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", + IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", + IRNode.OR_REDUCTION_V, "> 0",}, + applyIfAnd = {"AlignVector", "false", "MaxVectorSize", ">=32"}, + applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}) + @IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", + IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0", + IRNode.OR_REDUCTION_V, "> 0",}, + applyIfAnd = {"UseCompactObjectHeaders", "false", "MaxVectorSize", ">=32"}, + applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}) static long test1(int[] data, long sum) { for (int i = 0; i < data.length; i+=2) { // Mixing int and long ops means we only end up allowing half of the int diff --git a/test/hotspot/jtreg/compiler/vectorization/runner/LoopReductionOpTest.java b/test/hotspot/jtreg/compiler/vectorization/runner/LoopReductionOpTest.java index ac8be6bc0ec..546d99f5cce 100644 --- a/test/hotspot/jtreg/compiler/vectorization/runner/LoopReductionOpTest.java +++ b/test/hotspot/jtreg/compiler/vectorization/runner/LoopReductionOpTest.java @@ -177,7 +177,11 @@ public class LoopReductionOpTest extends VectorizationTestRunner { @Test @IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"}, counts = {IRNode.STORE_VECTOR, ">0"}) - @IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"}, + @IR(applyIfCPUFeature = {"avx2", "true"}, + counts = {IRNode.ADD_REDUCTION_V, ">0"}) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}, + applyIf = {"MaxVectorSize", ">=32" }, counts = {IRNode.ADD_REDUCTION_V, ">0"}) public long reductionWithNonReductionDifferentSizes() { long res = 0L;