From f6d4c423a222f02bfa84a49c3d306d7341ec9bab Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Thu, 26 Sep 2019 19:58:01 +0100 Subject: target/ppc: remove unnecessary if() around calls to set_dfp{64,128}() in DFP macros Now that the parameters to both set_dfp64() and set_dfp128() are exactly the same, there is no need for an explicit if() statement to determine which function should be called based upon size. Instead we can simply use the preprocessor to generate the call to set_dfp##size() directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Richard Henderson Message-Id: <20190926185801.11176-8-mark.cave-ayland@ilande.co.uk> Signed-off-by: David Gibson --- target/ppc/dfp_helper.c | 60 +++++++++---------------------------------------- 1 file changed, 10 insertions(+), 50 deletions(-) (limited to 'target') diff --git a/target/ppc/dfp_helper.c b/target/ppc/dfp_helper.c index c2bb458a78..2c65badae4 100644 --- a/target/ppc/dfp_helper.c +++ b/target/ppc/dfp_helper.c @@ -427,11 +427,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a, \ dnop(&dfp.t, &dfp.a, &dfp.b, &dfp.context); \ dfp_finalize_decimal##size(&dfp); \ postprocs(&dfp); \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } static void ADD_PPs(struct PPC_DFP *dfp) @@ -747,11 +743,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b, \ dfp_finalize_decimal##size(&dfp); \ QUA_PPs(&dfp); \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_QUAI(dquai, 64) @@ -769,11 +761,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a, \ dfp_finalize_decimal##size(&dfp); \ QUA_PPs(&dfp); \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_QUA(dqua, 64) @@ -851,11 +839,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a, \ dfp_finalize_decimal##size(&dfp); \ QUA_PPs(&dfp); \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_RRND(drrnd, 64) @@ -874,11 +858,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b, \ dfp_finalize_decimal##size(&dfp); \ postprocs(&dfp); \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } static void RINTX_PPs(struct PPC_DFP *dfp) @@ -978,11 +958,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b) \ dfp_finalize_decimal##size(&dfp); \ CFFIX_PPs(&dfp); \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } static void CFFIX_PPs(struct PPC_DFP *dfp) @@ -1088,11 +1064,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b, \ dfp_set_sign_##size(&dfp.vt, sgn); \ } \ \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_DEDPD(ddedpd, 64) @@ -1160,11 +1132,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *b, \ } \ dfp_finalize_decimal##size(&dfp); \ dfp_set_FPRF_from_FRT(&dfp); \ - if ((size) == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if ((size) == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_ENBCD(denbcd, 64) @@ -1264,11 +1232,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a, \ dfp.t.exponent = exp - bias; \ dfp_finalize_decimal##size(&dfp); \ } \ - if (size == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else if (size == 128) { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_IEX(diex, 64) @@ -1356,11 +1320,7 @@ void helper_##op(CPUPPCState *env, ppc_fprp_t *t, ppc_fprp_t *a, \ } \ } \ \ - if ((size) == 64) { \ - set_dfp64(t, &dfp.vt); \ - } else { \ - set_dfp128(t, &dfp.vt); \ - } \ + set_dfp##size(t, &dfp.vt); \ } DFP_HELPER_SHIFT(dscli, 64, 1) -- cgit v1.2.3