qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Paul Brook <paul@codesourcery.com>
Cc: qemu-devel@nongnu.org, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4
Date: Sun, 20 Dec 2009 18:00:48 -0800	[thread overview]
Message-ID: <4B2ED6D0.1010900@twiddle.net> (raw)
In-Reply-To: <200912202257.22503.paul@codesourcery.com>

On 12/20/2009 02:57 PM, Paul Brook wrote:
> On Saturday 19 December 2009, Richard Henderson wrote:
>> Changes from round 3:
>>
>>   * Drop movcond for now.
>>   * Only use movzbl and not xor in setcond.
>
> I'm still catching up on mail backlog from this thread, but I'm concerned that
> we're exposing setcond to the target translation code if we're planning on
> implementing movcond later.

I personally was only planning to use setcond in those cases where the 
target actually wants a 0/1 value.  E.g. i386 setcc, or alpha cmp*, or 
mips slt*.

As for shifts and masks, that wasn't in my plans.  I had a comment in 
there about all the tricks that gcc plays with a conditional move of two 
constants, and the fact that I didn't think it worth the effort.

Indeed, my plan for today was to cut down my existing movcond patch to 
make it simpler, as that seems to be the way Aurelien wants this to go. 
  Life conspired against and I got nothing done, but still.

I *am* convinced that to remove either VTRUE or VFALSE as arguments to 
the movcond primitive (implementing dest = (cond ? vtrue : dest) would 
do too much violence to both the liveness analysis and the register 
allocator within TCG.  The best I can do to remove the complexity is:

static void tcg_out_movcond(TCGContext *s, int cond, TCGArg dest,
                             TCGArg cmp1, TCGArg cmp2, int const_cmp2,
                             TCGArg vtrue, int rexw)
{
     tcg_out_cmp(s, cond, cmp1, cmp2, const_cmp2, rexw);
     /* cmovcc */
     tcg_out_modrm(s, 0x40 | tcg_cond_to_jcc[cond] | P_EXT | rexw,
                   dest, vtrue);
}
...
     { INDEX_op_movcond_i32, { "r", "r", "ri", "r", "0" } },
     { INDEX_op_movcond_i64, { "r", "r", "re", "r", "0" } },

using matching constraints in the target and directly implement the 
conditional move.  This eliminates the code I previously had that 
checked for things like dest=vfalse and inverted the condition.  I had 
planned to simplify the i386 version similarly, even in the case where 
cmovcc is not available.

I would appreciate some direction here, so as to avoid wasting my time 
with a solution that won't be accepted.


r~

  reply	other threads:[~2009-12-21  2:00 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-19 18:52 [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4 Richard Henderson
2009-12-19 16:50 ` [Qemu-devel] [PATCH 2/5] tcg-x86_64: Implement setcond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 18:01 ` [Qemu-devel] [PATCH 1/5] tcg: Generic support for conditional set Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 23:24     ` Richard Henderson
2009-12-19 23:45       ` Aurelien Jarno
2009-12-22 11:27   ` Laurent Desnogues
2009-12-22 16:09     ` Richard Henderson
2009-12-19 18:44 ` [Qemu-devel] [PATCH 3/5] tcg-i386: Implement small forward branches Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 23:32   ` Laurent Desnogues
2009-12-20  1:17     ` Richard Henderson
2009-12-19 18:44 ` [Qemu-devel] [PATCH 4/5] tcg: Add tcg_invert_cond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-19 18:46 ` [Qemu-devel] [PATCH 5/5] tcg-i386: Implement setcond Richard Henderson
2009-12-19 23:11   ` Aurelien Jarno
2009-12-22 12:20     ` Laurent Desnogues
2009-12-19 23:11 ` [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4 Aurelien Jarno
2009-12-19 23:43   ` malc
2009-12-20 11:03     ` Blue Swirl
2009-12-20 22:57 ` Paul Brook
2009-12-21  2:00   ` Richard Henderson [this message]
2009-12-21  9:13     ` Laurent Desnogues
2009-12-21  9:47       ` [Qemu-devel] " Paolo Bonzini
2009-12-21 10:03         ` Laurent Desnogues
2009-12-21 20:28       ` [Qemu-devel] " Richard Henderson
2009-12-21 22:21         ` Laurent Desnogues
2009-12-21 22:50           ` Richard Henderson
2009-12-21 23:08             ` Laurent Desnogues
2009-12-22  0:02               ` Richard Henderson
2009-12-22 14:46                 ` Laurent Desnogues
2009-12-22  7:19         ` Aurelien Jarno
2009-12-21 10:08     ` Aurelien Jarno

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=4B2ED6D0.1010900@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=paul@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 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).