qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] target/ppc: Use tcg_constant_tl() in gen_op_cmp()


From: David Gibson
Subject: Re: [PATCH 3/4] target/ppc: Use tcg_constant_tl() in gen_op_cmp()
Date: Mon, 25 Oct 2021 11:21:06 +1100

On Sun, Oct 24, 2021 at 06:16:18PM +0200, Philippe Mathieu-Daudé wrote:
> Avoid using a TCG temporary by moving the compared values
> to the constant pool.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/translate.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index 518337bcb7f..507f6699f47 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -1430,23 +1430,20 @@ static opc_handler_t invalid_handler = {
>  static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf)
>  {
>      TCGv t0 = tcg_temp_new();
> -    TCGv t1 = tcg_temp_new();
>      TCGv_i32 t = tcg_temp_new_i32();
>  
> -    tcg_gen_movi_tl(t0, CRF_EQ);
> -    tcg_gen_movi_tl(t1, CRF_LT);
>      tcg_gen_movcond_tl((s ? TCG_COND_LT : TCG_COND_LTU),
> -                       t0, arg0, arg1, t1, t0);
> -    tcg_gen_movi_tl(t1, CRF_GT);
> +                       t0, arg0, arg1,
> +                       tcg_constant_tl(CRF_LT), tcg_constant_tl(CRF_EQ));
>      tcg_gen_movcond_tl((s ? TCG_COND_GT : TCG_COND_GTU),
> -                       t0, arg0, arg1, t1, t0);
> +                       t0, arg0, arg1,
> +                       tcg_constant_tl(CRF_GT), t0);
>  
>      tcg_gen_trunc_tl_i32(t, t0);
>      tcg_gen_trunc_tl_i32(cpu_crf[crf], cpu_so);
>      tcg_gen_or_i32(cpu_crf[crf], cpu_crf[crf], t);
>  
>      tcg_temp_free(t0);
> -    tcg_temp_free(t1);
>      tcg_temp_free_i32(t);
>  }
>  

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]