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.hender...@linaro.org> --- target/arm/tcg/vec_helper.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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) \ -- 2.43.0