From: Laurent Desnogues <laurent.desnogues@gmail.com>
To: Richard Henderson <rth@twiddle.net>
Cc: Paul Brook <paul@codesourcery.com>,
aurelien@aurel32.net, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/5] tcg conditional set, round 4
Date: Mon, 21 Dec 2009 23:21:04 +0100 [thread overview]
Message-ID: <761ea48b0912211421y2e213dc0gfed24835f3b7f658@mail.gmail.com> (raw)
In-Reply-To: <4B2FDA53.6040605@twiddle.net>
On Mon, Dec 21, 2009 at 9:28 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 12/21/2009 01:13 AM, Laurent Desnogues wrote:
>>
>> The question for the generalized movcond is how useful is it?
>> Which front-ends would need it and would the cost to generate
>> code for it on some (most?) back-ends be amortized?
>
> ... Any front end that has a conditional move instruction?
> Sparcv9, Mips32, Alpha, ARM...
As far as I know these CPU's don't need the full movcond but
only the variant with vtrue. Even if movcond was quick to generate
host code, for instance for ARM, you'd have to explicitly detect
conditional moves, which probably wouldn't be worth the cost;
I might be wrong, since no one has given it a try.
> That said, I think the *biggest* gains are to be had because with movcond --
> at least on some targets -- we can have one BB per TB, and avoid any
> intermediate spilling of global registers back to memory.
I can't count the number of times I thought some branch removal
could only bring improvement, only to see QEMU slow down.
The balance between simplicity and good generated code is
very hard to achieve (and in that particular case, benchmarking
on an Intel just shows how Intel engineers are good at designing
branch predictors :-).
>> My guess (I use that word given that I didn't do any benchmark
>> to sustain my claim) is that your implementation is too complex.
>
> Too complex for what? The message against which you are quoting has an
> implementation of 2 lines.
Well I answered to this mail after seeing the SPARC
implementation :) Indeed your implementation for i386 setcond2
(setcond is trivial) is not that complex.
>> Of course setcond can be implemented in terms of movcond,
>> but my guess (again that word...) is that setcond could be
>> enough and even faster in most cases.
>
> To implement condition codes, yes, to implement compare instructions (e.g.
> mips slt, alpha cmp{eq,lt,lte}), yes. To implement conditional moves, no.
> At least not without using 5 instructions where 1 would suffice.
How many instructions would you need to generate one
host instruction? If the block is not executed that often, it could
be a waste. If you want I can provide you with dynamic counts
of ARM conditional mov when running SPEC; but that wouldn't
be enough, someone would need to do that for the kernel
boot too.
I'm not saying movcond is useless, I'm just wondering if it
would bring improvements. That's why I would prefer to do
all of that stuff incrementally: setcond, then movcond.
>> Regarding your patches, I would like to see setcond put in
>> mainline with a simplified version for i386.
>
> Again, simplified from what? The last setcond implementation was 2 lines.
I was wrong sorry, I mixed several of your patches.
Laurent
next prev parent reply other threads:[~2009-12-21 22:21 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
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 [this message]
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=761ea48b0912211421y2e213dc0gfed24835f3b7f658@mail.gmail.com \
--to=laurent.desnogues@gmail.com \
--cc=aurelien@aurel32.net \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).