From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH v2 2/9] tcg/optimize: split expression simplification
Date: Fri, 7 Sep 2012 15:16:25 +0200 [thread overview]
Message-ID: <1347023792-24045-3-git-send-email-aurelien@aurel32.net> (raw)
In-Reply-To: <1347023792-24045-1-git-send-email-aurelien@aurel32.net>
Split expression simplification in multiple parts so that a given op
can appear multiple times. This patch should not change anything.
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
tcg/optimize.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 9c65474..63f970d 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -322,7 +322,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
break;
}
- /* Simplify expression if possible. */
+ /* Simplify expression for "op r, a, 0 => mov r, a" cases */
switch (op) {
CASE_OP_32_64(add):
CASE_OP_32_64(sub):
@@ -352,6 +352,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
continue;
}
break;
+ default:
+ break;
+ }
+
+ /* Simplify expression for "op r, a, 0 => movi r, 0" cases */
+ switch (op) {
CASE_OP_32_64(mul):
if ((temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[2]].val == 0)) {
@@ -362,6 +368,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
continue;
}
break;
+ default:
+ break;
+ }
+
+ /* Simplify expression for "op r, a, a => mov r, a" cases */
+ switch (op) {
CASE_OP_32_64(or):
CASE_OP_32_64(and):
if (args[1] == args[2]) {
--
1.7.10.4
next prev parent reply other threads:[~2012-09-07 13:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 13:16 [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 1/9] tcg: improve profiler Aurelien Jarno
2012-09-07 13:16 ` Aurelien Jarno [this message]
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 3/9] tcg/optimize: simplify or/xor r, a, 0 cases Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 4/9] tcg/optimize: simplify and " Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 5/9] tcg/optimize: simplify shift/rot r, 0, a => movi r, " Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 6/9] tcg/optimize: swap brcond/setcond arguments when possible Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 7/9] tcg/optimize: add constant folding for setcond Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 8/9] tcg/optimize: add constant folding for brcond Aurelien Jarno
2012-09-07 13:16 ` [Qemu-devel] [PATCH v2 9/9] tcg/optimize: fix if/else/break coding style Aurelien Jarno
2012-09-08 8:18 ` [Qemu-devel] [PATCH v2 0/9] Improve TCG optimizer Blue Swirl
2012-09-08 9:01 ` Aurelien Jarno
2012-09-08 9:06 ` Blue Swirl
2012-09-08 9:12 ` Aurelien Jarno
2012-09-08 9:29 ` Blue Swirl
2012-09-08 9:35 ` Aurelien Jarno
2012-09-10 13:55 ` Richard Henderson
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=1347023792-24045-3-git-send-email-aurelien@aurel32.net \
--to=aurelien@aurel32.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).