diff mbox series

[v2,24/34] target/arm: Use flags for AH negation in float*_ah_mulsub_f

Message ID 20250129013857.135256-25-richard.henderson@linaro.org
State New
Headers show
Series target/arm: FEAT_AFP followups for FEAT_SME2 | expand

Commit Message

Richard Henderson Jan. 29, 2025, 1:38 a.m. UTC
The float_muladd_negate_product flag produces the same result
as negating either of the multiplication operands, assuming
neither of the operands are NaNs.  But since FEAT_AFP does not
negate NaNs, this behaviour is exactly what we need.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/tcg/vec_helper.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
index 55bac9536f..5c1e84bf27 100644
--- a/target/arm/tcg/vec_helper.c
+++ b/target/arm/tcg/vec_helper.c
@@ -1563,22 +1563,19 @@  static float64 float64_mulsub_f(float64 dest, float64 op1, float64 op2,
 static float16 float16_ah_mulsub_f(float16 dest, float16 op1, float16 op2,
                                  float_status *stat)
 {
-    op1 = float16_is_any_nan(op1) ? op1 : float16_chs(op1);
-    return float16_muladd(op1, op2, dest, 0, stat);
+    return float16_muladd(op1, op2, dest, float_muladd_negate_product, stat);
 }
 
 static float32 float32_ah_mulsub_f(float32 dest, float32 op1, float32 op2,
                                  float_status *stat)
 {
-    op1 = float32_is_any_nan(op1) ? op1 : float32_chs(op1);
-    return float32_muladd(op1, op2, dest, 0, stat);
+    return float32_muladd(op1, op2, dest, float_muladd_negate_product, stat);
 }
 
 static float64 float64_ah_mulsub_f(float64 dest, float64 op1, float64 op2,
                                  float_status *stat)
 {
-    op1 = float64_is_any_nan(op1) ? op1 : float64_chs(op1);
-    return float64_muladd(op1, op2, dest, 0, stat);
+    return float64_muladd(op1, op2, dest, float_muladd_negate_product, stat);
 }
 
 #define DO_MULADD(NAME, FUNC, TYPE)                                        \