qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: James Hogan <james.hogan@imgtec.com>, qemu-devel@nongnu.org
Cc: Leon Alrae <leon.alrae@imgtec.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH 6/7] tcg/mips: Support full movcond select operation
Date: Thu, 1 Oct 2015 06:56:39 +1000	[thread overview]
Message-ID: <560C4C87.7070707@twiddle.net> (raw)
In-Reply-To: <1443627027-2193-7-git-send-email-james.hogan@imgtec.com>

On 10/01/2015 01:30 AM, James Hogan wrote:
> Adapt the MIPS movcond implementation to handle the full select
> operation using a pair of MOVN/MOVZ instructions.
>
> This allows the register alias constraint to be removed (which is what
> ensured v2 == dest), and allows it to be more easily extended to support
> the MIPS r6 instructions SELNEZ/SELEQZ which replace MOVN/MOVZ and
> require similar logic.
>
> For example, previously we only supported:
>   movcond_i32 dest, c1, c2, v1, v2=dest, cond
>
> With the host code:
>   MOV[ZN] dest, v1, [!](c1 cond c2)
>
> Meaning:
>   if (c1 cond c2)
>       dest = v1;
>
> But now v2 doesn't have to equal dest, so we can support:
>   movcond_i32 dest, c1, c2, v1, v2, cond
>
> With the host code:
>   #if dest != v1
>       MOV[ZN] dest, v1, [!](c1 cond c2)
>   #endif
>   #if dest != v2
>       MOV[NZ] dest, v1, ![!](c1 cond c2)
>   #endif
>
> Meaning:
>   #if dest != v1
>       if ([!](c1 cond c2))
>           dest = v1;
>   #endif
>   #if dest != v2
>       if (![!](c1 cond c2))
>           dest = v2;
>   #endif

I don't think this is a good change.  In the case of dest != v1 && dest != v2, 
we wind up with two conditional instructions.  On most targets that I'm 
familiar with, this is more expensive than a plain move.

If r6 was conditional, as opposed to something that we must perforce know about 
at compilation time, then I'd say go ahead but split this into a normal move 
followed by a conditional move.  But since that's not the case, I don't see the 
point in changing anything at all.


r~

  reply	other threads:[~2015-09-30 20:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 15:30 [Qemu-devel] [PATCH 0/7] tcg/mips: Minimal R6 support James Hogan
2015-09-30 15:30 ` [Qemu-devel] [PATCH 1/7] tcg-opc.h: Simplify debug_insn_start def James Hogan
2015-09-30 20:47   ` Richard Henderson
2015-09-30 15:30 ` [Qemu-devel] [PATCH 2/7] disas/mips: Add R6 jr/jr.hb to disassembler James Hogan
2015-09-30 15:30 ` [Qemu-devel] [PATCH 3/7] tcg/mips: Add use_mips32r6_instructions definition James Hogan
2015-09-30 20:48   ` Richard Henderson
2015-09-30 15:30 ` [Qemu-devel] [PATCH 4/7] tcg/mips: Support r6 JR encoding James Hogan
2015-09-30 20:49   ` Richard Henderson
2015-09-30 21:24     ` James Hogan
2015-09-30 15:30 ` [Qemu-devel] [PATCH 5/7] tcg/mips: Support r6 multiply/divide encodings James Hogan
2015-09-30 23:24   ` Richard Henderson
2015-09-30 23:30     ` James Hogan
2015-09-30 15:30 ` [Qemu-devel] [PATCH 6/7] tcg/mips: Support full movcond select operation James Hogan
2015-09-30 20:56   ` Richard Henderson [this message]
2015-09-30 21:23     ` James Hogan
2015-09-30 15:30 ` [Qemu-devel] [PATCH 7/7] tcg/mips: Support r6 SEL{NE, EQ}Z instead of MOVN/MOVZ James Hogan

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=560C4C87.7070707@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=james.hogan@imgtec.com \
    --cc=leon.alrae@imgtec.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).