qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer
Date: Sat, 8 Sep 2012 11:35:50 +0200	[thread overview]
Message-ID: <20120908093550.GF6024@ohm.aurel32.net> (raw)
In-Reply-To: <CAAu8pHsLribXSSCghHftNRseDCd6mhB8LyzT6R9Uy3KwvfmuJA@mail.gmail.com>

On Sat, Sep 08, 2012 at 09:29:59AM +0000, Blue Swirl wrote:
> On Sat, Sep 8, 2012 at 9:12 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > On Sat, Sep 08, 2012 at 09:06:52AM +0000, Blue Swirl wrote:
> >> On Sat, Sep 8, 2012 at 9:01 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> >> > On Sat, Sep 08, 2012 at 08:18:50AM +0000, Blue Swirl wrote:
> >> >> On Fri, Sep 7, 2012 at 1:16 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> >> >> > This patch series improves the TCG optimizer, based on patterns found
> >> >> > while executing various guest. The brcond ad setcond constant folding
> >> >> > are useful especially useful when they are used to avoid some argument
> >> >> > values (e.g. division by 0), and thus can be optimized when this argument
> >> >> > is a constant.
> >> >> >
> >> >> > This bring around 0.5% improvement on openssl like benchmarks.
> >> >> >
> >> >> >
> >> >> > Modifications between V1 and V2 following feedback I got:
> >> >> >  - In the first patch, account for the liveness analysis time and
> >> >> >    optimizing pass time separately
> >> >> >  - Fixed swith/break in patch 7 to correctly throw an error
> >> >> >  - Added patch 9 to make the code more readable
> >> >> > Other patches are unmodified.
> >> >> >
> >> >> >
> >> >> > Aurelien Jarno (9):
> >> >> >   tcg: improve profiler
> >> >> >   tcg/optimize: split expression simplification
> >> >> >   tcg/optimize: simplify or/xor r, a, 0 cases
> >> >> >   tcg/optimize: simplify and r, a, 0 cases
> >> >> >   tcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases
> >> >>
> >> >> Aren't the above or/and/shift/rot simplifications (and also for
> >> >> example OR with 0xfffffffff and XOR register by itself) already
> >> >> handled by tcg/tcg-op.h?
> >> >
> >> > They are handled there when the values are known at decode time. It is
> >> > not the case when the value are propagated in the TB.
> >> >
> >> > For example, this is optimized in tcg/tcg-op.h:
> >> >   ori t0, t1, 0
> >> >
> >> > This is not optimized in tcg/tcg-op.h:
> >> >   movi t2, 0
> >> >   or t0, t1, t2
> >>
> >> I see. Does the optimizer pass then make the tcg/tcg-op.h optimization
> >> redundant, could we do the optimizations only in optimizer?
> >
> > Technically yes. In practice it's a good idea to keep simple
> > optimizations in tcg/tcg-op.h, as they cost less in CPU time than when
> > done later.
> 
> OK. Could there be further optimizations based on tcg/tcg-op.h, for
> example case OR reg, 0xffffffff -> mov reg, 0xffffffff could be
> rechecked?
> 

Yes this is something we can add. That said I based this patch series on
instructions I have found while running a few targets (arm, ppc, mips,
x86_64) and looking at qemu.log. I haven't seen this one.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2012-09-08  9:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 13:16 [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 1/9] tcg: improve profiler Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 2/9] tcg/optimize: split expression simplification Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 3/9] tcg/optimize: simplify or/xor r, a, 0 cases Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 4/9] tcg/optimize: simplify and " Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 5/9] tcg/optimize: simplify shift/rot r, 0, a => movi r, " Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 6/9] tcg/optimize: swap brcond/setcond arguments when possible Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 7/9] tcg/optimize: add constant folding for setcond Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 8/9] tcg/optimize: add constant folding for brcond Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 9/9] tcg/optimize: fix if/else/break coding style Aurelien Jarno
2012-09-08  8:18 ` [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer Blue Swirl
2012-09-08  9:01   ` Aurelien Jarno
2012-09-08  9:06     ` Blue Swirl
2012-09-08  9:12       ` Aurelien Jarno
2012-09-08  9:29         ` Blue Swirl
2012-09-08  9:35           ` Aurelien Jarno [this message]
2012-09-10 13:55 ` Richard Henderson

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=20120908093550.GF6024@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=blauwirbel@gmail.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).