qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Deepak Gupta <debug@rivosinc.com>
To: Alexey Baturo <baturo.alexey@gmail.com>
Cc: richard.henderson@linaro.org, zhiwei_liu@linux.alibaba.com,
	palmer@dabbelt.com, Alistair.Francis@wdc.com,
	sagark@eecs.berkeley.edu, kbastian@mail.uni-paderborn.de,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Subject: Re: [PATCH v3 5/6] target/riscv: Update address modify functions to take into account pointer masking
Date: Fri, 5 Jan 2024 10:07:32 -0800	[thread overview]
Message-ID: <ZZhFZB8kpOd48mba@debug.ba.rivosinc.com> (raw)
In-Reply-To: <CAFukJ-B-TorkC4q-a1gVvyJD4w4vUF26Ph+VhPNjQJCDTuOZTw@mail.gmail.com>

On Fri, Jan 05, 2024 at 10:29:35AM +0300, Alexey Baturo wrote:
>> +    addr = addr << pmlen;
>> +    if (signext) {
>> +        addr = (target_long)addr >> pmlen;
>> +    } else {
>> +        addr = addr >> pmlen;
>Could you please elaborate a bit more on your concern here?
>I believe this code works as intended: https://godbolt.org/z/b9c7na13a
Nevermind I missed this above in code.
addr = addr << pmlen;

You're good. Sorry about that.
>
>Thanks
>
>пт, 5 янв. 2024 г. в 04:02, Deepak Gupta <debug@rivosinc.com>:
>
>> > --- a/target/riscv/vector_helper.c
>> > +++ b/target/riscv/vector_helper.c
>> > @@ -94,6 +94,18 @@ static inline uint32_t vext_max_elems(uint32_t desc,
>> uint32_t log2_esz)
>> >
>> >  static inline target_ulong adjust_addr(CPURISCVState *env, target_ulong
>> addr)
>> >  {
>> > +    RISCVPmPmm pmm = riscv_pm_get_pmm(env);
>> > +    if (pmm == PMM_FIELD_DISABLED)
>> > +        return addr;
>> > +    int pmlen = riscv_pm_get_pmlen(pmm);
>> > +    bool signext = !riscv_cpu_bare_mode(env);
>> > +    addr = addr << pmlen;
>> > +    /* sign/zero extend masked address by N-1 bit */
>> > +    if (signext) {
>> > +        addr = (target_long)addr >> pmlen;
>>
>> These look like right shift operations and not sign extensions of N-1 bit
>>
>> > +    } else {
>> > +        addr = addr >> pmlen;
>>
>> Same here.
>>
>> > +    }
>> >      return addr;
>> >  }
>> >
>> > --
>> > 2.34.1
>> >
>> >
>>


  reply	other threads:[~2024-01-05 18:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 18:57 [PATCH v3 0/6] Pointer Masking update for Zjpm v0.8 Alexey Baturo
2024-01-03 18:57 ` [PATCH v3 1/6] target/riscv: Remove obsolete pointer masking extension code Alexey Baturo
2024-01-05  5:04   ` Alistair Francis
2024-01-05  7:23     ` Alexey Baturo
2024-01-03 18:57 ` [PATCH v3 2/6] target/riscv: Add new CSR fields for S{sn, mn, m}pm extensions as part of Zjpm v0.8 Alexey Baturo
2024-01-03 18:57 ` [PATCH v3 3/6] target/riscv: Add helper functions to calculate current number of masked bits for pointer masking Alexey Baturo
2024-01-05  0:46   ` Deepak Gupta
2024-01-05  7:33     ` Alexey Baturo
2024-01-05 18:13       ` Deepak Gupta
2024-01-03 18:57 ` [PATCH v3 4/6] target/riscv: Add pointer masking tb flags Alexey Baturo
2024-01-03 22:08   ` Richard Henderson
2024-01-03 18:57 ` [PATCH v3 5/6] target/riscv: Update address modify functions to take into account pointer masking Alexey Baturo
2024-01-03 22:18   ` Richard Henderson
2024-01-05  1:02   ` Deepak Gupta
2024-01-05  7:29     ` Alexey Baturo
2024-01-05 18:07       ` Deepak Gupta [this message]
2024-01-03 18:57 ` [PATCH v3 6/6] target/riscv: Enable updates for pointer masking variables and thus enable pointer masking extension Alexey Baturo
2024-01-05  5:27   ` Alistair Francis
2024-01-05  7:23     ` Alexey Baturo
2024-01-08  0:33       ` Alistair Francis

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=ZZhFZB8kpOd48mba@debug.ba.rivosinc.com \
    --to=debug@rivosinc.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=baturo.alexey@gmail.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sagark@eecs.berkeley.edu \
    --cc=zhiwei_liu@linux.alibaba.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).