From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Djordje Todorovic <Djordje.Todorovic@htecgroup.com>,
"cfu@mips.com" <cfu@mips.com>,
"arikalo@gmail.com" <arikalo@gmail.com>,
"peter.maydell@linaro.org" <peter.maydell@linaro.org>
Subject: Re: [PATCH v2 2/8] Add support for emulation of CRC32 instructions
Date: Sun, 20 Oct 2024 15:41:47 -0300 [thread overview]
Message-ID: <a79706ef-9c53-4fb8-857c-e49475a55405@linaro.org> (raw)
In-Reply-To: <AM9PR09MB4851159EEED6EFB71176524684402@AM9PR09MB4851.eurprd09.prod.outlook.com>
Hi Aleksandar,
On 18/10/24 10:19, Aleksandar Rakic wrote:
> Add emulation of MIPS' CRC32 (Cyclic Redundancy Check) instructions.
> Reuse zlib crc32() and Linux crc32c().
>
> Cherry-picked 4cc974938aee1588f852590509004e340c072940
> from https://github.com/MIPS/gnutools-qemu
>
> Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> Signed-off-by: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
> ---
> target/mips/helper.h | 2 ++
> target/mips/meson.build | 1 +
> target/mips/tcg/op_helper.c | 26 ++++++++++++++++++++++++++
> target/mips/tcg/translate.c | 37 +++++++++++++++++++++++++++++++++++++
> target/mips/tcg/translate.h | 1 +
> 5 files changed, 67 insertions(+)
> diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
> index 333469b268..256fa0893e 100644
> --- a/target/mips/tcg/translate.c
> +++ b/target/mips/tcg/translate.c
> @@ -430,6 +430,7 @@ enum {
> OPC_LWE = 0x2F | OPC_SPECIAL3,
>
> /* R6 */
> + OPC_CRC32 = 0x0F | OPC_SPECIAL3,
> R6_OPC_PREF = 0x35 | OPC_SPECIAL3,
> R6_OPC_CACHE = 0x25 | OPC_SPECIAL3,
> R6_OPC_LL = 0x36 | OPC_SPECIAL3,
> @@ -13705,6 +13730,17 @@ static void decode_opc_special3_r6(CPUMIPSState *env, DisasContext *ctx)
>
> op1 = MASK_SPECIAL3(ctx->opcode);
> switch (op1) {
> + case OPC_CRC32:
> + if (unlikely(!ctx->crcp) ||
> + unlikely((extract32(ctx->opcode, 6, 2) == 3) &&
> + (!(ctx->hflags & MIPS_HFLAG_64))) ||
> + unlikely((extract32(ctx->opcode, 8, 3) >= 2))) {
> + gen_reserved_instruction(ctx);
> + }
> + gen_crc32(ctx, rt, rs, rt,
> + extract32(ctx->opcode, 6, 2),
> + extract32(ctx->opcode, 8, 3));
> + break;
New opcode must be implemented in decodetree format, please
add these in target/mips/tcg/rel6* files (the change should be
trivial and should only involve modifying few lines -- see for
example commit 675bf34a6fe and around).
Thanks,
Phil.
prev parent reply other threads:[~2024-10-20 18:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 13:19 [PATCH v2 2/8] Add support for emulation of CRC32 instructions Aleksandar Rakic
2024-10-19 7:44 ` Aleksandar Rikalo
2024-10-20 18:41 ` Philippe Mathieu-Daudé [this message]
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=a79706ef-9c53-4fb8-857c-e49475a55405@linaro.org \
--to=philmd@linaro.org \
--cc=Djordje.Todorovic@htecgroup.com \
--cc=aleksandar.rakic@htecgroup.com \
--cc=arikalo@gmail.com \
--cc=cfu@mips.com \
--cc=peter.maydell@linaro.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).