mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
tcg/optimize: Do not attempt to constant fold neg_vec
Split out the tail of fold_neg to fold_neg_no_const so that we can avoid attempting to constant fold vector negate. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2150 Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
bc0cd4ae88
commit
e25fe886b8
3 changed files with 21 additions and 10 deletions
|
@ -1990,16 +1990,10 @@ static bool fold_nand(OptContext *ctx, TCGOp *op)
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool fold_neg(OptContext *ctx, TCGOp *op)
|
||||
static bool fold_neg_no_const(OptContext *ctx, TCGOp *op)
|
||||
{
|
||||
uint64_t z_mask;
|
||||
|
||||
if (fold_const1(ctx, op)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Set to 1 all bits to the left of the rightmost. */
|
||||
z_mask = arg_info(op->args[1])->z_mask;
|
||||
uint64_t z_mask = arg_info(op->args[1])->z_mask;
|
||||
ctx->z_mask = -(z_mask & -z_mask);
|
||||
|
||||
/*
|
||||
|
@ -2010,6 +2004,11 @@ static bool fold_neg(OptContext *ctx, TCGOp *op)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool fold_neg(OptContext *ctx, TCGOp *op)
|
||||
{
|
||||
return fold_const1(ctx, op) || fold_neg_no_const(ctx, op);
|
||||
}
|
||||
|
||||
static bool fold_nor(OptContext *ctx, TCGOp *op)
|
||||
{
|
||||
if (fold_const2_commutative(ctx, op) ||
|
||||
|
@ -2418,7 +2417,7 @@ static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op)
|
|||
if (have_neg) {
|
||||
op->opc = neg_op;
|
||||
op->args[1] = op->args[2];
|
||||
return fold_neg(ctx, op);
|
||||
return fold_neg_no_const(ctx, op);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue