From: Richard Henderson <richard.henderson@linaro.org>
To: "Víctor Colombo" <victor.colombo@eldorado.org.br>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: clg@kaod.org, danielhb413@gmail.com, david@gibson.dropbear.id.au,
groug@kaod.org, Matheus Ferst <matheus.ferst@eldorado.org.br>
Subject: Re: [PATCH RESEND 08/10] target/ppc: implement addg6s
Date: Tue, 17 May 2022 12:05:29 -0700 [thread overview]
Message-ID: <7a82db21-a788-d5cd-8e03-938a494e4411@linaro.org> (raw)
In-Reply-To: <20220517164744.58131-9-victor.colombo@eldorado.org.br>
On 5/17/22 09:47, Víctor Colombo wrote:
> +static bool trans_ADDG6S(DisasContext *ctx, arg_X *a)
> +{
> + const uint64_t nibbles = 0x0f0f0f0f0f0f0f0fULL,
> + carry_bits = 0x1010101010101010ULL;
> + TCGv t0, t1, t2;
> +
> + REQUIRE_INSNS_FLAGS2(ctx, BCDA_ISA206);
> +
> + t0 = tcg_temp_new();
> + t1 = tcg_temp_new();
> + t2 = tcg_temp_new();
> +
> + tcg_gen_andi_tl(t0, cpu_gpr[a->ra], nibbles);
> + tcg_gen_andi_tl(t1, cpu_gpr[a->rb], nibbles);
> + tcg_gen_add_tl(t0, t0, t1);
> + tcg_gen_andi_tl(t0, t0, carry_bits);
> + tcg_gen_shri_tl(t0, t0, 4);
> +
> + tcg_gen_shri_tl(t1, cpu_gpr[a->ra], 4);
> + tcg_gen_shri_tl(t2, cpu_gpr[a->rb], 4);
> + tcg_gen_andi_tl(t1, t1, nibbles);
> + tcg_gen_andi_tl(t2, t2, nibbles);
> + tcg_gen_add_tl(t1, t1, t2);
> + tcg_gen_andi_tl(t1, t1, carry_bits);
> +
> + tcg_gen_or_tl(t0, t0, t1);
> + tcg_gen_muli_tl(cpu_gpr[a->rt], t0, 6);
You're supposed to produce a 6 when the carry bit is *not* set.
You need to invert the result of the add before masking w/ carry_bits.
Perhaps
tcg_gen_add_tl(t0, t0, t1);
tcg_gen_andc_tl(t0, carry_bits, t0);
r~
next prev parent reply other threads:[~2022-05-17 19:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 16:47 [PATCH RESEND 00/10] BCDA and mffscdrn implementations Víctor Colombo
2022-05-17 16:47 ` [PATCH RESEND 01/10] target/ppc: Fix insn32.decode style issues Víctor Colombo
2022-05-17 18:25 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 02/10] target/ppc: Move mffs[.] to decodetree Víctor Colombo
2022-05-17 18:30 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 03/10] target/ppc: Move mffsl " Víctor Colombo
2022-05-17 18:30 ` Richard Henderson
2022-05-17 18:45 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 04/10] target/ppc: Move mffsce " Víctor Colombo
2022-05-17 18:49 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 05/10] target/ppc: Move mffscrn[i] " Víctor Colombo
2022-05-17 16:47 ` [PATCH RESEND 06/10] target/ppc: Implement mffscdrn[i] instructions Víctor Colombo
2022-05-17 18:52 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 07/10] target/ppc: Add flag for ISA v2.06 BCDA instructions Víctor Colombo
2022-05-17 18:54 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 08/10] target/ppc: implement addg6s Víctor Colombo
2022-05-17 19:05 ` Richard Henderson [this message]
2022-05-17 16:47 ` [PATCH RESEND 09/10] target/ppc: implement cbcdtd Víctor Colombo
2022-05-17 19:10 ` Richard Henderson
2022-05-17 16:47 ` [PATCH RESEND 10/10] target/ppc: implement cdtbcd Víctor Colombo
2022-05-17 19:12 ` 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=7a82db21-a788-d5cd-8e03-938a494e4411@linaro.org \
--to=richard.henderson@linaro.org \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=matheus.ferst@eldorado.org.br \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=victor.colombo@eldorado.org.br \
/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).