qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Roan Richmond <roan.richmond@codethink.co.uk>,
	Alistair Francis <alistair23@gmail.com>
Cc: qemu-riscv@nongnu.org, palmer@dabbelt.com,
	alistair.francis@wdc.com, liwei1518@gmail.com,
	dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com,
	qemu-devel@nongnu.org, richard.henderson@linaro.org
Subject: Re: [PATCH v2] Add RISCV Zilsd extension
Date: Fri, 21 Nov 2025 08:41:53 +0100	[thread overview]
Message-ID: <442e57d9-74f1-4a46-be5a-70158ce0c8ea@linaro.org> (raw)
In-Reply-To: <19ada6a7-089e-4103-9c2f-c6a9a0e7add2@codethink.co.uk>

Hi Roan,

On 13/11/25 09:53, Roan Richmond wrote:
> On 12/11/2025 01:41, Alistair Francis wrote:
>> On Mon, Nov 10, 2025 at 7:05 PM Roan Richmond
>> <roan.richmond@codethink.co.uk> wrote:
>>> This is based on v1.0 of the Zilsd extension [1].
>>> The specification is listed as in the Ratified state [2],
>>>   since Jan 30, 2025.
>>>
>>> [1]: https://github.com/riscv/riscv-zilsd
>>> [2]: https://riscv.atlassian.net/wiki/spaces/HOME/pages/16154861/ 
>>> RISC-V+Specs+Under+Development
>>>
>>> Reviewed-by: Daniel Henrique barboza <dbarboza@ventanamicro.com>
>>> Reviewed-by: Richard Henderson  <richard.henderson@linaro.org>
>>> Signed-off-by: Roan Richmond <roan.richmond@codethink.co.uk>
>>> ---
>>> v2:
>>>    - In `gen_load_zilsd` swapped `dest_gpr` with `tcg_temp_new`, this 
>>> prevents
>>>      writing to `r1/r0` in the case where `r0` is the set as `rd`.
>>>    - Removed unneeded brackets around `a->rd` + c expressions
>>>
>>>   target/riscv/cpu.c                      |  2 +
>>>   target/riscv/cpu_cfg_fields.h.inc       |  1 +
>>>   target/riscv/insn_trans/trans_rvi.c.inc | 57 ++++++++++++++++++++++++-
>>>   3 files changed, 58 insertions(+), 2 deletions(-)


>>> @@ -482,6 +509,27 @@ static bool gen_store_tl(DisasContext *ctx, 
>>> arg_sb *a, MemOp memop)
>>>       return true;
>>>   }
>>>
>>> +/* Zilsd extension adds load/store double for 32bit arch */
>>> +static bool gen_store_zilsd(DisasContext *ctx, arg_sb *a)
>>> +{
>>> +    TCGv data_1 = tcg_temp_new();
>>> +    TCGv data_2 = tcg_temp_new();

[*]

>>> +    if (a->rs2 != 0) {
>>> +        data_1 = get_gpr(ctx, a->rs2, EXT_NONE);
>>> +        data_2 = get_gpr(ctx, a->rs2+1, EXT_NONE);
>>> +    }
>> Don't mix code and declarations, otherwise
>>
>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>>
>> Alistair
> Struggling to see what you mean by this.
> 
> Could you provide a bit more clarification on the changes you would like 
> me to make and then I'll send out a v3.
> 
> Thanks,
> Roan
> 
>>
>>> +    TCGv addr_1 = get_address(ctx, a->rs1, a->imm);

The declaration part is:

    TCGv addr_1;

and the code part is:

    addr_1 = get_address(ctx, a->rs1, a->imm);

Per our coding style (docs/devel/style.rst) chapter "Declarations":

    Mixed declarations (interleaving statements and declarations
    within blocks) are generally not allowed; declarations should
    be at the beginning of blocks.

Declarations should go in [*].

For v3 you should address Richard's comments.

Regards,

Phil.

>>> +    TCGv addr_2 = get_address(ctx, a->rs1, a->imm+4);
>>> +
>>> +    if (ctx->ztso) {
>>> +        tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
>>> +    }
>>> +
>>> +    tcg_gen_qemu_st_tl(data_1, addr_1, ctx->mem_idx, MO_SL);
>>> +    tcg_gen_qemu_st_tl(data_2, addr_2, ctx->mem_idx, MO_SL);
>>> +    return true;
>>> +}
>>> +
>>>   static bool gen_store_i128(DisasContext *ctx, arg_sb *a, MemOp memop)
>>>   {
>>>       TCGv src1l = get_gpr(ctx, a->rs1, EXT_NONE);
>>> @@ -511,6 +559,8 @@ static bool gen_store(DisasContext *ctx, arg_sb 
>>> *a, MemOp memop)
>>>       decode_save_opc(ctx, 0);
>>>       if (get_xl(ctx) == MXL_RV128) {
>>>           return gen_store_i128(ctx, a, memop);
>>> +    } else if (memop == MO_UQ && get_xl(ctx) == MXL_RV32) {
>>> +        return gen_store_zilsd(ctx, a);
>>>       } else {
>>>           return gen_store_tl(ctx, a, memop);
>>>       }
>>> @@ -533,7 +583,10 @@ static bool trans_sw(DisasContext *ctx, arg_sw *a)
>>>
>>>   static bool trans_sd(DisasContext *ctx, arg_sd *a)
>>>   {
>>> -    REQUIRE_64_OR_128BIT(ctx);
>>> +    /* Check for Zilsd extension if 32bit */
>>> +    if (get_xl(ctx) == MXL_RV32 && !ctx->cfg_ptr->ext_zilsd) {
>>> +        return false;
>>> +    }
>>>       return gen_store(ctx, a, MO_UQ);
>>>   }
>>>
>>> -- 
>>> 2.43.0
>>>



  reply	other threads:[~2025-11-21  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  9:05 [PATCH v2] Add RISCV Zilsd extension Roan Richmond
2025-11-12  1:41 ` Alistair Francis
2025-11-13  8:53   ` Roan Richmond
2025-11-21  7:41     ` Philippe Mathieu-Daudé [this message]
2025-11-13 10:54 ` 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=442e57d9-74f1-4a46-be5a-70158ce0c8ea@linaro.org \
    --to=philmd@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=richard.henderson@linaro.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).