diff options
author | Richard Henderson <rth@twiddle.net> | 2013-09-09 17:03:24 -0700 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2014-04-28 11:06:34 -0700 |
commit | 4bb7a41ed635960e1551e8b5a1aea9ee4d1758a3 (patch) | |
tree | 68ed85758ad038717290bd8f4aa4dae00d08935b /tcg/optimize.c | |
parent | 71b926992e0e0a0da078873480c6fc1dd65af6fc (diff) | |
download | hqemu-4bb7a41ed635960e1551e8b5a1aea9ee4d1758a3.zip hqemu-4bb7a41ed635960e1551e8b5a1aea9ee4d1758a3.tar.gz |
tcg: Add INDEX_op_trunc_shr_i32
Let the backend do something special for truncation.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r-- | tcg/optimize.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index c447062..0302f4f 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -228,6 +228,7 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) case INDEX_op_shr_i32: return (uint32_t)x >> (y & 31); + case INDEX_op_trunc_shr_i32: case INDEX_op_shr_i64: return (uint64_t)x >> (y & 63); @@ -830,6 +831,10 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, } break; + case INDEX_op_trunc_shr_i32: + mask = (uint64_t)temps[args[1]].mask >> args[2]; + break; + CASE_OP_32_64(shl): if (temps[args[2]].state == TCG_TEMP_CONST) { tmp = temps[args[2]].val & (TCG_TARGET_REG_BITS - 1); @@ -1021,6 +1026,17 @@ static TCGArg *tcg_constant_folding(TCGContext *s, uint16_t *tcg_opc_ptr, } goto do_default; + case INDEX_op_trunc_shr_i32: + if (temps[args[1]].state == TCG_TEMP_CONST) { + s->gen_opc_buf[op_index] = op_to_movi(op); + tmp = do_constant_folding(op, temps[args[1]].val, args[2]); + tcg_opt_gen_movi(gen_args, args[0], tmp); + gen_args += 2; + args += 3; + break; + } + goto do_default; + CASE_OP_32_64(add): CASE_OP_32_64(sub): CASE_OP_32_64(mul): |