From: Richard Henderson <richard.henderson@linaro.org>
To: Philipp Tomsich <philipp.tomsich@vrull.eu>, qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, Bin Meng <bin.meng@windriver.com>,
Greg Favor <gfavor@ventanamicro.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Kito Cheng <kito.cheng@sifive.com>
Subject: Re: [PATCH v2 2/2] target/riscv: Add XVentanaCondOps custom extension
Date: Wed, 26 Jan 2022 08:42:47 +1100 [thread overview]
Message-ID: <279dadc7-496b-6b04-a011-b5eb27162cf7@linaro.org> (raw)
In-Reply-To: <20220113202033.3320854-2-philipp.tomsich@vrull.eu>
On 1/14/22 7:20 AM, Philipp Tomsich wrote:
> new file mode 100644
> index 0000000000..b8a5d031b5
> --- /dev/null
> +++ b/target/riscv/insn_trans/trans_xventanacondops.inc
The filename suffix should be ".c.inc".
> +static bool gen_condmask(DisasContext *ctx, arg_r *a, TCGCond cond)
> +{
> + TCGv dest = dest_gpr(ctx, a->rd);
> + TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
> + TCGv src2 = get_gpr(ctx, a->rs2, EXT_NONE);
> +
> + tcg_gen_movcond_tl(cond, dest, src2, ctx->zero, src1, ctx->zero);
> +
> + gen_set_gpr(ctx, a->rd, dest);
> + return true;
> +}
> +
> +static bool trans_vt_maskc(DisasContext *ctx, arg_r *a)
> +{
> + return gen_condmask(ctx, a, TCG_COND_NE);
> +}
> +
> +static bool trans_vt_maskcn(DisasContext *ctx, arg_r *a)
> +{
> + return gen_condmask(ctx, a, TCG_COND_EQ);
> +}
Implementation looks good.
> +#define MATERIALISE_EXT_PREDICATE(ext) \
> + static inline bool has_ ## ext ## _p(CPURISCVState *env, \
> + DisasContext *ctx __attribute__((__unused__))) \
> + { \
> + return RISCV_CPU(ctx->cs)->cfg.ext_ ## ext ; \
> + }
Again, no inline.
Don't look back to RISCV_CPU here. We shouldn't even have access to that here, as it
leads to temptation to do invalid things at translation time (this isn't one of them,
since it only accesses constant state). What we have been doing is copying ext_foo into
DisasContext in riscv_tr_init_disas_context. Though it might be time to revisit that.
Perhaps give the cpu->cfg structure type a name, e.g. RISCVCPUConfig. Add "const
RISCVCPUConfig *cfg" to DisasContext and copy the pointer across in init_disas_context.
r~
next prev parent reply other threads:[~2022-01-25 21:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 20:20 [PATCH v2 1/2] target/riscv: iterate over a table of decoders Philipp Tomsich
2022-01-13 20:20 ` [PATCH v2 2/2] target/riscv: Add XVentanaCondOps custom extension Philipp Tomsich
2022-01-18 22:53 ` Alistair Francis
2022-01-18 23:21 ` Philipp Tomsich
2022-01-19 1:19 ` Alistair Francis
2022-01-19 1:30 ` Alistair Francis
2022-01-20 15:37 ` Philipp Tomsich
2022-01-21 3:02 ` Alistair Francis
2022-01-19 11:17 ` Philippe Mathieu-Daudé via
2022-01-20 15:24 ` Philipp Tomsich
2022-01-25 21:42 ` Richard Henderson [this message]
2022-01-19 11:30 ` [PATCH v2 1/2] target/riscv: iterate over a table of decoders Philippe Mathieu-Daudé via
2022-01-20 20:05 ` Philipp Tomsich
2022-01-25 21:28 ` 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=279dadc7-496b-6b04-a011-b5eb27162cf7@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=gfavor@ventanamicro.com \
--cc=kito.cheng@sifive.com \
--cc=palmer@dabbelt.com \
--cc=philipp.tomsich@vrull.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
/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).