8355704: RISC-V: enable TestIRFma.java

Reviewed-by: rehn, luhenry
This commit is contained in:
Hamlin Li 2025-05-07 08:34:03 +00:00
parent 1a4bbb0027
commit 50554fa198
2 changed files with 39 additions and 0 deletions

View File

@ -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);
}

View File

@ -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");