qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/6] tcg: Constant fold neg, andc, orc, eqv, nand, nor.
Date: Wed, 17 Aug 2011 14:11:47 -0700	[thread overview]
Message-ID: <1313615510-10615-4-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1313615510-10615-1-git-send-email-rth@twiddle.net>

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/optimize.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/tcg/optimize.c b/tcg/optimize.c
index 32f928f..7e7f2b2 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -215,6 +215,24 @@ static TCGArg do_constant_folding_2(int op, TCGArg x, TCGArg y)
     CASE_OP_32_64(not):
         return ~x;
 
+    CASE_OP_32_64(neg):
+        return -x;
+
+    CASE_OP_32_64(andc):
+        return x & ~y;
+
+    CASE_OP_32_64(orc):
+        return x | ~y;
+
+    CASE_OP_32_64(eqv):
+        return ~(x ^ y);
+
+    CASE_OP_32_64(nand):
+        return ~(x & y);
+
+    CASE_OP_32_64(nor):
+        return ~(x | y);
+
     CASE_OP_32_64(ext8s):
         return (int8_t)x;
 
@@ -290,6 +308,9 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
         CASE_OP_32_64(and):
         CASE_OP_32_64(or):
         CASE_OP_32_64(xor):
+        CASE_OP_32_64(eqv):
+        CASE_OP_32_64(nand):
+        CASE_OP_32_64(nor):
             if (temps[args[1]].state == TCG_TEMP_CONST) {
                 tmp = args[1];
                 args[1] = args[2];
@@ -389,6 +410,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
             args += 2;
             break;
         CASE_OP_32_64(not):
+        CASE_OP_32_64(neg):
         CASE_OP_32_64(ext8s):
         CASE_OP_32_64(ext8u):
         CASE_OP_32_64(ext16s):
@@ -421,6 +443,11 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
         CASE_OP_32_64(sar):
         CASE_OP_32_64(rotl):
         CASE_OP_32_64(rotr):
+        CASE_OP_32_64(andc):
+        CASE_OP_32_64(orc):
+        CASE_OP_32_64(eqv):
+        CASE_OP_32_64(nand):
+        CASE_OP_32_64(nor):
             if (temps[args[1]].state == TCG_TEMP_CONST
                 && temps[args[2]].state == TCG_TEMP_CONST) {
                 gen_opc_buf[op_index] = op_to_movi(op);
-- 
1.7.4.4

  parent reply	other threads:[~2011-08-17 21:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 21:11 [Qemu-devel] [PATCH 0/6] TCG compile fixes and optimize cleanup Richard Henderson
2011-08-17 21:11 ` [Qemu-devel] [PATCH 1/6] tcg: Add and use TCG_OPF_64BIT Richard Henderson
2011-08-17 21:11 ` [Qemu-devel] [PATCH 2/6] tcg: Always define all of the TCGOpcode enum members Richard Henderson
2011-08-23 17:11   ` Peter Maydell
2011-08-23 17:21     ` Richard Henderson
2011-08-23 17:43     ` [Qemu-devel] [PATCH] tcg: Update --enable-debug for TCG_OPF_NOT_PRESENT Richard Henderson
2011-08-23 18:41       ` Peter Maydell
2011-08-23 19:31         ` Edgar E. Iglesias
2011-08-17 21:11 ` Richard Henderson [this message]
2011-08-17 21:11 ` [Qemu-devel] [PATCH 4/6] tcg-hppa: Fix CPU_TEMP_BUF_NLONGS oversight Richard Henderson
2011-08-17 21:11 ` [Qemu-devel] [PATCH 5/6] tcg-ia64: Fix typos in AREG0 setup in prologue Richard Henderson
2011-08-17 21:11 ` [Qemu-devel] [PATCH 6/6] tcg-arm: Make tcg_out_addi inline Richard Henderson
2011-08-19 23:51   ` Peter Maydell
2011-08-20  0:10     ` andrzej zaborowski
2011-08-20  4:19       ` Peter Maydell
2011-08-21 19:15 ` [Qemu-devel] [PATCH 0/6] TCG compile fixes and optimize cleanup 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=1313615510-10615-4-git-send-email-rth@twiddle.net \
    --to=rth@twiddle.net \
    --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).