qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chinmay Rath <rathc@linux.vnet.ibm.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	Chinmay Rath <rathc@linux.ibm.com>,
	qemu-ppc@nongnu.org
Cc: qemu-devel@nongnu.org, npiggin@gmail.com, danielhb413@gmail.com,
	harshpb@linux.ibm.com
Subject: Re: [PATCH 2/4] target/ppc: Move VSX vector with length storage access insns to decodetree.
Date: Sun, 9 Jun 2024 23:41:04 +0530	[thread overview]
Message-ID: <d027b594-6fcc-49f6-a179-25b479be2be7@linux.vnet.ibm.com> (raw)
In-Reply-To: <91e78fa4-f844-4b79-ba09-46c722f35df8@linaro.org>


Hi Richard,

On 6/7/24 21:11, Richard Henderson wrote:
> On 6/7/24 07:49, Chinmay Rath wrote:
>> +static bool do_ld_st_vl(DisasContext *ctx, arg_X *a,
>> +                        void (*helper)(TCGv_ptr, TCGv, TCGv_ptr, TCGv))
>> +{
>> +    TCGv EA;
>> +    TCGv_ptr xt;
>> +    if (a->rt < 32) {
>> +        REQUIRE_VSX(ctx);
>> +    } else {
>> +        REQUIRE_VECTOR(ctx);
>> +    }
>> +    xt = gen_vsr_ptr(a->rt);
>> +    gen_set_access_type(ctx, ACCESS_INT);
>> +
>> +    if (a->ra) {
>> +        EA = tcg_temp_new();
>> +        tcg_gen_mov_tl(EA, cpu_gpr[a->ra]);
>> +    } else {
>> +        EA = tcg_constant_tl(0);
>> +    }
>> +    if (NARROW_MODE(ctx)) {
>> +        tcg_gen_ext32u_tl(EA, EA);
>
> ra == 0, narrow mode, will crash, due to write into constant 0.
> Obviously 0 does not need extending, so this could be
>
>     if (!a->ra) {
>         ea = constant 0;
>     } else if (narrow mode) {
>         ea = tcg_temp_new();
>         tcg_gen_ext32u_tl(ea, cpu_gpr[a->ra]);
>     } else {
>         ra = cpu_gpr[a->ra];
>     }
>
^ Thank you Richard, will take care in v2.
>
> Aren't there existing helper functions for computing this address?
> And if not, better to create one.
^
The calculation of effective address in these instructions is slightly 
different than the others,
for which helper function exist :

EA for these insns : EA ← (RA=0) ? 0 : GPR[RA]
EA for rest storage access insns : EA ← ((RA=0) ? 0 : GPR[RA]) + GPR[RB]

This is why I could not reuse that function. Also, this calculation of 
EA is limited to these
4 insns above, and only 2 others (prefixed insns), which is why I did 
not create a new function
for this, considering it won't be reused for any other insn.

Please let me know if I should create a new function in this case as well.

Thanks and Regards,
Chinmay
>
>
> r~
>



  reply	other threads:[~2024-06-09 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 14:49 [PATCH 0/4] target/ppc: Move VSX storage access and compare Chinmay Rath
2024-06-07 14:49 ` [PATCH 1/4] target/ppc: Moving VSX scalar storage access insns to decodetree Chinmay Rath
2024-06-07 15:42   ` Richard Henderson
2024-06-07 14:49 ` [PATCH 2/4] target/ppc: Move VSX vector with length " Chinmay Rath
2024-06-07 15:41   ` Richard Henderson
2024-06-09 18:11     ` Chinmay Rath [this message]
2024-06-09 18:20       ` Richard Henderson
2024-06-07 14:49 ` [PATCH 3/4] target/ppc: Move VSX vector " Chinmay Rath
2024-06-07 15:46   ` Richard Henderson
2024-06-09 18:25     ` Chinmay Rath
2024-06-09 18:36     ` Chinmay Rath
2024-06-07 14:49 ` [PATCH 4/4] target/ppc: Move VSX fp compare " Chinmay Rath
2024-06-07 15:55   ` Richard Henderson
2024-06-09 18:26     ` Chinmay Rath

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=d027b594-6fcc-49f6-a179-25b479be2be7@linux.vnet.ibm.com \
    --to=rathc@linux.vnet.ibm.com \
    --cc=danielhb413@gmail.com \
    --cc=harshpb@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=richard.henderson@linaro.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).