From: Chen Gang <xili_gchen_5257@hotmail.com>
To: "Richard Henderson" <rth@twiddle.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Andreas Färber" <afaerber@suse.de>,
"Chris Metcalf" <cmetcalf@ezchip.com>
Cc: "walt@tilera.com" <walt@tilera.com>,
Riku Voipio <riku.voipio@iki.fi>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 09/10 v10] target-tilegx: Generate tcg instructions to execute to _init_malloc in glib
Date: Sat, 30 May 2015 03:29:42 +0800 [thread overview]
Message-ID: <BLU436-SMTP1419AECE850026ECE9EFD4DB9C90@phx.gbl> (raw)
In-Reply-To: <5550DEFF.8050204@twiddle.net>
On 5/12/15 00:55, Richard Henderson wrote:
>> +static void gen_v1cmpeqi(struct DisasContext *dc,
>> > + uint8_t rdst, uint8_t rsrc, uint8_t imm8)
>> > +{
>> > + int count;
>> > + TCGv vdst = dest_gr(dc, rdst);
>> > + TCGv tmp = tcg_temp_new_i64();
>> > +
>> > + qemu_log_mask(CPU_LOG_TB_IN_ASM, "v1cmpeqi r%d, r%d, %d\n",
>> > + rdst, rsrc, imm8);
>> > +
>> > + tcg_gen_movi_i64(vdst, 0);
>> > +
>> > + for (count = 0; count < 8; count++) {
>> > + tcg_gen_shri_i64(tmp, load_gr(dc, rsrc), (8 - count - 1) * 8);
>> > + tcg_gen_andi_i64(tmp, tmp, 0xff);
>> > + tcg_gen_setcondi_i64(TCG_COND_EQ, tmp, tmp, imm8);
>> > + tcg_gen_or_i64(vdst, vdst, tmp);
>> > + tcg_gen_shli_i64(vdst, vdst, 8);
> For all of these vector instructions, I would encourage you to use helpers to
> extract and insert values. Extraction has little choice but to use a shift and
> a mask, as you use here. But insertion can use tcg_gen_deposit_i64. I think
> that is a lot easier to reason with than your construction here which
> sequentially shifts vdst.
>
> E.g.
>
> static inline void
> extract_v1(TCGv out, TCGv in, unsigned byte)
> {
> tcg_gen_shri_i64(out, in, byte * 8);
> tcg_gen_ext8u_i64(out, out);
> }
>
> static inline void
> insert_v1(TCGv out, TCGv in, unsigned byte)
> {
> tcg_gen_deposit_i64(out, out, in, byte * 8, 8);
> }
>
>
> This loop then becomes
>
> TCGv vsrc = load_gr(dc, src);
> for (count = 0; count < 8; ++count) {
> extract_v1(tmp, vsrc, count);
> tcg_gen_setcondi_i64(TCG_COND_EQ, tmp, tmp, imm8);
> insert_v1(vdst, tmp, count);
> }
>
It also needs "tcg_gen_movi_i64(vdst, 0);" or will generate assertion
`ts->val_type == TEMP_VAL_REG' in debug mode.
And I shall try to send patch within one day (sorry for a little late).
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
next prev parent reply other threads:[~2015-05-29 19:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-10 22:36 [Qemu-devel] [PATCH 00/10 v10] tilegx: Firstly add tilegx target for linux-user Chen Gang
2015-05-10 22:38 ` [Qemu-devel] [PATCH 01/10 v10] linux-user: tilegx: Firstly add architecture related features Chen Gang
2015-05-10 22:39 ` [Qemu-devel] [PATCH 02/10 v10] linux-user: Support tilegx architecture in linux-user Chen Gang
2015-05-10 22:40 ` [Qemu-devel] [PATCH 03/10 v10] linux-user/syscall.c: Conditionalize syscalls which are not defined in tilegx Chen Gang
2015-05-10 22:41 ` [Qemu-devel] [PATCH 04/10 v10] target-tilegx: Add opcode basic implementation from Tilera Corporation Chen Gang
2015-05-10 22:43 ` [Qemu-devel] [PATCH 06/10 v10] target-tilegx: Add special register information " Chen Gang
2015-05-10 22:44 ` [Qemu-devel] [PATCH 07/10 v10] target-tilegx: Add cpu basic features for linux-user Chen Gang
2015-05-10 22:44 ` [Qemu-devel] [PATCH 08/10 v10] target-tilegx: Add helper " Chen Gang
2015-05-10 22:45 ` [Qemu-devel] [PATCH 09/10 v10] target-tilegx: Generate tcg instructions to execute to _init_malloc in glib Chen Gang
2015-05-11 16:55 ` Richard Henderson
2015-05-11 21:26 ` Chen Gang
2015-05-26 21:39 ` Chen Gang
2015-06-01 20:58 ` Chen Gang
2015-05-14 14:56 ` Chen Gang
2015-05-14 15:08 ` Chen Gang
2015-05-14 16:05 ` Chen Gang
2015-05-15 2:31 ` Chen Gang
2015-05-29 19:29 ` Chen Gang [this message]
2015-05-10 22:46 ` [Qemu-devel] [PATCH 10/10 v10] target-tilegx: Add TILE-Gx building files Chen Gang
[not found] ` <BLU437-SMTP59B35F884A72A991334DBB9DC0@phx.gbl>
2015-05-11 16:01 ` [Qemu-devel] [PATCH 05/10 v10] target-tilegx/opcode_tilegx.h: Modify it to fit qemu using Richard Henderson
2015-05-11 21:06 ` Chen Gang
2015-05-11 22:06 ` Richard Henderson
2015-05-12 0:43 ` gchen gchen
2015-05-12 10:56 ` Chen Gang
2015-05-12 11:08 ` Peter Maydell
2015-05-12 11:16 ` Chen Gang
2015-05-19 2:47 ` Chen Gang
2015-05-21 20:59 ` Chen Gang
2015-05-21 23:40 ` Chris Metcalf
2015-05-22 1:48 ` Chen Gang
2015-05-24 22:03 ` Chen Gang
2015-05-25 15:13 ` Chen Gang
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=BLU436-SMTP1419AECE850026ECE9EFD4DB9C90@phx.gbl \
--to=xili_gchen_5257@hotmail.com \
--cc=afaerber@suse.de \
--cc=cmetcalf@ezchip.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
--cc=walt@tilera.com \
/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).