qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH 01/24] tcg: Introduce negsetcond opcodes


From: Peter Maydell
Subject: Re: [PATCH 01/24] tcg: Introduce negsetcond opcodes
Date: Thu, 10 Aug 2023 17:12:49 +0100

On Tue, 8 Aug 2023 at 04:12, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Introduce a new opcode for negative setcond.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>




> +static bool fold_negsetcond(OptContext *ctx, TCGOp *op)
> +{
> +    TCGCond cond = op->args[3];
> +    int i;
> +
> +    if (swap_commutative(op->args[0], &op->args[1], &op->args[2])) {
> +        op->args[3] = cond = tcg_swap_cond(cond);
> +    }
> +
> +    i = do_constant_folding_cond(ctx->type, op->args[1], op->args[2], cond);
> +    if (i >= 0) {
> +        return tcg_opt_gen_movi(ctx, op, op->args[0], -i);
> +    }
> +
> +    /* Value is {0,-1} so all bits are repititions of the sign. */

"repetitions"

> +    ctx->s_mask = -1;

Do we not also need to set z_mask to something here (presumably -1)?
(I'm not very familiar with the optimizer internals.)

> +    return false;
> +}

Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM



reply via email to

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