qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 22/48] tcg/optimize: Split out fold_movcond


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 22/48] tcg/optimize: Split out fold_movcond
Date: Fri, 22 Oct 2021 16:05:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 10/21/21 23:05, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tcg/optimize.c | 56 ++++++++++++++++++++++++++++----------------------
>  1 file changed, 31 insertions(+), 25 deletions(-)

> +static bool fold_movcond(OptContext *ctx, TCGOp *op)
> +{
> +    TCGOpcode opc = op->opc;
> +    TCGCond cond = op->args[5];
> +    int i = do_constant_folding_cond(opc, op->args[1], op->args[2], cond);
> +
> +    if (i >= 0) {
> +        return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[4 - i]);
> +    }
> +
> +    if (arg_is_const(op->args[3]) && arg_is_const(op->args[4])) {
> +        uint64_t tv = arg_info(op->args[3])->val;
> +        uint64_t fv = arg_info(op->args[4])->val;
> +
> +        opc = (opc == INDEX_op_movcond_i32
> +               ? INDEX_op_setcond_i32 : INDEX_op_setcond_i64);
> +
> +        if (tv == 1 && fv == 0) {
> +            op->opc = opc;
> +            op->args[3] = cond;
> +        } else if (fv == 1 && tv == 0) {

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> +            op->opc = opc;
> +            op->args[3] = tcg_invert_cond(cond);
> +        }
> +    }
> +    return false;
> +}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]