Patchwork [5/9] tcg/optimize: optimize "op r, a, a => mov r, a"

login
register
mail settings
Submitter Aurelien Jarno
Date Sept. 19, 2012, 8 p.m.
Message ID <1348084823-18277-6-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/185211/
State New
Headers show

Comments

Aurelien Jarno - Sept. 19, 2012, 8 p.m.
Now that we can easily detect all copies, we can optimize the
"op r, a, a => mov r, a" case a bit more.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/optimize.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Richard Henderson - Sept. 19, 2012, 9:43 p.m.
On 09/19/2012 01:00 PM, Aurelien Jarno wrote:
> Now that we can easily detect all copies, we can optimize the
> "op r, a, a => mov r, a" case a bit more.
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

Patch

diff --git a/tcg/optimize.c b/tcg/optimize.c
index a58de3b..cfee690 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -503,7 +503,7 @@  static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
         switch (op) {
         CASE_OP_32_64(or):
         CASE_OP_32_64(and):
-            if (args[1] == args[2]) {
+            if (temps_are_copies(args[1], args[2])) {
                 if (temps_are_copies(args[0], args[1])) {
                     gen_opc_buf[op_index] = INDEX_op_nop;
                 } else {