render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0018-tcg-optimize-split-expression-simplification.patch

5544c1
From 16f29b266435c7eaffc5081c6bba4651d56a8ce8 Mon Sep 17 00:00:00 2001
5544c1
From: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Date: Thu, 6 Sep 2012 16:47:13 +0200
5544c1
Subject: [PATCH] tcg/optimize: split expression simplification
5544c1
5544c1
Split expression simplification in multiple parts so that a given op
5544c1
can appear multiple times. This patch should not change anything.
5544c1
5544c1
Reviewed-by: Richard Henderson <rth@twiddle.net>
5544c1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 tcg/optimize.c | 14 +++++++++++++-
5544c1
 1 file changed, 13 insertions(+), 1 deletion(-)
5544c1
5544c1
diff --git a/tcg/optimize.c b/tcg/optimize.c
5544c1
index 9c65474..63f970d 100644
5544c1
--- a/tcg/optimize.c
5544c1
+++ b/tcg/optimize.c
5544c1
@@ -322,7 +322,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1
             break;
5544c1
         }
5544c1
 
5544c1
-        /* Simplify expression if possible. */
5544c1
+        /* Simplify expression for "op r, a, 0 => mov r, a" cases */
5544c1
         switch (op) {
5544c1
         CASE_OP_32_64(add):
5544c1
         CASE_OP_32_64(sub):
5544c1
@@ -352,6 +352,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1
                 continue;
5544c1
             }
5544c1
             break;
5544c1
+        default:
5544c1
+            break;
5544c1
+        }
5544c1
+
5544c1
+        /* Simplify expression for "op r, a, 0 => movi r, 0" cases */
5544c1
+        switch (op) {
5544c1
         CASE_OP_32_64(mul):
5544c1
             if ((temps[args[2]].state == TCG_TEMP_CONST
5544c1
                 && temps[args[2]].val == 0)) {
5544c1
@@ -362,6 +368,12 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
5544c1
                 continue;
5544c1
             }
5544c1
             break;
5544c1
+        default:
5544c1
+            break;
5544c1
+        }
5544c1
+
5544c1
+        /* Simplify expression for "op r, a, a => mov r, a" cases */
5544c1
+        switch (op) {
5544c1
         CASE_OP_32_64(or):
5544c1
         CASE_OP_32_64(and):
5544c1
             if (args[1] == args[2]) {
5544c1
-- 
5544c1
1.7.12.1
5544c1