Skip to content

Commit 50554fa

Browse files
author
Hamlin Li
committed
8355704: RISC-V: enable TestIRFma.java
Reviewed-by: rehn, luhenry
1 parent 1a4bbb0 commit 50554fa

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2023, Arm Limited. All rights reserved.
3+
* Copyright (c) 2025, Rivos Inc. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -87,97 +88,125 @@ public void assertResult(double a, double b, double c) {
8788
@Test
8889
@IR(counts = {IRNode.FMSUB, "> 0"},
8990
applyIfCPUFeature = {"asimd", "true"})
91+
@IR(counts = {IRNode.FMA_F, "= 1"},
92+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
9093
static float test1(float a, float b, float c) {
9194
return Math.fma(-a, -b, c);
9295
}
9396

9497
@Test
9598
@IR(counts = {IRNode.FMSUB, "> 0"},
9699
applyIfCPUFeature = {"asimd", "true"})
100+
@IR(counts = {IRNode.FMA_D, "= 1"},
101+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
97102
static double test2(double a, double b, double c) {
98103
return Math.fma(-a, -b, c);
99104
}
100105

101106
@Test
102107
@IR(counts = {IRNode.FMSUB, "> 0"},
103108
applyIfCPUFeature = {"asimd", "true"})
109+
@IR(counts = {IRNode.FMA_F, "= 1"},
110+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
104111
static float test3(float a, float b, float c) {
105112
return Math.fma(-a, b, c);
106113
}
107114

108115
@Test
109116
@IR(counts = {IRNode.FMSUB, "> 0"},
110117
applyIfCPUFeature = {"asimd", "true"})
118+
@IR(counts = {IRNode.FMA_D, "= 1"},
119+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
111120
static double test4(double a, double b, double c) {
112121
return Math.fma(-a, b, c);
113122
}
114123

115124
@Test
116125
@IR(counts = {IRNode.FMSUB, "> 0"},
117126
applyIfCPUFeature = {"asimd", "true"})
127+
@IR(counts = {IRNode.FMA_F, "= 1"},
128+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
118129
static float test5(float a, float b, float c) {
119130
return Math.fma(a, -b, c);
120131
}
121132

122133
@Test
123134
@IR(counts = {IRNode.FMSUB, "> 0"},
124135
applyIfCPUFeature = {"asimd", "true"})
136+
@IR(counts = {IRNode.FMA_D, "= 1"},
137+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
125138
static double test6(double a, double b, double c) {
126139
return Math.fma(a, -b, c);
127140
}
128141

129142
@Test
130143
@IR(counts = {IRNode.FNMADD, "> 0"},
131144
applyIfCPUFeature = {"asimd", "true"})
145+
@IR(counts = {IRNode.FMA_F, "= 1"},
146+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
132147
static float test7(float a, float b, float c) {
133148
return Math.fma(-a, b, -c);
134149
}
135150

136151
@Test
137152
@IR(counts = {IRNode.FNMADD, "> 0"},
138153
applyIfCPUFeature = {"asimd", "true"})
154+
@IR(counts = {IRNode.FMA_D, "= 1"},
155+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
139156
static double test8(double a, double b, double c) {
140157
return Math.fma(-a, b, -c);
141158
}
142159

143160
@Test
144161
@IR(counts = {IRNode.FNMADD, "> 0"},
145162
applyIfCPUFeature = {"asimd", "true"})
163+
@IR(counts = {IRNode.FMA_F, "= 1"},
164+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
146165
static float test9(float a, float b, float c) {
147166
return Math.fma(a, -b, -c);
148167
}
149168

150169
@Test
151170
@IR(counts = {IRNode.FNMADD, "> 0"},
152171
applyIfCPUFeature = {"asimd", "true"})
172+
@IR(counts = {IRNode.FMA_D, "= 1"},
173+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
153174
static double test10(double a, double b, double c) {
154175
return Math.fma(a, -b, -c);
155176
}
156177

157178
@Test
158179
@IR(counts = {IRNode.FNMSUB, "> 0"},
159180
applyIfCPUFeature = {"asimd", "true"})
181+
@IR(counts = {IRNode.FMA_F, "= 1"},
182+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
160183
static float test11(float a, float b, float c) {
161184
return Math.fma(a, b, -c);
162185
}
163186

164187
@Test
165188
@IR(counts = {IRNode.FNMSUB, "> 0"},
166189
applyIfCPUFeature = {"asimd", "true"})
190+
@IR(counts = {IRNode.FMA_D, "= 1"},
191+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
167192
static double test12(double a, double b, double c) {
168193
return Math.fma(a, b, -c);
169194
}
170195

171196
@Test
172197
@IR(counts = {IRNode.FNMADD, "> 0"},
173198
applyIfCPUFeature = {"asimd", "true"})
199+
@IR(counts = {IRNode.FMA_F, "= 1"},
200+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
174201
static float test13(float a, float b, float c) {
175202
return Math.fma(-a, -b, -c);
176203
}
177204

178205
@Test
179206
@IR(counts = {IRNode.FNMADD, "> 0"},
180207
applyIfCPUFeature = {"asimd", "true"})
208+
@IR(counts = {IRNode.FMA_D, "= 1"},
209+
applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"})
181210
static double test14(double a, double b, double c) {
182211
return Math.fma(-a, -b, -c);
183212
}

test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,16 @@ public class IRNode {
25112511
machOnlyNameRegex(FNMSUB, "mnsub(F|D)_reg_reg");
25122512
}
25132513

2514+
public static final String FMA_F = PREFIX + "FMA_F" + POSTFIX;
2515+
static {
2516+
beforeMatchingNameRegex(FMA_F, "FmaF");
2517+
}
2518+
2519+
public static final String FMA_D = PREFIX + "FMA_D" + POSTFIX;
2520+
static {
2521+
beforeMatchingNameRegex(FMA_D, "FmaD");
2522+
}
2523+
25142524
public static final String VFMLA = PREFIX + "VFMLA" + POSTFIX;
25152525
static {
25162526
machOnlyNameRegex(VFMLA, "vfmla");

0 commit comments

Comments
 (0)