Skip to content

Commit df6c6d1

Browse files
author
duke
committed
Backport 15b5b54ac707ba0d4e473fd6eb02c38a8efe705c
1 parent db62309 commit df6c6d1

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

test/hotspot/jtreg/compiler/c2/irTests/TestIfMinMax.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ public void checkTestMinIntReduction(Object[] vals) {
296296

297297
@Test
298298
@IR(applyIf = { "SuperWordReductions", "true" },
299-
applyIfCPUFeatureOr = { "avx512", "true", "rvv", "true" },
299+
applyIfCPUFeature = { "avx512", "true" },
300+
counts = { IRNode.MAX_REDUCTION_V, "> 0" })
301+
@IR(applyIfPlatform = {"riscv64", "true"},
302+
applyIfAnd = { "SuperWordReductions", "true", "MaxVectorSize", ">=32" },
303+
applyIfCPUFeature = { "rvv", "true" },
300304
counts = { IRNode.MAX_REDUCTION_V, "> 0" })
301305
@Arguments(setup = "setupLongArrays")
302306
public Object[] testMaxLongReduction(long[] a, long[] b) {
@@ -331,7 +335,11 @@ public void checkTestMaxLongReduction(Object[] vals) {
331335

332336
@Test
333337
@IR(applyIf = { "SuperWordReductions", "true" },
334-
applyIfCPUFeatureOr = { "avx512", "true", "rvv", "true" },
338+
applyIfCPUFeature = { "avx512", "true" },
339+
counts = { IRNode.MIN_REDUCTION_V, "> 0" })
340+
@IR(applyIfPlatform = {"riscv64", "true"},
341+
applyIfAnd = { "SuperWordReductions", "true", "MaxVectorSize", ">=32" },
342+
applyIfCPUFeature = { "rvv", "true" },
335343
counts = { IRNode.MIN_REDUCTION_V, "> 0" })
336344
@Arguments(setup = "setupLongArrays")
337345
public Object[] testMinLongReduction(long[] a, long[] b) {

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public static void reductionInit2(
140140
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
141141
@IR(applyIfPlatform = {"riscv64", "true"},
142142
applyIfCPUFeature = {"rvv", "true"},
143-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
143+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
144144
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
145145
public static long sumReductionImplement(
146146
long[] a,
@@ -162,7 +162,7 @@ public static long sumReductionImplement(
162162
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
163163
@IR(applyIfPlatform = {"riscv64", "true"},
164164
applyIfCPUFeature = {"rvv", "true"},
165-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
165+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
166166
counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
167167
public static long orReductionImplement(
168168
long[] a,
@@ -184,7 +184,7 @@ public static long orReductionImplement(
184184
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
185185
@IR(applyIfPlatform = {"riscv64", "true"},
186186
applyIfCPUFeature = {"rvv", "true"},
187-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
187+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
188188
counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
189189
public static long andReductionImplement(
190190
long[] a,
@@ -206,7 +206,7 @@ public static long andReductionImplement(
206206
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
207207
@IR(applyIfPlatform = {"riscv64", "true"},
208208
applyIfCPUFeature = {"rvv", "true"},
209-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
209+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
210210
counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
211211
public static long xorReductionImplement(
212212
long[] a,
@@ -228,7 +228,7 @@ public static long xorReductionImplement(
228228
counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
229229
@IR(applyIfPlatform = {"riscv64", "true"},
230230
applyIfCPUFeature = {"rvv", "true"},
231-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
231+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
232232
counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
233233
public static long mulReductionImplement(
234234
long[] a,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static void sumReductionInit(
9898
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
9999
@IR(applyIfPlatform = {"riscv64", "true"},
100100
applyIfCPUFeature = {"rvv", "true"},
101-
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
101+
applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8", "MaxVectorSize", ">=32"},
102102
counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
103103
public static long sumReductionImplement(
104104
long[] a,

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ private static void initArray(long[] array) {
8181
}
8282

8383
@Test
84-
@IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"},
84+
@IR(applyIfCPUFeature = {"avx2", "true"},
8585
applyIf = {"SuperWordReductions", "true"},
8686
applyIfPlatform = {"64-bit", "true"},
8787
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
88+
@IR(applyIfPlatform = {"riscv64", "true"},
89+
applyIfCPUFeature = {"rvv", "true"},
90+
applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"},
91+
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
8892
private static long testReductionOnGlobalAccumulator(long[] array) {
8993
acc = 0;
9094
for (int i = 0; i < array.length; i++) {
@@ -94,10 +98,14 @@ private static long testReductionOnGlobalAccumulator(long[] array) {
9498
}
9599

96100
@Test
97-
@IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"},
101+
@IR(applyIfCPUFeature = {"avx2", "true"},
98102
applyIf = {"SuperWordReductions", "true"},
99103
applyIfPlatform = {"64-bit", "true"},
100104
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
105+
@IR(applyIfPlatform = {"riscv64", "true"},
106+
applyIfCPUFeature = {"rvv", "true"},
107+
applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"},
108+
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
101109
private static long testReductionOnPartiallyUnrolledLoop(long[] array) {
102110
int sum = 0;
103111
for (int i = 0; i < array.length / 2; i++) {
@@ -108,10 +116,14 @@ private static long testReductionOnPartiallyUnrolledLoop(long[] array) {
108116
}
109117

110118
@Test
111-
@IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"},
119+
@IR(applyIfCPUFeature = {"avx2", "true"},
112120
applyIf = {"SuperWordReductions", "true"},
113121
applyIfPlatform = {"64-bit", "true"},
114122
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
123+
@IR(applyIfPlatform = {"riscv64", "true"},
124+
applyIfCPUFeature = {"rvv", "true"},
125+
applyIfAnd = {"SuperWordReductions", "true", "MaxVectorSize", ">=32"},
126+
counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
115127
private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) {
116128
int sum = 0;
117129
for (int i = 0; i < array.length / 8; i++) {

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,19 @@ public void runTests() throws Exception {
6666
IRNode.OR_REDUCTION_V, "> 0",},
6767
applyIfOr = {"AlignVector", "false", "UseCompactObjectHeaders", "false"},
6868
applyIfPlatform = {"64-bit", "true"},
69-
applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"})
69+
applyIfCPUFeature = {"avx2", "true"})
70+
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
71+
IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
72+
IRNode.OR_REDUCTION_V, "> 0",},
73+
applyIfAnd = {"AlignVector", "false", "MaxVectorSize", ">=32"},
74+
applyIfPlatform = {"riscv64", "true"},
75+
applyIfCPUFeature = {"rvv", "true"})
76+
@IR(counts = {IRNode.LOAD_VECTOR_I, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
77+
IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
78+
IRNode.OR_REDUCTION_V, "> 0",},
79+
applyIfAnd = {"UseCompactObjectHeaders", "false", "MaxVectorSize", ">=32"},
80+
applyIfPlatform = {"riscv64", "true"},
81+
applyIfCPUFeature = {"rvv", "true"})
7082
static long test1(int[] data, long sum) {
7183
for (int i = 0; i < data.length; i+=2) {
7284
// Mixing int and long ops means we only end up allowing half of the int

test/hotspot/jtreg/compiler/vectorization/runner/LoopReductionOpTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@ public double twoReductionsDifferentSizes2() {
177177
@Test
178178
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true", "rvv", "true"},
179179
counts = {IRNode.STORE_VECTOR, ">0"})
180-
@IR(applyIfCPUFeatureOr = {"avx2", "true", "rvv", "true"},
180+
@IR(applyIfCPUFeature = {"avx2", "true"},
181+
counts = {IRNode.ADD_REDUCTION_V, ">0"})
182+
@IR(applyIfPlatform = {"riscv64", "true"},
183+
applyIfCPUFeature = {"rvv", "true"},
184+
applyIf = {"MaxVectorSize", ">=32" },
181185
counts = {IRNode.ADD_REDUCTION_V, ">0"})
182186
public long reductionWithNonReductionDifferentSizes() {
183187
long res = 0L;

0 commit comments

Comments
 (0)