qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 13/40] target/mips: Add emulation of misc nan


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v3 13/40] target/mips: Add emulation of misc nanoMIPS instructions (pool32a0)
Date: Wed, 25 Jul 2018 12:07:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 07/25/2018 08:38 AM, Aleksandar Markovic wrote:
> Hi, Richard.
> 
>>> +    case NM_SOV:
>>> +    {
>>> +        TCGv t0 = tcg_temp_local_new();
>>> +        TCGv t1 = tcg_temp_new();
>>> +        TCGv t2 = tcg_temp_new();
>>> +        TCGLabel *l1 = gen_new_label();
>>> +
>>> +        gen_load_gpr(t1, rs);
>>> +        gen_load_gpr(t2, rt);
>>> +        tcg_gen_add_tl(t0, t1, t2);
>>> +        tcg_gen_ext32s_tl(t0, t0);
>>> +        tcg_gen_xor_tl(t1, t1, t2);
>>> +        tcg_gen_xor_tl(t2, t0, t2);
>>> +        tcg_gen_andc_tl(t1, t2, t1);
>>> +
>>> +        tcg_gen_movi_tl(t0, 0);
>>> +        tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1);
>>
>> tcg_gen_setcondi_tl.
>>
> 
> Would here the correct simplification be:
> 
> Replace code segment
> 
> tcg_gen_movi_tl(t0, 0);
> tcg_gen_brcondi_tl(TCG_COND_GE, t1, 0, l1);
> tcg_gen_movi_tl(t0, 1);
> gen_set_label(l1);
> 
> with
> 
> tcg_gen_setcondi_tl(TCG_COND_GE, t0, t1, 0);
> (plus deleting the declaration of l1 of course)

Nearly.  You're branching over a move of 1, and so computing the inverse of the
condition.  So the correct replacement is

  tcg_gen_setcondi_tl(TCG_COND_LT, t0, t1, 0);


r~



reply via email to

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