qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
	Xiaojuan Yang <yangxiaojuan@loongson.cn>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-arm@nongnu.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Song Gao <gaosong@loongson.cn>
Subject: Re: [PATCH 2/6] target/cris: Use hswap_i32() in SWAPW opcode
Date: Tue, 22 Aug 2023 15:06:44 +0200	[thread overview]
Message-ID: <09dd2dc9-edc2-a9d2-e91a-a5eb07f96ca0@linaro.org> (raw)
In-Reply-To: <CAFEAcA-36XE-9ikSp0F4EMUKysz=ms2JyLCc8GOWcgJq3sb=hw@mail.gmail.com>

On 22/8/23 13:44, Peter Maydell wrote:
> On Tue, 22 Aug 2023 at 12:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Commit 46be8425ff ("tcg: Implement tcg_gen_{h,w}swap_{i32,i64}")
>> introduced the generic hswap_i32(). Use it instead of open-coding
>> it as t_gen_swapw().
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   target/cris/translate.c         | 14 +-------------
>>   target/cris/translate_v10.c.inc |  2 +-
>>   2 files changed, 2 insertions(+), 14 deletions(-)


>> diff --git a/target/cris/translate_v10.c.inc b/target/cris/translate_v10.c.inc
>> index b7b0517982..0ff15769ec 100644
>> --- a/target/cris/translate_v10.c.inc
>> +++ b/target/cris/translate_v10.c.inc
>> @@ -506,7 +506,7 @@ static void dec10_reg_swap(DisasContext *dc)
>>       if (dc->dst & 8)
>>           tcg_gen_not_tl(t0, t0);
>>       if (dc->dst & 4)
>> -        t_gen_swapw(t0, t0);
>> +        tcg_gen_hswap_i32(t0, t0);
> 
> Both these are operating on TCGv, not TCGv_i32, so I think this
> should be tcg_gen_hswap_tl(). (Compare the tcg_gen_not_tl()
> calls.)

You are correct, if someone copies part of this code to a new
function compiled for a 64-bit target, this won't build.

We know cris is a 32-bit only target.

When implementing tcg_gen_foo_tl(), should we implement both
corresponding tcg_gen_foo_i32/i64() even if one is never used
(thus not tested)?

I like completeness, but I'm a bit reluctant to commit unused
code (mostly for maintenance burden).

Maybe I can go mid-way and only add tcg_gen_hswap_tl() ->
tcg_gen_hswap_i32() here. If tcg_gen_hswap_tl() were used on
a 64-bit target then we'd get a build failure. Does that
sound reasonable?

Thanks,

Phil.


  reply	other threads:[~2023-08-22 13:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 11:01 [PATCH 0/6] target: Use TCG generic gen_hswap_i32/i64() Philippe Mathieu-Daudé
2023-08-22 11:01 ` [PATCH 1/6] target/arm: Use hswap_i32() in VREV/SMLAD opcodes Philippe Mathieu-Daudé
2023-08-22 14:59   ` Richard Henderson
2023-08-22 11:01 ` [PATCH 2/6] target/cris: Use hswap_i32() in SWAPW opcode Philippe Mathieu-Daudé
2023-08-22 11:44   ` Peter Maydell
2023-08-22 13:06     ` Philippe Mathieu-Daudé [this message]
2023-08-22 13:27       ` Peter Maydell
2023-08-22 13:48         ` Philippe Mathieu-Daudé
2023-08-22 11:01 ` [PATCH 3/6] target/microblaze: Use hswap_i32() in SWAPH opcode Philippe Mathieu-Daudé
2023-08-22 15:03   ` Richard Henderson
2023-08-22 11:01 ` [PATCH 4/6] target/sh4: Use hswap_i32() in SWAP.W opcode Philippe Mathieu-Daudé
2023-08-22 15:03   ` Richard Henderson
2023-08-22 11:01 ` [PATCH 5/6] target/mips: Use hswap_i64() in DSHD opcode Philippe Mathieu-Daudé
2023-08-22 11:57   ` Peter Maydell
2023-08-22 11:01 ` [PATCH 6/6] target/loongarch: Use hswap_i64() in REVH.D opcode Philippe Mathieu-Daudé
2023-08-22 15:11   ` Richard Henderson

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=09dd2dc9-edc2-a9d2-e91a-a5eb07f96ca0@linaro.org \
    --to=philmd@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=edgar.iglesias@gmail.com \
    --cc=gaosong@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@loongson.cn \
    --cc=ysato@users.sourceforge.jp \
    /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).