qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V3 09/12] Add helper functions for MIPS DSP Comp


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH V3 09/12] Add helper functions for MIPS DSP Compare-Pick instructions
Date: Tue, 27 Mar 2012 10:42:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120316 Thunderbird/11.0

On 03/27/12 02:24, Jia Liu wrote:
> +    uint32_t cc3 = 0, cc2 = 0, cc1 = 0, cc0 = 0;
> +    uint32_t flag;
...
> +    if (rs3 == rt3)
> +        cc3 = 1;

Clearer as "cc3 = (rs3 == rt3);", etc.

I begin to wonder if it wouldn't be better to model the DSPControl
word as individual variables of their respective fields.  That way
you don't need to involve ENV so much.

E.g.

  Assume cpu_dspcc is a TCGv_i32 variable containing 4 bits.

  case CMPGU_COND_QB:
      gen_helper_cmpdu_cond_qb(cpu_gr[rd], cpu_gr[rs], cpu_gr[rt]);
      break;
  case CMPGDU_COND_QB:
      gen_helper_cmpdu_cond_qb(cpu_dspcc, cpu_gr[rs], cpu_gr[rt]);
      tcg_gen_mov(cpu_gr[rd], cpu_dspcc);
      break;

No need for two separate helpers.  Even if you don't decide to split
the field, you probably don't want to duplicate so much code in the
helpers file.


r~



reply via email to

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