qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	Roan Richmond <roan.richmond@codethink.co.uk>,
	qemu-riscv@nongnu.org
Cc: palmer@dabbelt.com, alistair.francis@wdc.com,
	liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com,
	qemu-devel@nongnu.org, alistair23@gmail.com
Subject: Re: [PATCH] Add RISCV Zilsd extension
Date: Thu, 6 Nov 2025 16:12:19 +0100	[thread overview]
Message-ID: <89299280-94da-49ce-97d6-90b085ccd16c@linaro.org> (raw)
In-Reply-To: <6b90bd55-f2c9-4c6c-9058-16ba147f3c0f@ventanamicro.com>

On 11/6/25 15:47, Daniel Henrique Barboza wrote:
> 
> 
> On 11/6/25 11:31 AM, Roan Richmond wrote:
>> I understand your point about doing the check before the 2 ld_tl() and the 2 dst_gpr() 
>> calls.
>>
>> My reasoning for doing the check after was the wording of the specification:
>> "LD instructions with destination x0 are processed as any other load, but the result is 
>> discarded entirely and x1 is not written"
>> This suggests that a load instruction is still dispatched but the result is then discarded.
...
>>>>   +/* Zilsd extension adds load/store double for 32bit arch */
>>>> +static bool gen_load_zilsd(DisasContext *ctx, arg_lb *a)
>>>> +{
>>>> +    TCGv dest_1 = dest_gpr(ctx, a->rd);
>>>> +    TCGv dest_2 = dest_gpr(ctx, (a->rd)+1);
>>>> +    TCGv addr_1 = get_address(ctx, a->rs1, a->imm);
>>>> +    TCGv addr_2 = get_address(ctx, a->rs1, (a->imm)+4);
>>>> +
>>>> +    tcg_gen_qemu_ld_tl(dest_1, addr_1, ctx->mem_idx, MO_SL);
>>>> +    tcg_gen_qemu_ld_tl(dest_2, addr_2, ctx->mem_idx, MO_SL);
>>>> +
>>>> +    /* If destination is x0 then result of the load is discarded */
>>>> +    if (a->rd == 0) {
>>>> +        return true;
>>>> +    }

If you're looking to not write to r1, then you need to use true temporaries, not 
dest_gpr(), which may return r1, which will be modified by the load.

You can drop the unnecessary () in those a->{rd,imm} + c expressions.




      reply	other threads:[~2025-11-06 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 11:59 [PATCH] Add RISCV Zilsd extension Roan Richmond
2025-11-06 12:17 ` Daniel Henrique Barboza
2025-11-06 14:31   ` Roan Richmond
2025-11-06 14:47     ` Daniel Henrique Barboza
2025-11-06 15:12       ` Richard Henderson [this message]

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=89299280-94da-49ce-97d6-90b085ccd16c@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=roan.richmond@codethink.co.uk \
    --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).