qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/10 v10] target-tilegx: Generate tcg instructi


From: Chen Gang
Subject: Re: [Qemu-devel] [PATCH 09/10 v10] target-tilegx: Generate tcg instructions to execute to _init_malloc in glib
Date: Wed, 27 May 2015 05:39:12 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 5/12/15 05:26, Chen Gang wrote:
>>> >> +}
>>> >> +
>>> >> +/*
>>> >> + * Functional Description
>>> >> + *
>>> >> + *        uint64_t output = 0;
>>> >> + *        uint32_t counter;
>>> >> + *        for (counter = 0; counter < (WORD_SIZE / 32); counter++)
>>> >> + *        {
>>> >> + *            bool asel = ((counter & 1) == 1);
>>> >> + *            int in_sel = 0 + counter / 2;
>>> >> + *            int32_t srca = get4Byte (rf[SrcA], in_sel);
>>> >> + *            int32_t srcb = get4Byte (rf[SrcB], in_sel);
>>> >> + *            output = set4Byte (output, counter, (asel ? srca : srcb));
>>> >> + *        }
>>> >> + *        rf[Dest] = output;
>>> >> +*/
>>> >> +
>>> >> +static void gen_v4int_l(struct DisasContext *dc,
>>> >> +                        uint8_t rdst, uint8_t rsrc, uint8_t rsrcb)
>>> >> +{
>>> >> +    TCGv vdst = dest_gr(dc, rdst);
>>> >> +    TCGv tmp = tcg_temp_new_i64();
>>> >> +
>>> >> +    qemu_log_mask(CPU_LOG_TB_IN_ASM, "v4int_l r%d, r%d, r%d\n",
>>> >> +                  rdst, rsrc, rsrcb);
>>> >> +
>>> >> +    tcg_gen_andi_i64(vdst, load_gr(dc, rsrc), 0xffffffff);
>>> >> +    tcg_gen_shli_i64(vdst, vdst, 8);
>>> >> +    tcg_gen_andi_i64(tmp, load_gr(dc, rsrcb), 0xffffffff);
>>> >> +    tcg_gen_or_i64(vdst, vdst, tmp);
>> > 
>> > And herein is a bug, that I'd hope using the helper functions would avoid: 
>> > you
>> > shift by 8 instead of 32.  This function simplifies to
>> > 
> OK, thank you very much.
> 
>> >    tcg_gen_deposit_i64(vdst, load_gr(dc, rsrc), load_gr(dc, rsrcb),
>> >                             32, 32);
>> > 

Oh, it is:

        tcg_gen_deposit_i64(vdst, load_gr(dc, rsrc), load_gr(dc, rsrcb),
                            0, 32);

> OK, thanks.
> 

Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed



reply via email to

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