All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/8] tcg/optimize: Simply some logical ops to NOT
Date: Sun, 16 Feb 2014 19:27:06 +0100	[thread overview]
Message-ID: <20140216182706.GC18661@hall.aurel32.net> (raw)
In-Reply-To: <1391179623-13626-7-git-send-email-rth@twiddle.net>

On Fri, Jan 31, 2014 at 08:47:01AM -0600, Richard Henderson wrote:
> Given, of course, an appropriate constant.  These could be generated
> from the "canonical" operation for inversion on the guest, or via
> other optimizations.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  tcg/optimize.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
> 
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index 3291a08..cdfc746 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -655,6 +655,63 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
>                  }
>              }
>              break;
> +        CASE_OP_32_64(xor):
> +        CASE_OP_32_64(nand):
> +            if (temps[args[1]].state != TCG_TEMP_CONST
> +                && temps[args[2]].state == TCG_TEMP_CONST
> +                && temps[args[2]].val == -1) {
> +                i = 1;
> +                goto try_not;
> +            }
> +            break;
> +        CASE_OP_32_64(nor):
> +            if (temps[args[1]].state != TCG_TEMP_CONST
> +                && temps[args[2]].state == TCG_TEMP_CONST
> +                && temps[args[2]].val == 0) {
> +                i = 1;
> +                goto try_not;
> +            }
> +            break;
> +        CASE_OP_32_64(andc):
> +            if (temps[args[2]].state != TCG_TEMP_CONST
> +                && temps[args[1]].state == TCG_TEMP_CONST
> +                && temps[args[1]].val == -1) {
> +                i = 2;
> +                goto try_not;
> +            }
> +            break;
> +        CASE_OP_32_64(orc):
> +        CASE_OP_32_64(eqv):
> +            if (temps[args[2]].state != TCG_TEMP_CONST
> +                && temps[args[1]].state == TCG_TEMP_CONST
> +                && temps[args[1]].val == 0) {
> +                i = 2;
> +                goto try_not;
> +            }
> +            break;
> +        try_not:
> +            {
> +                TCGOpcode not_op;
> +                bool have_not;
> +
> +                if (def->flags & TCG_OPF_64BIT) {
> +                    not_op = INDEX_op_not_i64;
> +                    have_not = TCG_TARGET_HAS_not_i64;
> +                } else {
> +                    not_op = INDEX_op_not_i32;
> +                    have_not = TCG_TARGET_HAS_not_i32;
> +                }
> +                if (!have_not) {
> +                    break;
> +                }
> +                s->gen_opc_buf[op_index] = not_op;
> +                reset_temp(args[0]);
> +                gen_args[0] = args[0];
> +                gen_args[1] = args[i];
> +                args += 3;
> +                gen_args += 2;
> +                continue;
> +            }
>          default:
>              break;
>          }

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

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

  reply	other threads:[~2014-02-16 18:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 14:46 [Qemu-devel] [PATCH 0/8] tcg optimization improvements Richard Henderson
2014-01-31 14:46 ` [Qemu-devel] [PATCH 1/8] tcg/optimize: fix known-zero bits for right shift ops Richard Henderson
2014-01-31 14:46 ` [Qemu-devel] [PATCH 2/8] tcg/optimize: fix known-zero bits optimization Richard Henderson
2014-01-31 14:46 ` [Qemu-devel] [PATCH 3/8] tcg/optimize: improve known-zero bits for 32-bit ops Richard Henderson
2014-01-31 14:46 ` [Qemu-devel] [PATCH 4/8] tcg/optimize: add known-zero bits compute for load ops Richard Henderson
2014-01-31 14:47 ` [Qemu-devel] [PATCH 5/8] tcg/optimize: Handle known-zeros masks for ANDC Richard Henderson
2014-02-16 18:12   ` Aurelien Jarno
2014-01-31 14:47 ` [Qemu-devel] [PATCH 6/8] tcg/optimize: Simply some logical ops to NOT Richard Henderson
2014-02-16 18:27   ` Aurelien Jarno [this message]
2014-01-31 14:47 ` [Qemu-devel] [PATCH 7/8] tcg/optimize: Optmize ANDC X, Y, Y to MOV X, 0 Richard Henderson
2014-02-16 18:27   ` Aurelien Jarno
2014-01-31 14:47 ` [Qemu-devel] [PATCH 8/8] tcg/optimize: Add more identity simplifications Richard Henderson
2014-02-16 18:30   ` Aurelien Jarno
2014-02-14 21:44 ` [Qemu-devel] [PATCH 0/8] tcg optimization improvements Richard Henderson
2014-02-16 14:15 ` Paolo Bonzini

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=20140216182706.GC18661@hall.aurel32.net \
    --to=aurelien@aurel32.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.