Blame 0077-tcg-optimize-add-constant-folding-for-deposit.patch
|
|
5544c1 |
From 04edfbcf025b5588e0f3b86c74356a4339745f35 Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
5544c1 |
Date: Fri, 21 Sep 2012 11:07:29 +0200
|
|
|
5544c1 |
Subject: [PATCH] tcg/optimize: add constant folding for deposit
|
|
|
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 | 20 ++++++++++++++++++++
|
|
|
5544c1 |
1 file changed, 20 insertions(+)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/tcg/optimize.c b/tcg/optimize.c
|
|
|
5544c1 |
index c8ae50b..35532a1 100644
|
|
|
5544c1 |
--- a/tcg/optimize.c
|
|
|
5544c1 |
+++ b/tcg/optimize.c
|
|
|
5544c1 |
@@ -668,6 +668,26 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr,
|
|
|
5544c1 |
}
|
|
|
5544c1 |
args += 3;
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
+ CASE_OP_32_64(deposit):
|
|
|
5544c1 |
+ if (temps[args[1]].state == TCG_TEMP_CONST
|
|
|
5544c1 |
+ && temps[args[2]].state == TCG_TEMP_CONST) {
|
|
|
5544c1 |
+ gen_opc_buf[op_index] = op_to_movi(op);
|
|
|
5544c1 |
+ tmp = ((1ull << args[4]) - 1);
|
|
|
5544c1 |
+ tmp = (temps[args[1]].val & ~(tmp << args[3]))
|
|
|
5544c1 |
+ | ((temps[args[2]].val & tmp) << args[3]);
|
|
|
5544c1 |
+ tcg_opt_gen_movi(gen_args, args[0], tmp);
|
|
|
5544c1 |
+ gen_args += 2;
|
|
|
5544c1 |
+ } else {
|
|
|
5544c1 |
+ reset_temp(args[0]);
|
|
|
5544c1 |
+ gen_args[0] = args[0];
|
|
|
5544c1 |
+ gen_args[1] = args[1];
|
|
|
5544c1 |
+ gen_args[2] = args[2];
|
|
|
5544c1 |
+ gen_args[3] = args[3];
|
|
|
5544c1 |
+ gen_args[4] = args[4];
|
|
|
5544c1 |
+ gen_args += 5;
|
|
|
5544c1 |
+ }
|
|
|
5544c1 |
+ args += 5;
|
|
|
5544c1 |
+ break;
|
|
|
5544c1 |
CASE_OP_32_64(setcond):
|
|
|
5544c1 |
tmp = do_constant_folding_cond(op, args[1], args[2], args[3]);
|
|
|
5544c1 |
if (tmp != 2) {
|
|
|
5544c1 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|