qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: balrogg@gmail.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/3] tcg/arm: improve constant loading
Date: Fri, 7 Jan 2011 15:40:35 +0100	[thread overview]
Message-ID: <20110107144035.GA18176@hall.aurel32.net> (raw)
In-Reply-To: <AANLkTi=MYpxWWM90y73WrQby+iVPR3naYO0_soWV+99q@mail.gmail.com>

On Fri, Jan 07, 2011 at 01:52:25PM +0100, andrzej zaborowski wrote:
> Hi,
> 
> On 6 January 2011 22:54, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > Improve constant loading in two ways:
> > - On all ARM versions, it's possible to load 0xffffff00 = -0x100 using
> >  the mvn rd, #0. Fix the conditions.
> > - On <= ARMv6 versions, where movw and movt are not available, load the
> >  constants using mov and orr with rotations depending on the constant
> >  to load. This is very useful for example to load constants where the
> >  low byte is 0. This reduce the generated code size by about 7%.
> 
> That's a nice improvement.  For some instructions using MVN and AND
> could yield even shorter code and I think with that the optimisation
> options (except loading from a constant pool) would be exhausted :)

I also did something with MVN and BIC, it works well, but the problem is
to find the right heuristic to choose between MOV/ORR and MVN/BIC. In my
tries, it was making the code bigger.

> ...
> >         }
> > +    } else {
> > +        int opc = ARITH_MOV;
> > +        int rn = 0;
> > +
> > +        do {
> > +            int i, rot;
> > +
> > +            i = ctz32(arg) & ~1;
> > +            rot = ((32 - i) << 7) & 0xf00;
> > +            tcg_out_dat_imm(s, cond, opc, rd, rn, ((arg >> i) & 0xff) | rot);
> > +            arg &= ~(0xff << i);
> > +
> > +            opc = ARITH_ORR;
> > +            rn = rd;
> 
> I think you could get rid of rn and just use rd from the start of the
> loop.  Otherwise acked by me too.
> 

What do you mean exactly? rn has to be 0 when opc is ARITH_MOV in order
to generate a correct ARM instruction.

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

  parent reply	other threads:[~2011-01-07 14:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 21:54 [Qemu-devel] [PATCH 1/3] tcg/arm: fix branch target change during code retranslation Aurelien Jarno
2011-01-06 21:54 ` [Qemu-devel] [PATCH 2/3] tcg/arm: fix qemu_st64 for big endian targets Aurelien Jarno
2011-01-07 12:37   ` andrzej zaborowski
2011-01-06 21:54 ` [Qemu-devel] [PATCH 3/3] tcg/arm: improve constant loading Aurelien Jarno
2011-01-07 12:52   ` andrzej zaborowski
2011-01-07 12:55     ` andrzej zaborowski
2011-01-07 14:40     ` Aurelien Jarno [this message]
2011-01-07 15:56       ` andrzej zaborowski
2011-01-09 22:40         ` Aurelien Jarno
2011-01-09 23:33           ` andrzej zaborowski
2011-01-10  3:41             ` Peter Maydell
2011-01-07  9:12 ` [Qemu-devel] [PATCH 1/3] tcg/arm: fix branch target change during code retranslation Edgar E. Iglesias

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=20110107144035.GA18176@hall.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=balrogg@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).