diff options
author | Taylor Simpson <tsimpson@quicinc.com> | 2023-03-06 18:58:25 -0800 |
---|---|---|
committer | Taylor Simpson <tsimpson@quicinc.com> | 2023-03-06 20:47:12 -0800 |
commit | 1a442c09310de23d7cab4c5efedba607c2672d44 (patch) | |
tree | 8f1af14ee17dc6dd500528d978844752ee494b34 /target/hexagon | |
parent | 1c629814f708e58aac6fa6da0d3725df5c831c4c (diff) |
Hexagon (target/hexagon) Change subtract from zero to change sign
The F2_sffms instruction [r0 -= sfmpy(r1, r2)] doesn't properly
handle -0. Previously we would negate the input operand by subtracting
from zero. Instead, we negate by changing the sign bit.
Test case added to tests/tcg/hexagon/fpstuff.c
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20230307025828.1612809-12-tsimpson@quicinc.com>
Diffstat (limited to 'target/hexagon')
-rw-r--r-- | target/hexagon/op_helper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 38b8aee193..9425941c69 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1169,7 +1169,7 @@ float32 HELPER(sffms)(CPUHexagonState *env, float32 RxV, { float32 neg_RsV; arch_fpop_start(env); - neg_RsV = float32_sub(float32_zero, RsV, &env->fp_status); + neg_RsV = float32_set_sign(RsV, float32_is_neg(RsV) ? 0 : 1); RxV = internal_fmafx(neg_RsV, RtV, RxV, 0, &env->fp_status); arch_fpop_end(env); return RxV; |