qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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: Tue, 22 Dec 2009 15:46:00 +0100	[thread overview]
Message-ID: <761ea48b0912220646h9951f0br21e9232a5d54e63c@mail.gmail.com> (raw)
In-Reply-To: <4B300C8A.2030706@twiddle.net>

On Tue, Dec 22, 2009 at 1:02 AM, Richard Henderson <rth@twiddle.net> wrote:
> On 12/21/2009 03:08 PM, Laurent Desnogues wrote:
>>
>> If you wanted to use movcond, you'd have to make
>> cond + move a special case...
>
> You'd certainly want the ARM front-end to use movcond more often than that.
>  For instance:
>
>  addeq r1,r2,r3
> -->
>  add_i32 tmp,r2,r3
>  movcond_i32 r1,ZF,0,tmp,r1,eq
>
> You'd want to continue to use a branch around if the instruction has side
> effects like cpu fault (e.g. load, store) or updating flags.
>
> It ought not be very hard to arrange for something like
>
>  if (cond != 0xe) {
>    if (may_use_movcond(insn)) {
>      s->condlabel = -1;
>      /* Save the true destination register.  */
>      s->conddest = cpu_R[dest];
>      /* Implement the instruction into a temporary.  */
>      cpu_R[dest] = tcg_temp_new();
>    } else {
>      s->condlabel = gen_new_label();
>      ArmConditional cmp = gen_test_cc(cond ^ 1);
>      tcg_gen_brcondi_i32(cmp.cond, cmp.reg, 0, s->condlabel);
>    }
>    s->condjmp = 1;
>  }
>
>  // ... implement the instruction as we currently do.
>
>  if (s->condjmp) {
>    if (s->condlabel == -1) {
>      /* Conditionally move the temporary result into the
>         true destination register.  */
>      ArmConditional cmp = gen_test_cc(cond);
>      tcg_gen_movcond_i32(cmp.cond, s->conddest, cmp.reg, 0,
>                          cpu_R[dest], s->conddest);
>      tcg_temp_free(cpu_R[dest]);
>      /* Restore the true destination register.  */
>      cpu_R[dest] = s->conddest;
>    } else {
>      tcg_set_label(d->condlabel);
>    }
>  }

I agree, that looks nice.  But I'll let you dig into ARM instruction
encoding and see how to implement may_use_movcond and
getting the correct dest to save is not that cheap (and before
you get back to me, yes, you could only consider a small
subset of the instructions for which you want to do that :-).

There's a point I have kept on insisting on that you keep on
not answering :-)  How does all of that perform in practice?
We can discuss forever, as long as it isn't measured, we are
just guessing.


Laurent

  reply	other threads:[~2009-12-22 14:46 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
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 [this message]
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=761ea48b0912220646h9951f0br21e9232a5d54e63c@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).