From dbf47d6c6c9573a143e0158a0664dd3bbab8e251 Mon Sep 17 00:00:00 2001 From: Hamlin Li Date: Mon, 17 Mar 2025 11:47:18 +0000 Subject: [PATCH] 8351876: RISC-V: enable and fix some float round tests Reviewed-by: fyang --- .../compiler/vectorization/TestRoundVectFloat.java | 12 +++++++++--- .../compiler/vectorization/TestRoundVectRiscv64.java | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectFloat.java b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectFloat.java index 7cf4ae17cb4..65f12be111a 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectFloat.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectFloat.java @@ -26,8 +26,8 @@ * @bug 8279508 * @summary Auto-vectorize Math.round API * @requires vm.compiler2.enabled - * @requires vm.cpu.features ~= ".*avx.*" - * @requires os.simpleArch == "x64" + * @requires (os.simpleArch == "x64" & vm.cpu.features ~= ".*avx.*") | + * (os.simpleArch == "riscv64" & vm.cpu.features ~= ".*rvv.*") * @library /test/lib / * @run driver compiler.vectorization.TestRoundVectFloat */ @@ -49,7 +49,13 @@ public class TestRoundVectFloat { } @Test - @IR(applyIf = {"UseAVX", " > 1"}, counts = {IRNode.ROUND_VF , " > 0 "}) + @IR(applyIfPlatform = {"x64", "true"}, + applyIf = {"UseAVX", " > 1"}, + counts = {IRNode.ROUND_VF , " > 0 "}) + @IR(applyIfPlatform = {"riscv64", "true"}, + applyIfCPUFeature = {"rvv", "true"}, + applyIf = {"MaxVectorSize", ">= 32"}, + counts = {IRNode.ROUND_VF , " > 0 "}) public void test_round_float(int[] iout, float[] finp) { for (int i = 0; i < finp.length; i+=1) { iout[i] = Math.round(finp[i]); diff --git a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectRiscv64.java b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectRiscv64.java index 530befbe2bc..252f1f1c166 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestRoundVectRiscv64.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestRoundVectRiscv64.java @@ -53,7 +53,8 @@ public class TestRoundVectRiscv64 { } @Test - @IR(counts = {IRNode.ROUND_VD, "> 0"}) + @IR(counts = {IRNode.ROUND_VD, "> 0"}, + applyIf = {"MaxVectorSize", ">= 64"}) public void test_round_double(long[] lout, double[] dinp) { for (int i = 0; i < lout.length; i+=1) { lout[i] = Math.round(dinp[i]); @@ -73,7 +74,8 @@ public class TestRoundVectRiscv64 { } @Test - @IR(counts = {IRNode.ROUND_VF, "> 0"}) + @IR(counts = {IRNode.ROUND_VF, "> 0"}, + applyIf = {"MaxVectorSize", ">= 32"}) public void test_round_float(int[] iout, float[] finp) { for (int i = 0; i < finp.length; i+=1) { iout[i] = Math.round(finp[i]);