[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 01/33] target/alpha: Use array for FPCR_DYN conversion
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v3 01/33] target/alpha: Use array for FPCR_DYN conversion |
Date: |
Thu, 26 Sep 2019 00:35:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 9/24/19 11:00 PM, Alex Bennée wrote:
> From: Richard Henderson <address@hidden>
>
> This is a bit more straight-forward than using a switch statement.
> No functional change.
>
> Signed-off-by: Richard Henderson <address@hidden>
> Signed-off-by: Alex Bennée <address@hidden>
> Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> target/alpha/helper.c | 24 ++++++++----------------
> 1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/target/alpha/helper.c b/target/alpha/helper.c
> index 19cda0a2db5..6c1703682e0 100644
> --- a/target/alpha/helper.c
> +++ b/target/alpha/helper.c
> @@ -36,6 +36,13 @@ uint64_t cpu_alpha_load_fpcr(CPUAlphaState *env)
>
> void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val)
> {
> + static const uint8_t rm_map[] = {
> + [FPCR_DYN_NORMAL >> FPCR_DYN_SHIFT] = float_round_nearest_even,
> + [FPCR_DYN_CHOPPED >> FPCR_DYN_SHIFT] = float_round_to_zero,
> + [FPCR_DYN_MINUS >> FPCR_DYN_SHIFT] = float_round_down,
> + [FPCR_DYN_PLUS >> FPCR_DYN_SHIFT] = float_round_up,
> + };
> +
> uint32_t fpcr = val >> 32;
> uint32_t t = 0;
>
> @@ -48,22 +55,7 @@ void cpu_alpha_store_fpcr(CPUAlphaState *env, uint64_t val)
> env->fpcr = fpcr;
> env->fpcr_exc_enable = ~t & FPCR_STATUS_MASK;
>
> - switch (fpcr & FPCR_DYN_MASK) {
> - case FPCR_DYN_NORMAL:
> - default:
> - t = float_round_nearest_even;
> - break;
> - case FPCR_DYN_CHOPPED:
> - t = float_round_to_zero;
> - break;
> - case FPCR_DYN_MINUS:
> - t = float_round_down;
> - break;
> - case FPCR_DYN_PLUS:
> - t = float_round_up;
> - break;
> - }
> - env->fpcr_dyn_round = t;
> + env->fpcr_dyn_round = rm_map[(fpcr & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT];
>
> env->fpcr_flush_to_zero = (fpcr & FPCR_UNFD) && (fpcr & FPCR_UNDZ);
> env->fp_status.flush_inputs_to_zero = (fpcr & FPCR_DNZ) != 0;
>
- [PATCH v3 00/33] testing/next (docker,tcg, alpha ;-), Alex Bennée, 2019/09/24
- [PATCH v3 01/33] target/alpha: Use array for FPCR_DYN conversion, Alex Bennée, 2019/09/24
- Re: [PATCH v3 01/33] target/alpha: Use array for FPCR_DYN conversion,
Philippe Mathieu-Daudé <=
- [PATCH v3 02/33] target/alpha: Fix SWCR_MAP_UMZ, Alex Bennée, 2019/09/24
- [PATCH v3 07/33] target/alpha: Tidy helper_fp_exc_raise_s, Alex Bennée, 2019/09/24
- [PATCH v3 03/33] target/alpha: Fix SWCR_TRAP_ENABLE_MASK, Alex Bennée, 2019/09/24
- [PATCH v3 05/33] target/alpha: Write to fpcr_flush_to_zero once, Alex Bennée, 2019/09/24
- [PATCH v3 11/33] target/ppc: fix signal delivery for ppc64abi32, Alex Bennée, 2019/09/24
- [PATCH v3 21/33] tests/tcg: add simple record/replay smoke test for aarch64, Alex Bennée, 2019/09/24
- [PATCH v3 06/33] target/alpha: Mask IOV exception with INV for user-only, Alex Bennée, 2019/09/24