qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Leon Alrae <leon.alrae@imgtec.com>, qemu-devel@nongnu.org
Cc: aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH v2 1/2] target-mips: Use movcond in movci and movcf*
Date: Fri, 4 Sep 2015 07:32:10 -0700	[thread overview]
Message-ID: <55E9AB6A.2050808@twiddle.net> (raw)
In-Reply-To: <55E87CDD.8000307@imgtec.com>

On 09/03/2015 10:01 AM, Leon Alrae wrote:
> On 02/09/2015 23:50, Richard Henderson wrote:
>> @@ -8821,102 +8840,126 @@ static void gen_cp1 (DisasContext *ctx, uint32_t opc, int rt, int fs)
>>       tcg_temp_free(t0);
>>   }
>>
>> -static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf)
>> +static void gen_movci(DisasContext *ctx, int rd, int rs, int cc, int tf)
>>   {
>> -    TCGLabel *l1;
>>       TCGCond cond;
>> -    TCGv_i32 t0;
>> +    TCGv t0, ts, zero;
>>
>>       if (rd == 0) {
>>           /* Treat as NOP. */
>>           return;
>>       }
>>
>> -    if (tf)
>> +    if (tf) {
>>           cond = TCG_COND_EQ;
>> -    else
>> -        cond = TCG_COND_NE;
>> -
>> -    l1 = gen_new_label();
>> -    t0 = tcg_temp_new_i32();
>> -    tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc));
>> -    tcg_gen_brcondi_i32(cond, t0, 0, l1);
>> -    tcg_temp_free_i32(t0);
>> -    if (rs == 0) {
>> -        tcg_gen_movi_tl(cpu_gpr[rd], 0);
>>       } else {
>> -        tcg_gen_mov_tl(cpu_gpr[rd], cpu_gpr[rs]);
>> +        cond = TCG_COND_NE;
>>       }
>> -    gen_set_label(l1);
>> +
>> +    t0 = tcg_temp_new();
>> +    tcg_gen_extu_i32_tl(t0, fpu_fcr31);
>> +    tcg_gen_andi_tl(t0, t0, 1 << get_fp_bit(cc));
>> +
>> +    zero = tcg_const_tl(0);
>> +    ts = rs ? cpu_gpr[rs] : zero;
>> +    tcg_gen_movcond_tl(cond, cpu_gpr[rd], t0, zero, ts, cpu_gpr[rd]);
>
> MOVF and MOVT seem to do the opposite now, ts and cpu_gpr[rd] should be
> swapped I think:
>
> tcg_gen_movcond_tl(cond, cpu_gpr[rd], t0, zero, cpu_gpr[rd], ts);

Whoops.  I guess my test kernel isn't built to use that.
Anyway, yes, either that or swap the setting of cond above, which is probably a 
more natural way to write the condition.


r~

  reply	other threads:[~2015-09-04 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 22:50 [Qemu-devel] [PATCH v2 0/2] target-mips improvements Richard Henderson
2015-09-02 22:50 ` [Qemu-devel] [PATCH v2 1/2] target-mips: Use movcond in movci and movcf* Richard Henderson
2015-09-03 17:01   ` Leon Alrae
2015-09-04 14:32     ` Richard Henderson [this message]
2015-09-02 22:50 ` [Qemu-devel] [PATCH v2 2/2] target-mips: Use tcg_gen_extrh_i64_i32 Richard Henderson
2015-09-04 10:49   ` Leon Alrae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E9AB6A.2050808@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=leon.alrae@imgtec.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).