target/arm: Handle FPCR.AH in SVE FABD
Make the SVE FABD insn honour the FPCR.AH "don't negate the sign of a NaN" semantics. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
4de25ed588
commit
60dd580660
@ -1183,6 +1183,13 @@ DEF_HELPER_FLAGS_6(sve_fabd_s, TCG_CALL_NO_RWG,
|
||||
DEF_HELPER_FLAGS_6(sve_fabd_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_ah_fabd_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_ah_fabd_s, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_ah_fabd_d, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
|
||||
DEF_HELPER_FLAGS_6(sve_fscalbn_h, TCG_CALL_NO_RWG,
|
||||
void, ptr, ptr, ptr, ptr, fpst, i32)
|
||||
DEF_HELPER_FLAGS_6(sve_fscalbn_s, TCG_CALL_NO_RWG,
|
||||
|
@ -4394,9 +4394,31 @@ static inline float64 abd_d(float64 a, float64 b, float_status *s)
|
||||
return float64_abs(float64_sub(a, b, s));
|
||||
}
|
||||
|
||||
/* ABD when FPCR.AH = 1: avoid flipping sign bit of a NaN result */
|
||||
static float16 ah_abd_h(float16 op1, float16 op2, float_status *stat)
|
||||
{
|
||||
float16 r = float16_sub(op1, op2, stat);
|
||||
return float16_is_any_nan(r) ? r : float16_abs(r);
|
||||
}
|
||||
|
||||
static float32 ah_abd_s(float32 op1, float32 op2, float_status *stat)
|
||||
{
|
||||
float32 r = float32_sub(op1, op2, stat);
|
||||
return float32_is_any_nan(r) ? r : float32_abs(r);
|
||||
}
|
||||
|
||||
static float64 ah_abd_d(float64 op1, float64 op2, float_status *stat)
|
||||
{
|
||||
float64 r = float64_sub(op1, op2, stat);
|
||||
return float64_is_any_nan(r) ? r : float64_abs(r);
|
||||
}
|
||||
|
||||
DO_ZPZZ_FP(sve_fabd_h, uint16_t, H1_2, abd_h)
|
||||
DO_ZPZZ_FP(sve_fabd_s, uint32_t, H1_4, abd_s)
|
||||
DO_ZPZZ_FP(sve_fabd_d, uint64_t, H1_8, abd_d)
|
||||
DO_ZPZZ_FP(sve_ah_fabd_h, uint16_t, H1_2, ah_abd_h)
|
||||
DO_ZPZZ_FP(sve_ah_fabd_s, uint32_t, H1_4, ah_abd_s)
|
||||
DO_ZPZZ_FP(sve_ah_fabd_d, uint64_t, H1_8, ah_abd_d)
|
||||
|
||||
static inline float64 scalbn_d(float64 a, int64_t b, float_status *s)
|
||||
{
|
||||
|
@ -3789,7 +3789,7 @@ DO_ZPZZ_AH_FP(FMIN_zpzz, aa64_sve, sve_fmin, sve_ah_fmin)
|
||||
DO_ZPZZ_AH_FP(FMAX_zpzz, aa64_sve, sve_fmax, sve_ah_fmax)
|
||||
DO_ZPZZ_FP(FMINNM_zpzz, aa64_sve, sve_fminnum)
|
||||
DO_ZPZZ_FP(FMAXNM_zpzz, aa64_sve, sve_fmaxnum)
|
||||
DO_ZPZZ_FP(FABD, aa64_sve, sve_fabd)
|
||||
DO_ZPZZ_AH_FP(FABD, aa64_sve, sve_fabd, sve_ah_fabd)
|
||||
DO_ZPZZ_FP(FSCALE, aa64_sve, sve_fscalbn)
|
||||
DO_ZPZZ_FP(FDIV, aa64_sve, sve_fdiv)
|
||||
DO_ZPZZ_FP(FMULX, aa64_sve, sve_fmulx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user