[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 8/8] tcg/optimize: Add more identity simplificat
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] [PATCH 8/8] tcg/optimize: Add more identity simplifications |
Date: |
Sun, 16 Feb 2014 19:30:52 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jan 31, 2014 at 08:47:03AM -0600, Richard Henderson wrote:
> Recognize 0 operand to andc, and -1 operands to and, orc, eqv.
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> tcg/optimize.c | 39 ++++++++++++++++++++++++---------------
> 1 file changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/tcg/optimize.c b/tcg/optimize.c
> index a703f8c..8d7100e 100644
> --- a/tcg/optimize.c
> +++ b/tcg/optimize.c
> @@ -716,7 +716,7 @@ static TCGArg *tcg_constant_folding(TCGContext *s,
> uint16_t *tcg_opc_ptr,
> break;
> }
>
> - /* Simplify expression for "op r, a, 0 => mov r, a" cases */
> + /* Simplify expression for "op r, a, const => mov r, a" cases */
> switch (op) {
> CASE_OP_32_64(add):
> CASE_OP_32_64(sub):
> @@ -727,23 +727,32 @@ static TCGArg *tcg_constant_folding(TCGContext *s,
> uint16_t *tcg_opc_ptr,
> CASE_OP_32_64(rotr):
> CASE_OP_32_64(or):
> CASE_OP_32_64(xor):
> - if (temps[args[1]].state == TCG_TEMP_CONST) {
> - /* Proceed with possible constant folding. */
> - break;
> - }
> - if (temps[args[2]].state == TCG_TEMP_CONST
> + CASE_OP_32_64(andc):
> + if (temps[args[1]].state != TCG_TEMP_CONST
> + && temps[args[2]].state == TCG_TEMP_CONST
> && temps[args[2]].val == 0) {
> - if (temps_are_copies(args[0], args[1])) {
> - s->gen_opc_buf[op_index] = INDEX_op_nop;
> - } else {
> - s->gen_opc_buf[op_index] = op_to_mov(op);
> - tcg_opt_gen_mov(s, gen_args, args[0], args[1]);
> - gen_args += 2;
> - }
> - args += 3;
> - continue;
> + goto do_mov3;
> }
> break;
> + CASE_OP_32_64(and):
> + CASE_OP_32_64(orc):
> + CASE_OP_32_64(eqv):
> + if (temps[args[1]].state != TCG_TEMP_CONST
> + && temps[args[2]].state == TCG_TEMP_CONST
> + && temps[args[2]].val == -1) {
> + goto do_mov3;
> + }
> + break;
> + do_mov3:
> + if (temps_are_copies(args[0], args[1])) {
> + s->gen_opc_buf[op_index] = INDEX_op_nop;
> + } else {
> + s->gen_opc_buf[op_index] = op_to_mov(op);
> + tcg_opt_gen_mov(s, gen_args, args[0], args[1]);
> + gen_args += 2;
> + }
> + args += 3;
> + continue;
> default:
> break;
> }
Reviewed-by: Aurelien Jarno <address@hidden>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
address@hidden http://www.aurel32.net
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH 8/8] tcg/optimize: Add more identity simplifications,
Aurelien Jarno <=