From: Leon Alrae <leon.alrae@imgtec.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>, qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH] mips: Fix the 64-bit case for microMIPS MOVE16 and MOVEP
Date: Mon, 24 Nov 2014 11:31:45 +0000 [thread overview]
Message-ID: <54731721.9020104@imgtec.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1411120328290.2881@tp.orcam.me.uk>
On 12/11/2014 15:21, Maciej W. Rozycki wrote:
> Fix microMIPS MOVE16 and MOVEP instructions on 64-bit processors by
> using register addition operations.
>
> This copies the approach taken with MIPS16 MOVE instructions (I8_MOV32R
> and I8_MOVR32 opcodes) and follows the observation that OPC_ADDU expands
> to tcg_gen_mov_tl whenever `rt' is 0 and `rs' is not, therefore copying
> `rs' to `rd' verbatim. This is not the case with OPC_ADDIU where a
> sign-extension from bit #31 is made, unless in the uninteresting case of
> `rs' being 0, losing the upper 32 bits of the value copied for any
> proper 64-bit values.
>
> This also serves as an optimization as one op is produced in generated
> code rather than two (again, unless `rs' is 0, where it doesn't change
> anything).
>
> Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
> ---
> This is rather obvious, but I also pushed it through full bare-iron GCC
> regression testing with an o32 big-endian microMIPS multilib. That
> includes several instances of both instructions. No changes in results
> were observed with the patch applied compared to the original version.
>
> I wonder if all these move operations shouldn't actually be switched to
> using OPC_OR that is agnostic to the machine word size regardless of the
> operand selection. But that is something to consider separately.
>
> So meanwhile, please apply.
>
> Maciej
>
> qemu-umips-move.diff
> Index: qemu-git-trunk/target-mips/translate.c
> ===================================================================
> --- qemu-git-trunk.orig/target-mips/translate.c 2014-11-02 17:57:16.998924336 +0000
> +++ qemu-git-trunk/target-mips/translate.c 2014-11-02 17:57:19.498930155 +0000
> @@ -13492,8 +13492,8 @@ static int decode_micromips_opc (CPUMIPS
> rs = rs_rt_enc[enc_rs];
> rt = rs_rt_enc[enc_rt];
>
> - gen_arith_imm(ctx, OPC_ADDIU, rd, rs, 0);
> - gen_arith_imm(ctx, OPC_ADDIU, re, rt, 0);
> + gen_arith(ctx, OPC_ADDU, rd, rs, 0);
> + gen_arith(ctx, OPC_ADDU, re, rt, 0);
> }
> break;
> case LBU16:
> @@ -13574,7 +13574,7 @@ static int decode_micromips_opc (CPUMIPS
> int rd = uMIPS_RD5(ctx->opcode);
> int rs = uMIPS_RS5(ctx->opcode);
>
> - gen_arith_imm(ctx, OPC_ADDIU, rd, rs, 0);
> + gen_arith(ctx, OPC_ADDU, rd, rs, 0);
> }
> break;
> case ANDI16:
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
All the patches up to this one have been applied to mips-next branch
(available at git://github.com/lalrae/qemu.git), thanks. I'll go through
the remaining soon.
Regards,
Leon
next prev parent reply other threads:[~2014-11-24 11:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 15:21 [Qemu-devel] [PATCH] mips: Fix the 64-bit case for microMIPS MOVE16 and MOVEP Maciej W. Rozycki
2014-11-12 18:17 ` Andreas Färber
2014-11-12 18:46 ` Maciej W. Rozycki
2014-11-13 10:26 ` Leon Alrae
2014-11-13 15:15 ` Maciej W. Rozycki
2014-11-24 11:31 ` Leon Alrae [this message]
2014-12-01 13:17 ` Maciej W. Rozycki
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=54731721.9020104@imgtec.com \
--to=leon.alrae@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=macro@codesourcery.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.