diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-08-24 10:47:04 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-10-27 17:11:22 -0700 |
commit | 1b1907b8460467743fd23cef918fac9dd7858441 (patch) | |
tree | 8cbcfbfef43945cc8234954bf0c0cd1a912b4fca | |
parent | b6617c8821548350a490c14894a4fe0dba07fc73 (diff) | |
download | qemu-1b1907b8460467743fd23cef918fac9dd7858441.zip qemu-1b1907b8460467743fd23cef918fac9dd7858441.tar.gz qemu-1b1907b8460467743fd23cef918fac9dd7858441.tar.bz2 |
tcg/optimize: Split out fold_deposit
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r-- | tcg/optimize.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 3bd5f04..2c57d08 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -878,6 +878,18 @@ static bool fold_ctpop(OptContext *ctx, TCGOp *op) return fold_const1(ctx, op); } +static bool fold_deposit(OptContext *ctx, TCGOp *op) +{ + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { + uint64_t t1 = arg_info(op->args[1])->val; + uint64_t t2 = arg_info(op->args[2])->val; + + t1 = deposit64(t1, op->args[3], op->args[4], t2); + return tcg_opt_gen_movi(ctx, op, op->args[0], t1); + } + return false; +} + static bool fold_divide(OptContext *ctx, TCGOp *op) { return fold_const2(ctx, op); @@ -1741,16 +1753,6 @@ void tcg_optimize(TCGContext *s) } break; - CASE_OP_32_64(deposit): - if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - tmp = deposit64(arg_info(op->args[1])->val, - op->args[3], op->args[4], - arg_info(op->args[2])->val); - tcg_opt_gen_movi(&ctx, op, op->args[0], tmp); - continue; - } - break; - default: break; @@ -1778,6 +1780,9 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(ctpop): done = fold_ctpop(&ctx, op); break; + CASE_OP_32_64(deposit): + done = fold_deposit(&ctx, op); + break; CASE_OP_32_64(div): CASE_OP_32_64(divu): done = fold_divide(&ctx, op); |