mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
tcg/optimize: Fold eqv with immediate to xor
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
fffd3dc902
commit
46c68d7506
1 changed files with 23 additions and 2 deletions
|
@ -1807,6 +1807,7 @@ static bool fold_dup2(OptContext *ctx, TCGOp *op)
|
||||||
static bool fold_eqv(OptContext *ctx, TCGOp *op)
|
static bool fold_eqv(OptContext *ctx, TCGOp *op)
|
||||||
{
|
{
|
||||||
uint64_t s_mask;
|
uint64_t s_mask;
|
||||||
|
TempOptInfo *t1, *t2;
|
||||||
|
|
||||||
if (fold_const2_commutative(ctx, op) ||
|
if (fold_const2_commutative(ctx, op) ||
|
||||||
fold_xi_to_x(ctx, op, -1) ||
|
fold_xi_to_x(ctx, op, -1) ||
|
||||||
|
@ -1814,8 +1815,28 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_mask = arg_info(op->args[1])->s_mask
|
t2 = arg_info(op->args[2]);
|
||||||
& arg_info(op->args[2])->s_mask;
|
if (ti_is_const(t2)) {
|
||||||
|
/* Fold eqv r,x,i to xor r,x,~i. */
|
||||||
|
switch (ctx->type) {
|
||||||
|
case TCG_TYPE_I32:
|
||||||
|
case TCG_TYPE_I64:
|
||||||
|
op->opc = INDEX_op_xor;
|
||||||
|
break;
|
||||||
|
case TCG_TYPE_V64:
|
||||||
|
case TCG_TYPE_V128:
|
||||||
|
case TCG_TYPE_V256:
|
||||||
|
op->opc = INDEX_op_xor_vec;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
op->args[2] = arg_new_constant(ctx, ~ti_const_val(t2));
|
||||||
|
return fold_xor(ctx, op);
|
||||||
|
}
|
||||||
|
|
||||||
|
t1 = arg_info(op->args[1]);
|
||||||
|
s_mask = t1->s_mask & t2->s_mask;
|
||||||
return fold_masks_s(ctx, op, s_mask);
|
return fold_masks_s(ctx, op, s_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue