|
1 | 1 | /* |
2 | 2 | * Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | + * Copyright (c) 2025, Rivos Inc. All rights reserved. |
3 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 5 | * |
5 | 6 | * 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) { |
87 | 88 | @Test |
88 | 89 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
89 | 90 | applyIfCPUFeature = {"asimd", "true"}) |
| 91 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 92 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
90 | 93 | static float test1(float a, float b, float c) { |
91 | 94 | return Math.fma(-a, -b, c); |
92 | 95 | } |
93 | 96 |
|
94 | 97 | @Test |
95 | 98 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
96 | 99 | applyIfCPUFeature = {"asimd", "true"}) |
| 100 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 101 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
97 | 102 | static double test2(double a, double b, double c) { |
98 | 103 | return Math.fma(-a, -b, c); |
99 | 104 | } |
100 | 105 |
|
101 | 106 | @Test |
102 | 107 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
103 | 108 | applyIfCPUFeature = {"asimd", "true"}) |
| 109 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 110 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
104 | 111 | static float test3(float a, float b, float c) { |
105 | 112 | return Math.fma(-a, b, c); |
106 | 113 | } |
107 | 114 |
|
108 | 115 | @Test |
109 | 116 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
110 | 117 | applyIfCPUFeature = {"asimd", "true"}) |
| 118 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 119 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
111 | 120 | static double test4(double a, double b, double c) { |
112 | 121 | return Math.fma(-a, b, c); |
113 | 122 | } |
114 | 123 |
|
115 | 124 | @Test |
116 | 125 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
117 | 126 | applyIfCPUFeature = {"asimd", "true"}) |
| 127 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 128 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
118 | 129 | static float test5(float a, float b, float c) { |
119 | 130 | return Math.fma(a, -b, c); |
120 | 131 | } |
121 | 132 |
|
122 | 133 | @Test |
123 | 134 | @IR(counts = {IRNode.FMSUB, "> 0"}, |
124 | 135 | applyIfCPUFeature = {"asimd", "true"}) |
| 136 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 137 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
125 | 138 | static double test6(double a, double b, double c) { |
126 | 139 | return Math.fma(a, -b, c); |
127 | 140 | } |
128 | 141 |
|
129 | 142 | @Test |
130 | 143 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
131 | 144 | applyIfCPUFeature = {"asimd", "true"}) |
| 145 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 146 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
132 | 147 | static float test7(float a, float b, float c) { |
133 | 148 | return Math.fma(-a, b, -c); |
134 | 149 | } |
135 | 150 |
|
136 | 151 | @Test |
137 | 152 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
138 | 153 | applyIfCPUFeature = {"asimd", "true"}) |
| 154 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 155 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
139 | 156 | static double test8(double a, double b, double c) { |
140 | 157 | return Math.fma(-a, b, -c); |
141 | 158 | } |
142 | 159 |
|
143 | 160 | @Test |
144 | 161 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
145 | 162 | applyIfCPUFeature = {"asimd", "true"}) |
| 163 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 164 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
146 | 165 | static float test9(float a, float b, float c) { |
147 | 166 | return Math.fma(a, -b, -c); |
148 | 167 | } |
149 | 168 |
|
150 | 169 | @Test |
151 | 170 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
152 | 171 | applyIfCPUFeature = {"asimd", "true"}) |
| 172 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 173 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
153 | 174 | static double test10(double a, double b, double c) { |
154 | 175 | return Math.fma(a, -b, -c); |
155 | 176 | } |
156 | 177 |
|
157 | 178 | @Test |
158 | 179 | @IR(counts = {IRNode.FNMSUB, "> 0"}, |
159 | 180 | applyIfCPUFeature = {"asimd", "true"}) |
| 181 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 182 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
160 | 183 | static float test11(float a, float b, float c) { |
161 | 184 | return Math.fma(a, b, -c); |
162 | 185 | } |
163 | 186 |
|
164 | 187 | @Test |
165 | 188 | @IR(counts = {IRNode.FNMSUB, "> 0"}, |
166 | 189 | applyIfCPUFeature = {"asimd", "true"}) |
| 190 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 191 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
167 | 192 | static double test12(double a, double b, double c) { |
168 | 193 | return Math.fma(a, b, -c); |
169 | 194 | } |
170 | 195 |
|
171 | 196 | @Test |
172 | 197 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
173 | 198 | applyIfCPUFeature = {"asimd", "true"}) |
| 199 | + @IR(counts = {IRNode.FMA_F, "= 1"}, |
| 200 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
174 | 201 | static float test13(float a, float b, float c) { |
175 | 202 | return Math.fma(-a, -b, -c); |
176 | 203 | } |
177 | 204 |
|
178 | 205 | @Test |
179 | 206 | @IR(counts = {IRNode.FNMADD, "> 0"}, |
180 | 207 | applyIfCPUFeature = {"asimd", "true"}) |
| 208 | + @IR(counts = {IRNode.FMA_D, "= 1"}, |
| 209 | + applyIfPlatform = {"riscv64", "true"}, applyIf = {"UseFMA", "true"}) |
181 | 210 | static double test14(double a, double b, double c) { |
182 | 211 | return Math.fma(-a, -b, -c); |
183 | 212 | } |
|
0 commit comments