From: Richard Henderson <richard.henderson@linaro.org>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>,
qemu-devel@nongnu.org
Cc: anton.kochkov@proton.me
Subject: Re: [PATCH 02/10] target/tricore: Implement CRCN insn
Date: Sat, 26 Aug 2023 21:33:27 -0700 [thread overview]
Message-ID: <ef33adde-54fa-5e21-e15b-971e981dab8b@linaro.org> (raw)
In-Reply-To: <20230826160242.312052-3-kbastian@mail.uni-paderborn.de>
On 8/26/23 09:02, Bastian Koppelmann wrote:
> +static uint32_t crc_div(uint32_t crc_in, uint32_t data, uint32_t gen,
> + uint32_t n, uint32_t m)
> +{
> + uint32_t i;
> +
> + data = data << n;
> + data = deposit32(data, m, 32 - m, 0);
This is data = extract32(data, 0, m), however...
> + for (i = 0; i < m; i++) {
> +
> + if (crc_in & (1u << (n - 1))) {
> + crc_in <<= 1;
> + if (data & (1u << (m - 1))) {
You only check a single bit of data here, always bit m-1.
> + crc_in++;
> + }
> + crc_in ^= gen;
> + } else {
> + crc_in <<= 1;
> + if (data & (1u << (m - 1))) {
> + crc_in++;
> + }
> + }
> + data <<= 1;
> + data = deposit32(data, m, 32 - m, 0);
So why do you need to keep bits above m clear?
I think you should just shift left and let bits fall off the left naturally.
> + return deposit32(crc_out, n, 32 - n, 0);
extract32(crc_out, 0, n);
> +}
> +
> uint32_t helper_shuffle(uint32_t arg0, uint32_t arg1)
> {
> uint32_t resb;
> diff --git a/target/tricore/translate.c b/target/tricore/translate.c
> index 1947733870..bb7dad75d6 100644
> --- a/target/tricore/translate.c
> +++ b/target/tricore/translate.c
> @@ -6673,6 +6673,12 @@ static void decode_rrr_divide(DisasContext *ctx)
> gen_helper_pack(cpu_gpr_d[r4], cpu_PSW_C, cpu_gpr_d[r3],
> cpu_gpr_d[r3+1], cpu_gpr_d[r1]);
> break;
> + case OPC2_32_RRR_CRCN:
> + if (has_feature(ctx, TRICORE_FEATURE_162)) {
> + gen_helper_crcn(cpu_gpr_d[r4], cpu_gpr_d[r1], cpu_gpr_d[r2],
> + cpu_gpr_d[r3]);
> + }
> + break;
trap if not feature 162.
r~
next prev parent reply other threads:[~2023-08-27 4:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 16:02 [PATCH 00/10] TriCore 1.6.2 insn and bugfixes Bastian Koppelmann
2023-08-26 16:02 ` [PATCH 01/10] tests/tcg/tricore: Bump cpu to tc37x Bastian Koppelmann
2023-08-27 4:23 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 02/10] target/tricore: Implement CRCN insn Bastian Koppelmann
2023-08-27 4:33 ` Richard Henderson [this message]
2023-08-26 16:02 ` [PATCH 03/10] target/tricore: Correctly handle FPU RM from PSW Bastian Koppelmann
2023-08-27 4:37 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 04/10] target/tricore: Implement FTOU insn Bastian Koppelmann
2023-08-27 4:50 ` Richard Henderson
2023-08-27 11:07 ` Bastian Koppelmann
2023-08-27 14:49 ` Richard Henderson
2023-08-27 16:36 ` Bastian Koppelmann
2023-08-27 18:32 ` Richard Henderson
2023-08-27 18:59 ` Bastian Koppelmann
2023-08-26 16:02 ` [PATCH 05/10] target/tricore: Implement ftohp insn Bastian Koppelmann
2023-08-27 4:55 ` Richard Henderson
2023-08-27 7:09 ` Bastian Koppelmann
2023-08-27 14:51 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 06/10] target/tricore: Implement hptof insn Bastian Koppelmann
2023-08-27 4:56 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 07/10] target/tricore: Fix RCPW/RRPW_INSERT insns for width = 0 Bastian Koppelmann
2023-08-27 4:59 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 08/10] target/tricore: Swap src and dst reg for RCRR_INSERT Bastian Koppelmann
2023-08-27 5:06 ` Richard Henderson
2023-08-27 7:18 ` Bastian Koppelmann
2023-08-26 16:02 ` [PATCH 09/10] target/tricore: Replace cpu_*_code with translator_* Bastian Koppelmann
2023-08-27 5:06 ` Richard Henderson
2023-08-26 16:02 ` [PATCH 10/10] target/tricore: Fix FTOUZ being ISA v1.3.1 up Bastian Koppelmann
2023-08-27 5:06 ` 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=ef33adde-54fa-5e21-e15b-971e981dab8b@linaro.org \
--to=richard.henderson@linaro.org \
--cc=anton.kochkov@proton.me \
--cc=kbastian@mail.uni-paderborn.de \
--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).