From: Richard Henderson <richard.henderson@linaro.org>
To: Song Gao <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>, laurent@vivier.eu
Subject: Re: [PATCH v11 07/26] target/loongarch: Add fixed point load/store instruction translation
Date: Sat, 20 Nov 2021 09:20:07 +0100 [thread overview]
Message-ID: <52e99aaa-1fa3-7b54-76e8-2ba4df4853fa@linaro.org> (raw)
In-Reply-To: <1637302410-24632-8-git-send-email-gaosong@loongson.cn>
On 11/19/21 7:13 AM, Song Gao wrote:
> DEF_HELPER_FLAGS_1(bitswap, TCG_CALL_NO_RWG_SE, tl, tl)
> +
> +DEF_HELPER_3(asrtle_d, void, env, tl, tl)
> +DEF_HELPER_3(asrtgt_d, void, env, tl, tl)
Use DEF_HELPER_FLAGS_3 and TCG_CALL_NO_WG.
(They do not write globals, but do implicitly read them via the exception path, and of
course the exception is a side-effect.)
> +static bool gen_load_gt(DisasContext *ctx, arg_rrr *a, MemOp mop)
> +{
> + TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
> + TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
> + TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE);
> + TCGv addr = tcg_temp_new();
> +
> + gen_helper_asrtgt_d(cpu_env, src1, src2);
> + tcg_gen_add_tl(addr, src1, src2);
> + tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, mop);
This add is incorrect. The address is rj (src1).
Likewise for the rest of the bound check memory ops.
> +static bool gen_ldptr(DisasContext *ctx, arg_rr_i *a, MemOp mop)
> +{
> + TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
> + TCGv addr = gpr_src(ctx, a->rj, EXT_NONE);
> + TCGv temp = NULL;
> +
> + if (a->imm) {
> + temp = tcg_temp_new();
> + tcg_gen_addi_tl(temp, addr, a->imm << 2);
> + addr = temp;
> + }
I think it would be cleaner to have this immediate shift handled by decodetree, so that
gen_ldptr is dropped in favor of gen_load (and also for stores). It would also print the
correct logical offset on the disassembly side.
%i14s2 10:s14 !function=shl_2
@rr_i14s2 .... .... .............. rj:5 rd:5 &rr_i imm=%i14s2
> +/* loongarch sync */
> +static void gen_loongarch_sync(int stype)
> +{
> + TCGBar tcg_mo = TCG_BAR_SC;
> +
> + switch (stype) {
> + case 0x4: /* SYNC_WMB */
> + tcg_mo |= TCG_MO_ST_ST;
> + break;
> + case 0x10: /* SYNC_MB */
> + tcg_mo |= TCG_MO_ALL;
> + break;
> + case 0x11: /* SYNC_ACQUIRE */
> + tcg_mo |= TCG_MO_LD_LD | TCG_MO_LD_ST;
> + break;
> + case 0x12: /* SYNC_RELEASE */
> + tcg_mo |= TCG_MO_ST_ST | TCG_MO_LD_ST;
> + break;
> + case 0x13: /* SYNC_RMB */
> + tcg_mo |= TCG_MO_LD_LD;
> + break;
> + default:
> + tcg_mo |= TCG_MO_ALL;
> + break;
> + }
> +
> + tcg_gen_mb(tcg_mo);
> +}
This is copied from mips, I think. The only defined hint for dbar is 0. I think this
function should be removed, and just emit the tcg barrier directly within trans_dbar.
r~
next prev parent reply other threads:[~2021-11-20 8:21 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 6:13 [PATCH v11 00/26] Add LoongArch linux-user emulation support Song Gao
2021-11-19 6:13 ` [PATCH v11 01/26] target/loongarch: Add README Song Gao
2021-11-19 6:13 ` [PATCH v11 02/26] target/loongarch: Add core definition Song Gao
2021-11-19 6:13 ` [PATCH v11 03/26] target/loongarch: Add main translation routines Song Gao
2021-11-19 6:13 ` [PATCH v11 04/26] target/loongarch: Add fixed point arithmetic instruction translation Song Gao
2021-11-20 7:10 ` Richard Henderson
2021-11-20 7:17 ` Richard Henderson
2021-11-20 8:52 ` gaosong
2021-11-20 8:56 ` Richard Henderson
2021-11-22 8:23 ` gaosong
2021-11-22 8:28 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 05/26] target/loongarch: Add fixed point shift " Song Gao
2021-11-20 7:42 ` Richard Henderson
2021-11-20 9:03 ` gaosong
2021-11-19 6:13 ` [PATCH v11 06/26] target/loongarch: Add fixed point bit " Song Gao
2021-11-20 8:05 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 07/26] target/loongarch: Add fixed point load/store " Song Gao
2021-11-20 8:20 ` Richard Henderson [this message]
2021-11-20 9:39 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 08/26] target/loongarch: Add fixed point atomic " Song Gao
2021-11-20 8:30 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 09/26] target/loongarch: Add fixed point extra " Song Gao
2021-11-20 8:52 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 10/26] target/loongarch: Add floating point arithmetic " Song Gao
2021-11-20 8:54 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 11/26] target/loongarch: Add floating point comparison " Song Gao
2021-11-20 9:02 ` Richard Henderson
2021-11-30 8:22 ` gaosong
2021-11-30 8:37 ` Richard Henderson
2021-11-30 8:50 ` gaosong
2021-11-19 6:13 ` [PATCH v11 12/26] target/loongarch: Add floating point conversion " Song Gao
2021-11-19 6:13 ` [PATCH v11 13/26] target/loongarch: Add floating point move " Song Gao
2021-11-19 6:13 ` [PATCH v11 14/26] target/loongarch: Add floating point load/store " Song Gao
2021-11-20 9:36 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 15/26] target/loongarch: Add branch " Song Gao
2021-11-20 9:46 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 16/26] target/loongarch: Add disassembler Song Gao
2021-11-20 9:53 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 17/26] linux-user: Add LoongArch generic header files Song Gao
2021-11-20 9:54 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 18/26] linux-user: Add LoongArch specific structures Song Gao
2021-11-20 10:06 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 19/26] linux-user: Add LoongArch signal support Song Gao
2021-11-20 10:33 ` Richard Henderson
2021-11-22 11:41 ` gaosong
2021-11-22 11:44 ` chen huacai
2021-11-22 12:31 ` Richard Henderson
2021-11-24 2:46 ` gaosong
2021-11-24 7:27 ` Richard Henderson
2021-11-24 7:50 ` gaosong
2021-11-24 9:40 ` Richard Henderson
2021-11-24 10:22 ` gaosong
2021-11-24 10:44 ` Richard Henderson
2021-11-25 3:03 ` gaosong
2021-11-25 10:11 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 20/26] linux-user: Add LoongArch elf support Song Gao
2021-11-20 10:35 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 21/26] linux-user: Add LoongArch syscall support Song Gao
2021-11-20 10:47 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 22/26] linux-user: Add LoongArch cpu_loop support Song Gao
2021-11-20 10:53 ` Richard Henderson
2021-11-19 6:13 ` [PATCH v11 23/26] default-configs: Add loongarch linux-user support Song Gao
2021-11-19 6:13 ` [PATCH v11 24/26] target/loongarch: Add target build suport Song Gao
2021-11-19 6:13 ` [PATCH v11 25/26] target/loongarch: 'make check-tcg' support Song Gao
2021-11-19 6:13 ` [PATCH v11 26/26] scripts: add loongarch64 binfmt config Song Gao
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=52e99aaa-1fa3-7b54-76e8-2ba4df4853fa@linaro.org \
--to=richard.henderson@linaro.org \
--cc=gaosong@loongson.cn \
--cc=laurent@vivier.eu \
--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).