qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: malc <av1474@comtv.ru>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH v2 0/7] tcg: movcond (ppc32 version)
Date: Fri, 21 Sep 2012 15:21:24 -0700	[thread overview]
Message-ID: <505CE864.1050701@twiddle.net> (raw)
In-Reply-To: <alpine.LNX.2.00.1209220007340.8843@linmac>

On 09/21/2012 01:10 PM, malc wrote:
> +        if (dest == v2) {
> +            label_ptr = s->code_ptr;
> +            tcg_out32 (s, tcg_to_bc[tcg_invert_cond (cond)]);
> +            tcg_out_mov (s, TCG_TYPE_I32, dest, v1);
> +            reloc_pc14 (label_ptr, (tcg_target_long) s->code_ptr);
> +        }
> +        else {
> +            tcg_out_mov (s, TCG_TYPE_I32, dest, v1);
> +            label_ptr = s->code_ptr;
> +            tcg_out32 (s, tcg_to_bc[cond]);
> +            tcg_out_mov (s, TCG_TYPE_I32, dest, v2);
> +            reloc_pc14 (label_ptr, (tcg_target_long) s->code_ptr);
> +        }

How about

    if (dest == v2) {
        cond = tcg_invert_cond(cond);
        v2 = v1;
    } else if (dest != v1) {
        tcg_out_mov(s, TCG_TYPE_I32, dest, v1);
    }
    /* Branch forward over one insn.  */
    tcg_out32 (s, tcg_to_bc[cond] | 4);
    tcg_out_mov(s, TCG_TYPE_I32, dest, v2);

which avoids an extra mov if dest == v1, and also minimizes the code.


r~

  reply	other threads:[~2012-09-21 22:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 17:13 [Qemu-devel] [PATCH v2 0/7] tcg: movcond Richard Henderson
2012-09-21 17:13 ` [Qemu-devel] [PATCH 1/7] tcg: Introduce movcond Richard Henderson
2012-09-21 17:13 ` [Qemu-devel] [PATCH 2/7] target-alpha: Use movcond Richard Henderson
2012-09-21 17:13 ` [Qemu-devel] [PATCH 3/7] tcg-i386: Implement movcond Richard Henderson
2012-09-24 21:37   ` Alex Barcelo
2012-09-24 21:54     ` Richard Henderson
2012-09-25 22:48       ` Aurelien Jarno
2012-09-21 17:13 ` [Qemu-devel] [PATCH 4/7] tcg: Optimize movcond for constant comparisons Richard Henderson
2012-09-21 17:13 ` [Qemu-devel] [PATCH 5/7] tcg: Optimize two-address commutative operations Richard Henderson
2012-09-21 17:13 ` [Qemu-devel] [PATCH 6/7] tcg: Streamline movcond_i64 using 32-bit arithmetic Richard Henderson
2012-09-21 21:15   ` Aurelien Jarno
2012-09-22 18:11   ` Aurelien Jarno
2012-09-21 17:13 ` [Qemu-devel] [PATCH 7/7] tcg: Streamline movcond_i64 using movcond_i32 Richard Henderson
2012-09-21 21:23   ` Aurelien Jarno
2012-09-21 22:27     ` Richard Henderson
2012-09-22  9:30       ` Aurelien Jarno
2012-09-21 18:14 ` [Qemu-devel] [PATCH v2 0/7] tcg: movcond Aurelien Jarno
2012-09-21 20:10 ` [Qemu-devel] [PATCH v2 0/7] tcg: movcond (ppc32 version) malc
2012-09-21 22:21   ` Richard Henderson [this message]
2012-09-21 22:34     ` malc
2012-09-22 14:38   ` Blue Swirl

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=505CE864.1050701@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=av1474@comtv.ru \
    --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).