From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
Huacai Chen <chenhuacai@kernel.org>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH 4/6] target/mips: Convert Loongson [D]DIVU.G opcodes to decodetree
Date: Thu, 21 Jan 2021 09:58:31 -1000 [thread overview]
Message-ID: <141e2343-1018-bba7-754e-abace2a646ee@linaro.org> (raw)
In-Reply-To: <20210112215504.2093955-5-f4bug@amsat.org>
On 1/12/21 11:55 AM, Philippe Mathieu-Daudé wrote:
> Convert DIVU.G (divide 32-bit unsigned integers) and DDIVU.G
> (divide 64-bit unsigned integers) opcodes to decodetree.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/mips/godson2.decode | 2 ++
> target/mips/loong-ext.decode | 2 ++
> target/mips/loong_translate.c | 55 +++++++++++++++++++++++++++++++++++
> target/mips/translate.c | 37 -----------------------
> 4 files changed, 59 insertions(+), 37 deletions(-)
>
> diff --git a/target/mips/godson2.decode b/target/mips/godson2.decode
> index b56a93a1999..0d5a72064d2 100644
> --- a/target/mips/godson2.decode
> +++ b/target/mips/godson2.decode
> @@ -14,4 +14,6 @@
> @rs_rt_rd ...... rs:5 rt:5 rd:5 ..... ...... &muldiv
>
> DIV.G 011111 ..... ..... ..... 00000 011010 @rs_rt_rd
> +DIVU.G 011111 ..... ..... ..... 00000 011011 @rs_rt_rd
> DDIV.G 011111 ..... ..... ..... 00000 011110 @rs_rt_rd
> +DDIVU.G 011111 ..... ..... ..... 00000 011111 @rs_rt_rd
> diff --git a/target/mips/loong-ext.decode b/target/mips/loong-ext.decode
> index 331c2226ae3..2e98262b81d 100644
> --- a/target/mips/loong-ext.decode
> +++ b/target/mips/loong-ext.decode
> @@ -16,3 +16,5 @@
>
> DIV.G 011100 ..... ..... ..... 00000 010100 @rs_rt_rd
> DDIV.G 011100 ..... ..... ..... 00000 010101 @rs_rt_rd
> +DIVU.G 011100 ..... ..... ..... 00000 010110 @rs_rt_rd
> +DDIVU.G 011100 ..... ..... ..... 00000 010111 @rs_rt_rd
> diff --git a/target/mips/loong_translate.c b/target/mips/loong_translate.c
> index 634d4ba8031..7b3304ec749 100644
> --- a/target/mips/loong_translate.c
> +++ b/target/mips/loong_translate.c
> @@ -92,6 +92,61 @@ static bool trans_DDIV_G(DisasContext *s, arg_muldiv *a)
> return gen_lext_DIV_G(s, a->rt, a->rs, a->rd, true);
> }
>
> +static bool gen_lext_DIVU_G(DisasContext *s, int rd, int rs, int rt,
> + bool is_double)
> +{
> + TCGv t0, t1;
> + TCGLabel *l1, *l2;
> +
> + if (is_double) {
> + if (TARGET_LONG_BITS != 64) {
> + return false;
> + }
> + check_mips_64(s);
> + }
> +
> + if (rd == 0) {
> + /* Treat as NOP. */
> + return true;
> + }
> +
> + t0 = tcg_temp_local_new();
> + t1 = tcg_temp_local_new();
> + l1 = gen_new_label();
> + l2 = gen_new_label();
> +
> + gen_load_gpr(t0, rs);
> + gen_load_gpr(t1, rt);
> +
> + if (!is_double) {
> + tcg_gen_ext32u_tl(t0, t0);
> + tcg_gen_ext32u_tl(t1, t1);
> + }
> + tcg_gen_brcondi_tl(TCG_COND_NE, t1, 0, l1);
> + tcg_gen_movi_tl(cpu_gpr[rd], 0);
> +
> + tcg_gen_br(l2);
> + gen_set_label(l1);
> + tcg_gen_divu_tl(cpu_gpr[rd], t0, t1);
> + tcg_gen_ext32s_tl(cpu_gpr[rd], cpu_gpr[rd]);
this extend should be conditional on !is_double.
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2021-01-21 20:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 21:54 [PATCH 0/6] target/mips: Convert Loongson LEXT opcodes to decodetree Philippe Mathieu-Daudé
2021-01-12 21:54 ` [PATCH 1/6] target/mips: Re-introduce OPC_ADDUH_QB_DSP and OPC_MUL_PH_DSP Philippe Mathieu-Daudé
2021-01-13 2:04 ` Jiaxun Yang
2021-01-21 19:50 ` Richard Henderson
2021-01-12 21:55 ` [PATCH 2/6] target/mips: Convert Loongson DDIV.G opcodes to decodetree Philippe Mathieu-Daudé
2021-01-21 19:54 ` Richard Henderson
2021-01-12 21:55 ` [PATCH 3/6] target/mips: Convert Loongson DIV.G " Philippe Mathieu-Daudé
2021-01-12 21:59 ` Philippe Mathieu-Daudé
2021-01-21 19:56 ` Richard Henderson
2021-01-12 21:55 ` [PATCH 4/6] target/mips: Convert Loongson [D]DIVU.G " Philippe Mathieu-Daudé
2021-01-21 19:58 ` Richard Henderson [this message]
2021-08-10 5:51 ` Philippe Mathieu-Daudé
2021-01-12 21:55 ` [PATCH 5/6] target/mips: Convert Loongson [D]MOD[U].G " Philippe Mathieu-Daudé
2021-01-21 20:00 ` Richard Henderson
2021-01-12 21:55 ` [PATCH 6/6] target/mips: Convert Loongson [D]MULT[U].G " Philippe Mathieu-Daudé
2021-01-21 20:06 ` Richard Henderson
2023-08-31 19:12 ` Philippe Mathieu-Daudé
2023-08-31 20:31 ` Philippe Mathieu-Daudé
2021-01-13 2:15 ` [PATCH 0/6] target/mips: Convert Loongson LEXT " Jiaxun Yang
2021-01-13 8:06 ` Philippe Mathieu-Daudé
2021-01-13 8:09 ` Philippe Mathieu-Daudé
2021-01-13 8:11 ` Jiaxun Yang
2021-01-21 20:07 ` Richard Henderson
2021-01-21 22:20 ` Philippe Mathieu-Daudé
2021-01-25 5:02 ` Jiaxun Yang
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=141e2343-1018-bba7-754e-abace2a646ee@linaro.org \
--to=richard.henderson@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=f4bug@amsat.org \
--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).