From: Richard Henderson <richard.henderson@linaro.org>
To: Weiwei Li <liweiwei@iscas.ac.cn>,
palmer@dabbelt.com, alistair.francis@wdc.com,
bin.meng@windriver.com, qemu-riscv@nongnu.org,
qemu-devel@nongnu.org
Cc: wangjunqiang@iscas.ac.cn, lazyparser@gmail.com,
luruibo2000@163.com, lustrew@foxmail.com
Subject: Re: [PATCH v7 09/14] target/riscv: rvk: add support for sha512 related instructions for RV32 in zknh extension
Date: Mon, 28 Feb 2022 09:38:52 -1000 [thread overview]
Message-ID: <ea054747-9c1b-4e0b-f084-6063d19207ca@linaro.org> (raw)
In-Reply-To: <20220228144810.7284-10-liweiwei@iscas.ac.cn>
On 2/28/22 04:48, Weiwei Li wrote:
> +#define GEN_SHA512H_RV32(NAME, OP, NUM1, NUM2, NUM3) \
> +static void gen_##NAME(TCGv dest, TCGv src1, TCGv src2) \
> +{ \
> + TCGv_i64 t0 = tcg_temp_new_i64(); \
> + TCGv_i64 t1 = tcg_temp_new_i64(); \
> + TCGv_i64 t2 = tcg_temp_new_i64(); \
> + \
> + tcg_gen_concat_tl_i64(t0, src1, src2); \
> + tcg_gen_##OP##_i64(t1, t0, NUM1); \
> + tcg_gen_concat_tl_i64(t2, src1, tcg_const_tl(0)); \
The bug here is tcg_const_tl instead of tcg_constant_tl, which leaks a temporary.
It's not the best option for zero-extension, though, as we don't optimize a deposit of
zero like this (we probably should, but, hey).
Better would be
tcg_gen_extu_tl_i64(t2, src1);
tcg_gen_ext32u_i64(t2, t2);
Note that the first operation will *not* extend if TARGET_RISCV64, since it doesn't
actually change type. The second operation will be optimized away if TARGET_RISCV32,
since the zero-extend has already happened.
BTW, it would be better to not use a large macro for this, and in the previous patch.
Passing in parameters to a helper function would be easier to read and debug.
r~
next prev parent reply other threads:[~2022-02-28 19:40 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 14:47 [PATCH v7 00/14] support subsets of scalar crypto extension Weiwei Li
2022-02-28 14:47 ` [PATCH v7 01/14] target/riscv: rvk: add cfg properties for zbk* and zk* Weiwei Li
2022-02-28 14:47 ` [PATCH v7 02/14] target/riscv: rvk: add support for zbkb extension Weiwei Li
2022-02-28 18:54 ` Richard Henderson
2022-02-28 14:47 ` [PATCH v7 03/14] target/riscv: rvk: add support for zbkc extension Weiwei Li
2022-02-28 18:55 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 04/14] target/riscv: rvk: add support for zbkx extension Weiwei Li
2022-02-28 14:48 ` [PATCH v7 05/14] crypto: move sm4_sbox from target/arm Weiwei Li
2022-02-28 14:48 ` [PATCH v7 06/14] target/riscv: rvk: add support for zknd/zkne extension in RV32 Weiwei Li
2022-02-28 18:57 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 07/14] target/riscv: rvk: add support for zkne/zknd extension in RV64 Weiwei Li
2022-02-28 19:01 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 08/14] target/riscv: rvk: add support for sha256 related instructions in zknh extension Weiwei Li
2022-02-28 19:03 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 09/14] target/riscv: rvk: add support for sha512 related instructions for RV32 " Weiwei Li
2022-02-28 19:38 ` Richard Henderson [this message]
2022-03-01 1:28 ` Weiwei Li
2022-02-28 14:48 ` [PATCH v7 10/14] target/riscv: rvk: add support for sha512 related instructions for RV64 " Weiwei Li
2022-02-28 19:40 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 11/14] target/riscv: rvk: add support for zksed/zksh extension Weiwei Li
2022-02-28 19:44 ` Richard Henderson
2022-02-28 14:48 ` [PATCH v7 12/14] target/riscv: rvk: add CSR support for Zkr Weiwei Li
2022-02-28 20:11 ` Richard Henderson
2022-03-01 1:44 ` Weiwei Li
2022-03-01 2:27 ` Weiwei Li
2022-03-01 15:59 ` Richard Henderson
2022-03-02 0:57 ` Weiwei Li
2022-02-28 14:48 ` [PATCH v7 13/14] disas/riscv.c: rvk: add disas support for Zbk* and Zk* instructions Weiwei Li
2022-02-28 14:48 ` [PATCH v7 14/14] target/riscv: rvk: expose zbk* and zk* properties Weiwei Li
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=ea054747-9c1b-4e0b-f084-6063d19207ca@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=lazyparser@gmail.com \
--cc=liweiwei@iscas.ac.cn \
--cc=luruibo2000@163.com \
--cc=lustrew@foxmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=wangjunqiang@iscas.ac.cn \
/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).