mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 19:14:58 -06:00
target/ppc: Merge fsqrt and fsqrts helpers
These two helpers are almost identical, differing only by the softfloat operation it calls. Merge them into one using a macro. Also, take this opportunity to capitalize the helper name as we moved the instruction to decodetree in a previous patch. Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220905123746.54659-4-victor.colombo@eldorado.org.br> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
4896c15bc3
commit
74177ec661
3 changed files with 17 additions and 26 deletions
|
@ -830,30 +830,21 @@ static void float_invalid_op_sqrt(CPUPPCState *env, int flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fsqrt - fsqrt. */
|
#define FPU_FSQRT(name, op) \
|
||||||
float64 helper_fsqrt(CPUPPCState *env, float64 arg)
|
float64 helper_##name(CPUPPCState *env, float64 arg) \
|
||||||
{
|
{ \
|
||||||
float64 ret = float64_sqrt(arg, &env->fp_status);
|
float64 ret = op(arg, &env->fp_status); \
|
||||||
int flags = get_float_exception_flags(&env->fp_status);
|
int flags = get_float_exception_flags(&env->fp_status); \
|
||||||
|
\
|
||||||
if (unlikely(flags & float_flag_invalid)) {
|
if (unlikely(flags & float_flag_invalid)) { \
|
||||||
float_invalid_op_sqrt(env, flags, 1, GETPC());
|
float_invalid_op_sqrt(env, flags, 1, GETPC()); \
|
||||||
}
|
} \
|
||||||
|
\
|
||||||
return ret;
|
return ret; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fsqrts - fsqrts. */
|
FPU_FSQRT(FSQRT, float64_sqrt)
|
||||||
float64 helper_fsqrts(CPUPPCState *env, float64 arg)
|
FPU_FSQRT(FSQRTS, float64r32_sqrt)
|
||||||
{
|
|
||||||
float64 ret = float64r32_sqrt(arg, &env->fp_status);
|
|
||||||
int flags = get_float_exception_flags(&env->fp_status);
|
|
||||||
|
|
||||||
if (unlikely(flags & float_flag_invalid)) {
|
|
||||||
float_invalid_op_sqrt(env, flags, 1, GETPC());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fre - fre. */
|
/* fre - fre. */
|
||||||
float64 helper_fre(CPUPPCState *env, float64 arg)
|
float64 helper_fre(CPUPPCState *env, float64 arg)
|
||||||
|
|
|
@ -120,8 +120,8 @@ DEF_HELPER_4(fmadds, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(fmsubs, i64, env, i64, i64, i64)
|
DEF_HELPER_4(fmsubs, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(fnmadds, i64, env, i64, i64, i64)
|
DEF_HELPER_4(fnmadds, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_4(fnmsubs, i64, env, i64, i64, i64)
|
DEF_HELPER_4(fnmsubs, i64, env, i64, i64, i64)
|
||||||
DEF_HELPER_2(fsqrt, f64, env, f64)
|
DEF_HELPER_2(FSQRT, f64, env, f64)
|
||||||
DEF_HELPER_2(fsqrts, f64, env, f64)
|
DEF_HELPER_2(FSQRTS, f64, env, f64)
|
||||||
DEF_HELPER_2(fre, i64, env, i64)
|
DEF_HELPER_2(fre, i64, env, i64)
|
||||||
DEF_HELPER_2(fres, i64, env, i64)
|
DEF_HELPER_2(fres, i64, env, i64)
|
||||||
DEF_HELPER_2(frsqrte, i64, env, i64)
|
DEF_HELPER_2(frsqrte, i64, env, i64)
|
||||||
|
|
|
@ -280,8 +280,8 @@ static bool do_helper_fsqrt(DisasContext *ctx, arg_A_tb *a,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRANS(FSQRT, do_helper_fsqrt, gen_helper_fsqrt);
|
TRANS(FSQRT, do_helper_fsqrt, gen_helper_FSQRT);
|
||||||
TRANS(FSQRTS, do_helper_fsqrt, gen_helper_fsqrts);
|
TRANS(FSQRTS, do_helper_fsqrt, gen_helper_FSQRTS);
|
||||||
|
|
||||||
/*** Floating-Point multiply-and-add ***/
|
/*** Floating-Point multiply-and-add ***/
|
||||||
/* fmadd - fmadds */
|
/* fmadd - fmadds */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue