From 50554fa1982f042fb1d7b6c8a16334b97b31bb63 Mon Sep 17 00:00:00 2001 From: Hamlin Li Date: Wed, 7 May 2025 08:34:03 +0000 Subject: [PATCH] 8355704: RISC-V: enable TestIRFma.java Reviewed-by: rehn, luhenry --- .../jtreg/compiler/c2/irTests/TestIRFma.java | 29 +++++++++++++++++++ .../compiler/lib/ir_framework/IRNode.java | 10 +++++++ 2 files changed, 39 insertions(+) diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestIRFma.java b/test/hotspot/jtreg/compiler/c2/irTests/TestIRFma.java index 0e2cd067a13..da38a76f947 100644 --- a/test/hotspot/jtreg/compiler/c2/irTests/TestIRFma.java +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestIRFma.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2023, Arm Limited. All rights reserved. + * Copyright (c) 2025, Rivos Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,6 +88,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test1(float a, float b, float c) { return Math.fma(-a, -b, c); } @@ -94,6 +97,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test2(double a, double b, double c) { return Math.fma(-a, -b, c); } @@ -101,6 +106,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test3(float a, float b, float c) { return Math.fma(-a, b, c); } @@ -108,6 +115,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test4(double a, double b, double c) { return Math.fma(-a, b, c); } @@ -115,6 +124,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test5(float a, float b, float c) { return Math.fma(a, -b, c); } @@ -122,6 +133,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test6(double a, double b, double c) { return Math.fma(a, -b, c); } @@ -129,6 +142,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test7(float a, float b, float c) { return Math.fma(-a, b, -c); } @@ -136,6 +151,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test8(double a, double b, double c) { return Math.fma(-a, b, -c); } @@ -143,6 +160,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test9(float a, float b, float c) { return Math.fma(a, -b, -c); } @@ -150,6 +169,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test10(double a, double b, double c) { return Math.fma(a, -b, -c); } @@ -157,6 +178,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test11(float a, float b, float c) { return Math.fma(a, b, -c); } @@ -164,6 +187,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMSUB, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test12(double a, double b, double c) { return Math.fma(a, b, -c); } @@ -171,6 +196,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_F, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static float test13(float a, float b, float c) { return Math.fma(-a, -b, -c); } @@ -178,6 +205,8 @@ public class TestIRFma { @Test @IR(counts = {IRNode.FNMADD, "> 0"}, applyIfCPUFeature = {"asimd", "true"}) + @IR(counts = {IRNode.FMA_D, "= 1"}, + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) static double test14(double a, double b, double c) { return Math.fma(-a, -b, -c); } diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index ebcbd9fbbc7..965b0083c49 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -2511,6 +2511,16 @@ public class IRNode { machOnlyNameRegex(FNMSUB, "mnsub(F|D)_reg_reg"); } + public static final String FMA_F = PREFIX + "FMA_F" + POSTFIX; + static { + beforeMatchingNameRegex(FMA_F, "FmaF"); + } + + public static final String FMA_D = PREFIX + "FMA_D" + POSTFIX; + static { + beforeMatchingNameRegex(FMA_D, "FmaD"); + } + public static final String VFMLA = PREFIX + "VFMLA" + POSTFIX; static { machOnlyNameRegex(VFMLA, "vfmla");