From: Richard Henderson <richard.henderson@linaro.org>
To: Jiajie Chen <c@jia.je>, qemu-devel@nongnu.org
Cc: gaosong@loongson.cn, git@xen0n.name
Subject: Re: [PATCH 3/5] target/loongarch: Add amcas[_db].{b/h/w/d}
Date: Mon, 23 Oct 2023 15:59:06 -0700 [thread overview]
Message-ID: <bb63dd8a-50e5-4b79-9645-ae5e8ab9918f@linaro.org> (raw)
In-Reply-To: <20231023153029.269211-5-c@jia.je>
On 10/23/23 08:29, Jiajie Chen wrote:
> +static bool gen_cas(DisasContext *ctx, arg_rrr *a,
> + void (*func)(TCGv, TCGv, TCGv, TCGv, TCGArg, MemOp),
> + MemOp mop)
> +{
> + TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
> + TCGv addr = gpr_src(ctx, a->rj, EXT_NONE);
> + TCGv val = gpr_src(ctx, a->rk, EXT_NONE);
> +
> + addr = make_address_i(ctx, addr, 0);
> +
> + func(dest, addr, dest, val, ctx->mem_idx, mop);
You need
TCGv old = gpr_src(ctx, a->rd, EXT_NONE);
func(dest, addr, old, val, ...);
as otherwise rd=0 will abort.
Correct emulation requires that you perform the memory operation, and then discard the
result. But you must provide the (initialized) source of zero for that case.
Do any or all of the AM, LL, SC instructions require aligned memory?
I suspect that they do.
I think probably gen_ll, gen_sc, gen_am, and now gen_cas are missing "mop | MO_ALIGN"
applied to the memory operation(s).
r~
next prev parent reply other threads:[~2023-10-23 22:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 15:29 [PATCH 0/5] Add LoongArch v1.1 instructions Jiajie Chen
2023-10-23 15:29 ` [PATCH 1/5] include/exec/memop.h: Add MO_TESB Jiajie Chen
2023-10-23 15:49 ` David Hildenbrand
2023-10-23 15:52 ` Jiajie Chen
2023-10-23 15:29 ` [PATCH 2/5] target/loongarch: Add am{swap/add}[_db].{b/h} Jiajie Chen
2023-10-23 22:50 ` Richard Henderson
2023-10-23 15:29 ` [PATCH 3/5] target/loongarch: Add amcas[_db].{b/h/w/d} Jiajie Chen
2023-10-23 15:35 ` Jiajie Chen
2023-10-23 23:00 ` Richard Henderson
2023-10-23 22:59 ` Richard Henderson [this message]
2023-10-23 15:29 ` [PATCH 4/5] target/loongarch: Add estimated reciprocal instructions Jiajie Chen
2023-10-23 23:02 ` Richard Henderson
2023-10-23 15:29 ` [PATCH 5/5] target/loongarch: Add llacq/screl instructions Jiajie Chen
2023-10-23 23:19 ` Richard Henderson
2023-10-23 23:26 ` [PATCH 0/5] Add LoongArch v1.1 instructions Richard Henderson
2023-10-24 6:10 ` Jiajie Chen
2023-10-25 17:13 ` Jiajie Chen
2023-10-25 19:04 ` Richard Henderson
2023-10-26 1:38 ` Jiajie Chen
2023-10-26 6:54 ` gaosong
2023-10-28 13:09 ` Jiajie Chen
2023-10-30 8:23 ` gaosong
2023-10-30 11:54 ` Jiajie Chen
2023-10-31 9:11 ` gaosong
2023-10-31 9:13 ` Jiajie Chen
2023-10-31 11:06 ` gaosong
2023-10-31 11:10 ` Jiajie Chen
2023-10-31 12:12 ` gaosong
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=bb63dd8a-50e5-4b79-9645-ae5e8ab9918f@linaro.org \
--to=richard.henderson@linaro.org \
--cc=c@jia.je \
--cc=gaosong@loongson.cn \
--cc=git@xen0n.name \
--cc=qemu-devel@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).