On 10/21/21 23:05, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.hender...@linaro.org> > --- > tcg/optimize.c | 39 ++++++++++++++++++++++----------------- > 1 file changed, 22 insertions(+), 17 deletions(-)
> +static bool fold_extract2(OptContext *ctx, TCGOp *op) > +{ > + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { > + uint64_t v1 = arg_info(op->args[1])->val; > + uint64_t v2 = arg_info(op->args[2])->val; > + int shr = op->args[3]; > + > + if (op->opc == INDEX_op_extract2_i64) { > + v1 >>= shr; > + v2 <<= 64 - shr; > + } else { > + v1 = (uint32_t)v1 >> shr; > + v2 = (int32_t)v2 << (32 - shr); Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> > + } > + return tcg_opt_gen_movi(ctx, op, op->args[0], v1 | v2); > + } > + return false; > +}