On Tue, 8 Aug 2023 at 04:12, Richard Henderson <richard.hender...@linaro.org> wrote: > > Introduce a new opcode for negative setcond. > > Signed-off-by: Richard Henderson <richard.hender...@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.mayd...@linaro.org> thanks -- PMM