diff mbox series

[09/17] target/hexagon: Use float32_muladd for helper_sffms

Message ID 20241208224844.570491-10-richard.henderson@linaro.org
State New
Headers show
Series softfloat, hexagon: Cleanup fmaf | expand

Commit Message

Richard Henderson Dec. 8, 2024, 10:48 p.m. UTC
There are no special cases for this instruction.  Since hexagon
always uses default-nan mode, explicitly negating the first
input is unnecessary.  Use float_muladd_negate_product instead.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/hexagon/op_helper.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Brian Cain Dec. 10, 2024, 1:48 a.m. UTC | #1
On 12/8/2024 4:48 PM, Richard Henderson wrote:
> There are no special cases for this instruction.  Since hexagon
> always uses default-nan mode, explicitly negating the first
> input is unnecessary.  Use float_muladd_negate_product instead.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/hexagon/op_helper.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
> index 7d459cc6f3..aa5ab4a31f 100644
> --- a/target/hexagon/op_helper.c
> +++ b/target/hexagon/op_helper.c
> @@ -1208,10 +1208,9 @@ float32 HELPER(sffma_sc)(CPUHexagonState *env, float32 RxV,
>   float32 HELPER(sffms)(CPUHexagonState *env, float32 RxV,
>                         float32 RsV, float32 RtV)
>   {
> -    float32 neg_RsV;
>       arch_fpop_start(env);
> -    neg_RsV = float32_set_sign(RsV, float32_is_neg(RsV) ? 0 : 1);
> -    RxV = internal_fmafx(neg_RsV, RtV, RxV, 0, &env->fp_status);
> +    RxV = float32_muladd(RsV, RtV, RxV, float_muladd_negate_product,
> +                         &env->fp_status);
>       arch_fpop_end(env);
>       return RxV;
>   }

Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
diff mbox series

Patch

diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c
index 7d459cc6f3..aa5ab4a31f 100644
--- a/target/hexagon/op_helper.c
+++ b/target/hexagon/op_helper.c
@@ -1208,10 +1208,9 @@  float32 HELPER(sffma_sc)(CPUHexagonState *env, float32 RxV,
 float32 HELPER(sffms)(CPUHexagonState *env, float32 RxV,
                       float32 RsV, float32 RtV)
 {
-    float32 neg_RsV;
     arch_fpop_start(env);
-    neg_RsV = float32_set_sign(RsV, float32_is_neg(RsV) ? 0 : 1);
-    RxV = internal_fmafx(neg_RsV, RtV, RxV, 0, &env->fp_status);
+    RxV = float32_muladd(RsV, RtV, RxV, float_muladd_negate_product,
+                         &env->fp_status);
     arch_fpop_end(env);
     return RxV;
 }