From: Richard Henderson <richard.henderson@linaro.org>
To: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>, qemu-devel@nongnu.org
Cc: arikalo@wavecomp.com, amarkovic@wavecomp.com, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH v2 6/6] target/mips: Add emulation of MMI instruction PEXCW
Date: Tue, 26 Feb 2019 09:14:02 -0800 [thread overview]
Message-ID: <c6fe88c6-3b20-7f3f-4274-d4a37102d40d@linaro.org> (raw)
In-Reply-To: <1551183797-13570-7-git-send-email-mateja.marjanovic@rt-rk.com>
On 2/26/19 4:23 AM, Mateja Marjanovic wrote:
> + } else if (rt == rd) {
> + TCGv_i64 t0 = tcg_temp_new();
> + TCGv_i64 t1 = tcg_temp_new();
> + uint64_t mask0 = (1ULL << 32) - 1;
> + uint64_t mask1 = mask0 << 32;
> +
> + tcg_gen_andi_i64(t0, cpu_gpr[rt], mask1);
> + tcg_gen_shri_i64(t0, t0, 32);
> + tcg_gen_andi_i64(t1, cpu_mmr[rt], mask0);
> + tcg_gen_shli_i64(t1, t1, 32);
> +
> + tcg_gen_and_i64(cpu_mmr[rd], cpu_mmr[rd], mask1);
> + tcg_gen_or_i64(cpu_mmr[rd], cpu_mmr[rd], t0);
> +
> + tcg_gen_and_i64(cpu_gpr[rd], cpu_gpr[rd], mask0);
> + tcg_gen_or_i64(cpu_gpr[rd], cpu_gpr[rd], t1);
> +
> + tcg_temp_free(t0);
> + tcg_temp_free(t1);
> + } else {
> + TCGv_i64 t0 = tcg_temp_new();
> + TCGv_i64 t1 = tcg_temp_new();
> + uint64_t mask0 = (1ULL << 32) - 1;
> + uint64_t mask1 = mask0 << 32;
> +
> + tcg_gen_andi_i64(t0, cpu_mmr[rt], mask1);
> + tcg_gen_andi_i64(t1, cpu_gpr[rt], mask1);
> + tcg_gen_shri_i64(t1, t1, 32);
> + tcg_gen_or_i64(cpu_mmr[rd], t0, t1);
> +
> + tcg_gen_andi_i64(t0, cpu_mmr[rt], mask0);
> + tcg_gen_shli_i64(t0, t0, 32);
> + tcg_gen_andi_i64(t1, cpu_gpr[rt], mask0);
> + tcg_gen_or_i64(cpu_gpr[rd], t0, t1);
> +
> + tcg_temp_free(t0);
> + tcg_temp_free(t1);
> + }
Likewise, why are you duplicating cases?
Also, this can be simplified with deposit:
tcg_gen_shri_i64(t0, cpu_gpr[rt], 32);
tcg_gen_deposit_i64(cpu_gpr[rd], cpu_gpr[rt], cpu_mmu[rt], 32, 32);
tcg_gen_deposit_i64(cpu_mmu[rd], cpu_mmu[rt], t0, 0, 32);
r~
prev parent reply other threads:[~2019-02-26 17:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-26 12:23 [Qemu-devel] [PATCH v2 0/6] target/mips: Add emulation of data communication MMI instructions Mateja Marjanovic
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 1/6] target/mips: Preparing for adding " Mateja Marjanovic
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 2/6] target/mips: Add emulation of MMI instruction PCPYH Mateja Marjanovic
2019-02-26 17:14 ` Richard Henderson
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 3/6] target/mips: Add emulation of MMI instruction PCPYLD Mateja Marjanovic
2019-02-26 17:01 ` Richard Henderson
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 4/6] target/mips: Add emulation of MMI instruction PCPYUD Mateja Marjanovic
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 5/6] target/mips: Add emulation of MMI instruction PEXCH Mateja Marjanovic
2019-02-26 17:06 ` Richard Henderson
2019-02-26 12:23 ` [Qemu-devel] [PATCH v2 6/6] target/mips: Add emulation of MMI instruction PEXCW Mateja Marjanovic
2019-02-26 17:14 ` Richard Henderson [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=c6fe88c6-3b20-7f3f-4274-d4a37102d40d@linaro.org \
--to=richard.henderson@linaro.org \
--cc=amarkovic@wavecomp.com \
--cc=arikalo@wavecomp.com \
--cc=aurelien@aurel32.net \
--cc=mateja.marjanovic@rt-rk.com \
--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).