qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
	qemu-devel@nongnu.org
Cc: anton.kochkov@proton.me
Subject: Re: [PATCH 3/5] target/tricore: Fix RRPW_DEXTR
Date: Fri, 27 Jan 2023 08:21:11 -1000	[thread overview]
Message-ID: <ec567f3b-bc3e-ffc4-7d67-1231a4e9895b@linaro.org> (raw)
In-Reply-To: <20230127120328.2520624-4-kbastian@mail.uni-paderborn.de>

On 1/27/23 02:03, Bastian Koppelmann wrote:
> if we used const16 == 0 we would crash qemu with the error:
> 
> ../tcg/tcg-op.c:196: tcg_gen_shri_i32: Assertion `arg2 >= 0 && arg2 < 32' failed
> 
> This is a special case anyways as we can directly return cpu_gpr_d[r1]
> as this is the most significant word an nothing is shifted.
> 
> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> ---
>   target/tricore/translate.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/tricore/translate.c b/target/tricore/translate.c
> index 6149d4f5c0..62128c6aae 100644
> --- a/target/tricore/translate.c
> +++ b/target/tricore/translate.c
> @@ -8708,6 +8708,8 @@ static void decode_32Bit_opc(DisasContext *ctx)
>           const16 = MASK_OP_RRPW_POS(ctx->opcode);
>           if (r1 == r2) {
>               tcg_gen_rotli_tl(cpu_gpr_d[r3], cpu_gpr_d[r1], const16);
> +        } else if (const16 == 0) {
> +            tcg_gen_mov_tl(cpu_gpr_d[r3], cpu_gpr_d[r1]);
>           } else {
>               temp = tcg_temp_new();
>               tcg_gen_shli_tl(temp, cpu_gpr_d[r1], const16);

While correct, this entire operation is

    tcg_gen_extract2_tl(cpu_gpr_d[r3], cpu_gpr_d[r2], cpu_gpr_d[r1], 32 - const16);

which will take care of your two special cases as well.


r~


  reply	other threads:[~2023-01-27 18:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 12:03 [PATCH 0/5] TriCore instruction bugfixes Bastian Koppelmann
2023-01-27 12:03 ` [PATCH 1/5] target/tricore: Fix OPC2_32_RCRW_IMASK translation Bastian Koppelmann
2023-01-27 18:11   ` Richard Henderson
2023-01-27 12:03 ` [PATCH 2/5] target/tricore: Fix OPC2_32_RCRW_INSERT translation Bastian Koppelmann
2023-01-27 18:13   ` Richard Henderson
2023-01-27 12:03 ` [PATCH 3/5] target/tricore: Fix RRPW_DEXTR Bastian Koppelmann
2023-01-27 18:21   ` Richard Henderson [this message]
2023-01-27 12:03 ` [PATCH 4/5] target/tricore: Fix OPC2_32_RRRR_DEXTR Bastian Koppelmann
2023-01-27 18:25   ` Richard Henderson
2023-01-27 12:03 ` [PATCH 5/5] target/tricore: Fix OPC2_32_BO_LD_BU_PREINC Bastian Koppelmann
2023-01-27 18:25   ` 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=ec567f3b-bc3e-ffc4-7d67-1231a4e9895b@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=anton.kochkov@proton.me \
    --cc=kbastian@mail.uni-paderborn.de \
    --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).