diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index e96ea480da4..f6fb2e195d3 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -1916,9 +1916,10 @@ bool Matcher::match_rule_supported(int opcode) { case Op_FmaF: case Op_FmaD: + return UseFMA; case Op_FmaVF: case Op_FmaVD: - return UseFMA; + return UseRVV && UseFMA; case Op_ConvHF2F: case Op_ConvF2HF: diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java index a6d738b3a09..6782bd68fed 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/TestFramework.java @@ -142,6 +142,7 @@ public class TestFramework { "Xlog", "LogCompilation", "UseCompactObjectHeaders", + "UseFMA", // Riscv "UseRVV", "UseZbb", diff --git a/test/hotspot/jtreg/compiler/vectorization/runner/BasicFloatOpTest.java b/test/hotspot/jtreg/compiler/vectorization/runner/BasicFloatOpTest.java index d1d7b981712..b89d068d8af 100644 --- a/test/hotspot/jtreg/compiler/vectorization/runner/BasicFloatOpTest.java +++ b/test/hotspot/jtreg/compiler/vectorization/runner/BasicFloatOpTest.java @@ -35,7 +35,7 @@ * -XX:+WhiteBoxAPI * compiler.vectorization.runner.BasicFloatOpTest * - * @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") + * @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64") | (os.simpleArch == "riscv64") * @requires vm.compiler2.enabled */ @@ -229,7 +229,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.FMA_VF, ">0", IRNode.VFMLA, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorMulAdd() { float[] res = new float[SIZE]; @@ -244,7 +244,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.FMA_VF, ">0", IRNode.VFMLS, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorMulSub1() { float[] res = new float[SIZE]; @@ -259,7 +259,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.FMA_VF, ">0", IRNode.VFMLS, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorMulSub2() { float[] res = new float[SIZE]; @@ -276,7 +276,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.VFNMLA, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorNegateMulAdd1() { float[] res = new float[SIZE]; @@ -293,7 +293,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.VFNMLA, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorNegateMulAdd2() { float[] res = new float[SIZE]; @@ -308,7 +308,7 @@ public class BasicFloatOpTest extends VectorizationTestRunner { counts = {IRNode.FMA_VF, ">0"}) @IR(applyIfCPUFeatureAnd = {"fma", "true", "avx", "true"}, counts = {IRNode.FMA_VF, ">0"}) - @IR(applyIfCPUFeature = {"rvv", "true"}, + @IR(applyIfCPUFeature = {"rvv", "true"}, applyIf = {"UseFMA", "true"}, counts = {IRNode.FMA_VF, ">0"}) public float[] vectorNegateMulSub() { float[] res = new float[SIZE];