From: Richard Henderson <richard.henderson@linaro.org>
To: Song Gao <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: philmd@linaro.org, maobibo@loongson.cn, yangxiaojuan@loongson.cn,
c@jia.je
Subject: Re: [PATCH v2 6/8] target/loongarch: Add avail_LAM to check atomic instructions
Date: Fri, 11 Aug 2023 09:13:35 -0700 [thread overview]
Message-ID: <dc7bd910-fdff-74a8-12a2-0fd2cf814b9f@linaro.org> (raw)
In-Reply-To: <20230811100208.271649-7-gaosong@loongson.cn>
On 8/11/23 03:02, Song Gao wrote:
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
> target/loongarch/insn_trans/trans_atomic.c.inc | 12 ++++++++++++
> target/loongarch/translate.h | 1 +
> 2 files changed, 13 insertions(+)
>
> diff --git a/target/loongarch/insn_trans/trans_atomic.c.inc b/target/loongarch/insn_trans/trans_atomic.c.inc
> index 194818d74d..867d09375a 100644
> --- a/target/loongarch/insn_trans/trans_atomic.c.inc
> +++ b/target/loongarch/insn_trans/trans_atomic.c.inc
> @@ -9,6 +9,10 @@ static bool gen_ll(DisasContext *ctx, arg_rr_i *a, MemOp mop)
> TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
> TCGv t0 = make_address_i(ctx, src1, a->imm);
>
> + if (!avail_LAM(ctx)) {
> + return true;
> + }
> +
> tcg_gen_qemu_ld_i64(dest, t0, ctx->mem_idx, mop);
> tcg_gen_st_tl(t0, cpu_env, offsetof(CPULoongArchState, lladdr));
> tcg_gen_st_tl(dest, cpu_env, offsetof(CPULoongArchState, llval));
> @@ -25,6 +29,10 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop)
> TCGv t0 = tcg_temp_new();
> TCGv val = tcg_temp_new();
>
> + if (!avail_LAM(ctx)) {
> + return true;
> + }
> +
> TCGLabel *l1 = gen_new_label();
> TCGLabel *done = gen_new_label();
I think these two are wrong. LAM says "AM* atomic memory instructions".
I think LL/SC are always available.
>
> @@ -53,6 +61,10 @@ static bool gen_am(DisasContext *ctx, arg_rrr *a,
> TCGv addr = gpr_src(ctx, a->rj, EXT_NONE);
> TCGv val = gpr_src(ctx, a->rk, EXT_NONE);
>
> + if (!avail_LAM(ctx)) {
> + return true;
> + }
While correct, I think it would be better style to use LAM instead of ALL in the
TRANS(am*) instructions.
r~
next prev parent reply other threads:[~2023-08-11 16:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 10:02 [PATCH v2 0/8] Add some checks before translating instructions Song Gao
2023-08-11 10:02 ` [PATCH v2 1/8] target/loongarch: Fix loongarch_la464_initfn() misses setting LSPW Song Gao
2023-08-11 10:02 ` [PATCH v2 2/8] target/loongarch: Add a check parameter to the TRANS macro Song Gao
2023-08-11 15:23 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 3/8] target/loongarch: Add avail_64 to check la64-only instructions Song Gao
2023-08-11 16:00 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 4/8] target/loongarch: Add avail_FP/FP_SP/FP_DP to check fpu instructions Song Gao
2023-08-11 16:09 ` Richard Henderson
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 5/8] target/loongarch: Add avail_LSPW to check LSPW instructions Song Gao
2023-08-11 16:10 ` Richard Henderson
2023-08-11 10:02 ` [PATCH v2 6/8] target/loongarch: Add avail_LAM to check atomic instructions Song Gao
2023-08-11 16:13 ` Richard Henderson [this message]
2023-08-14 8:28 ` gaosong
2023-08-11 10:02 ` [PATCH v2 7/8] target/loongarch: Add avail_LSX to check LSX instructions Song Gao
2023-08-11 16:15 ` Richard Henderson
2023-08-11 10:02 ` [PATCH v2 8/8] target/loongarch: Add avail_IOCSR to check iocsr instructions Song Gao
2023-08-11 16:17 ` 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=dc7bd910-fdff-74a8-12a2-0fd2cf814b9f@linaro.org \
--to=richard.henderson@linaro.org \
--cc=c@jia.je \
--cc=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yangxiaojuan@loongson.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).