From: Richard Henderson <richard.henderson@linaro.org>
To: Christoph Muellner <christoph.muellner@vrull.eu>,
qemu-riscv@nongnu.org, qemu-devel@nongnu.org,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bin.meng@windriver.com>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Palmer Dabbelt <palmer@dabbelt.com>,
Jeff Law <jeffreyalaw@gmail.com>,
Tsukasa OI <research_trasio@irq.a4lg.com>,
liweiwei@iscas.ac.cn,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Rob Bradford <rbradford@rivosinc.com>
Subject: Re: [PATCH v5] riscv: Add support for the Zfa extension
Date: Fri, 30 Jun 2023 16:03:14 +0200 [thread overview]
Message-ID: <55279432-e4fe-7309-ac6f-5e2a4b86f47c@linaro.org> (raw)
In-Reply-To: <20230630115239.1920012-1-christoph.muellner@vrull.eu>
On 6/30/23 13:52, Christoph Muellner wrote:
> +bool trans_fmvh_x_d(DisasContext *ctx, arg_fmvh_x_d *a)
> +{
> + REQUIRE_FPU;
> + REQUIRE_ZFA(ctx);
> + REQUIRE_EXT(ctx, RVD);
> + REQUIRE_32BIT(ctx);
> +
> + TCGv dst = dest_gpr(ctx, a->rd);
> + TCGv_i64 t1 = tcg_temp_new_i64();
> +
> + tcg_gen_extract_i64(t1, cpu_fpr[a->rs1], 32, 32);
> + tcg_gen_trunc_i64_tl(dst, t1);
> + gen_set_gpr(ctx, a->rd, dst);
I think you would prefer
tcg_gen_srai_tl(t1, cpu_fpr[rs1], 32);
so that dst is sign-extended to begin, instead of zero-extended. You don't see an error
because gen_set_gpr, for MXL_RV32, sign-extends the stored value.
However, the tcg optimizer would elide the second sign-extend if it can see that the value
is already sign-extended. So this could reduce to 1 operation instead of 2.
r~
next prev parent reply other threads:[~2023-06-30 14:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 11:52 [PATCH v5] riscv: Add support for the Zfa extension Christoph Muellner
2023-06-30 13:50 ` Richard Henderson
2023-06-30 14:03 ` Richard Henderson [this message]
2023-06-30 15:11 ` Christoph Müllner
2023-06-30 17:47 ` 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=55279432-e4fe-7309-ac6f-5e2a4b86f47c@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=christoph.muellner@vrull.eu \
--cc=dbarboza@ventanamicro.com \
--cc=jeffreyalaw@gmail.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=philipp.tomsich@vrull.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=rbradford@rivosinc.com \
--cc=research_trasio@irq.a4lg.com \
--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).