qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer
Date: Sat, 8 Sep 2012 11:12:21 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Sep 08, 2012 at 09:06:52AM +0000, Blue Swirl wrote:
> On Sat, Sep 8, 2012 at 9:01 AM, Aurelien Jarno <address@hidden> 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 <address@hidden> 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.

On the other hand, we can remove such optimizations done in some
TCG backends as they won't see this kind of ops anymore.

> >
> >> >   tcg/optimize: swap brcond/setcond arguments when possible
> >> >   tcg/optimize: add constant folding for setcond
> >> >   tcg/optimize: add constant folding for brcond
> >> >   tcg/optimize: fix if/else/break coding style
> >>
> >> Otherwise a very nice series.
> >>
> >> >
> >> >  tcg/optimize.c |  179 
> >> > +++++++++++++++++++++++++++++++++++++++++++++++++++-----
> >> >  tcg/tcg.c      |   12 +++-
> >> >  tcg/tcg.h      |    1 +
> >> >  3 files changed, 175 insertions(+), 17 deletions(-)
> >> >
> >> > --
> >> > 1.7.10.4
> >> >
> >> >
> >>
> >>
> >
> > --
> > Aurelien Jarno                          GPG: 1024D/F1BCDB73
> > address@hidden                 http://www.aurel32.net
> 

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]