[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 15/60] target/arm: Simplify gen_sar
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 15/60] target/arm: Simplify gen_sar |
Date: |
Thu, 21 Apr 2022 19:57:59 +0100 |
On Sun, 17 Apr 2022 at 18:59, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Use tcg_gen_umin_i32 instead of tcg_gen_movcond_i32.
> Use tcg_constant_i32 while we're at it.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> target/arm/translate.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/target/arm/translate.c b/target/arm/translate.c
> index 57631c9fa1..8d6534f9a5 100644
> --- a/target/arm/translate.c
> +++ b/target/arm/translate.c
> @@ -568,12 +568,10 @@ GEN_SHIFT(shr)
>
> static void gen_sar(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1)
> {
> - TCGv_i32 tmp1, tmp2;
> - tmp1 = tcg_temp_new_i32();
> + TCGv_i32 tmp1 = tcg_temp_new_i32();
> +
> tcg_gen_andi_i32(tmp1, t1, 0xff);
> - tmp2 = tcg_const_i32(0x1f);
> - tcg_gen_movcond_i32(TCG_COND_GTU, tmp1, tmp1, tmp2, tmp2, tmp1);
> - tcg_temp_free_i32(tmp2);
> + tcg_gen_umin_i32(tmp1, tmp1, tcg_constant_i32(31));
> tcg_gen_sar_i32(dest, t0, tmp1);
> tcg_temp_free_i32(tmp1);
> }
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- Re: [PATCH v3 08/60] target/arm: Change DisasContext.thumb to bool, (continued)
[PATCH v3 09/60] target/arm: Change CPUArchState.thumb to bool, Richard Henderson, 2022/04/17
[PATCH v3 19/60] target/arm: Use tcg_constant in translate-neon.c, Richard Henderson, 2022/04/17
[PATCH v3 16/60] target/arm: Simplify aa32 DISAS_WFI, Richard Henderson, 2022/04/17
[PATCH v3 15/60] target/arm: Simplify gen_sar, Richard Henderson, 2022/04/17
- Re: [PATCH v3 15/60] target/arm: Simplify gen_sar,
Peter Maydell <=
[PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field size, Richard Henderson, 2022/04/17
[PATCH v3 11/60] target/arm: Split out set_btype_raw, Richard Henderson, 2022/04/17
[PATCH v3 14/60] target/arm: Simplify GEN_SHIFT in translate.c, Richard Henderson, 2022/04/17
[PATCH v3 10/60] target/arm: Remove fpexc32_access, Richard Henderson, 2022/04/17
[PATCH v3 12/60] target/arm: Split out gen_rebuild_hflags, Richard Henderson, 2022/04/17