|
|
|
@ -441,7 +441,8 @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y) |
|
|
|
case INDEX_op_or_vec: |
|
|
|
return x | y; |
|
|
|
|
|
|
|
CASE_OP_32_64_VEC(xor): |
|
|
|
case INDEX_op_xor: |
|
|
|
case INDEX_op_xor_vec: |
|
|
|
return x ^ y; |
|
|
|
|
|
|
|
case INDEX_op_shl_i32: |
|
|
|
@ -2289,7 +2290,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
break; |
|
|
|
} |
|
|
|
if (convert) { |
|
|
|
TCGOpcode xor_opc, neg_opc; |
|
|
|
TCGOpcode neg_opc; |
|
|
|
|
|
|
|
if (!inv && !neg) { |
|
|
|
return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); |
|
|
|
@ -2298,11 +2299,9 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
switch (ctx->type) { |
|
|
|
case TCG_TYPE_I32: |
|
|
|
neg_opc = INDEX_op_neg_i32; |
|
|
|
xor_opc = INDEX_op_xor_i32; |
|
|
|
break; |
|
|
|
case TCG_TYPE_I64: |
|
|
|
neg_opc = INDEX_op_neg_i64; |
|
|
|
xor_opc = INDEX_op_xor_i64; |
|
|
|
break; |
|
|
|
default: |
|
|
|
g_assert_not_reached(); |
|
|
|
@ -2314,7 +2313,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
op->opc = INDEX_op_add; |
|
|
|
op->args[2] = arg_new_constant(ctx, -1); |
|
|
|
} else { |
|
|
|
op->opc = xor_opc; |
|
|
|
op->opc = INDEX_op_xor; |
|
|
|
op->args[2] = arg_new_constant(ctx, 1); |
|
|
|
} |
|
|
|
return -1; |
|
|
|
@ -2325,7 +2324,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
|
|
|
|
static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
{ |
|
|
|
TCGOpcode xor_opc, neg_opc, shr_opc; |
|
|
|
TCGOpcode neg_opc, shr_opc; |
|
|
|
TCGOpcode uext_opc = 0, sext_opc = 0; |
|
|
|
TCGCond cond = op->args[3]; |
|
|
|
TCGArg ret, src1, src2; |
|
|
|
@ -2347,7 +2346,6 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
|
|
|
|
switch (ctx->type) { |
|
|
|
case TCG_TYPE_I32: |
|
|
|
xor_opc = INDEX_op_xor_i32; |
|
|
|
shr_opc = INDEX_op_shr_i32; |
|
|
|
neg_opc = INDEX_op_neg_i32; |
|
|
|
if (TCG_TARGET_extract_valid(TCG_TYPE_I32, sh, 1)) { |
|
|
|
@ -2358,7 +2356,6 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
} |
|
|
|
break; |
|
|
|
case TCG_TYPE_I64: |
|
|
|
xor_opc = INDEX_op_xor_i64; |
|
|
|
shr_opc = INDEX_op_shr_i64; |
|
|
|
neg_opc = INDEX_op_neg_i64; |
|
|
|
if (TCG_TARGET_extract_valid(TCG_TYPE_I64, sh, 1)) { |
|
|
|
@ -2406,7 +2403,7 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg) |
|
|
|
op2->args[1] = ret; |
|
|
|
op2->args[2] = arg_new_constant(ctx, -1); |
|
|
|
} else if (inv) { |
|
|
|
op2 = opt_insert_after(ctx, op, xor_opc, 3); |
|
|
|
op2 = opt_insert_after(ctx, op, INDEX_op_xor, 3); |
|
|
|
op2->args[0] = ret; |
|
|
|
op2->args[1] = ret; |
|
|
|
op2->args[2] = arg_new_constant(ctx, 1); |
|
|
|
@ -3051,7 +3048,8 @@ void tcg_optimize(TCGContext *s) |
|
|
|
CASE_OP_32_64(sub2): |
|
|
|
done = fold_sub2(&ctx, op); |
|
|
|
break; |
|
|
|
CASE_OP_32_64_VEC(xor): |
|
|
|
case INDEX_op_xor: |
|
|
|
case INDEX_op_xor_vec: |
|
|
|
done = fold_xor(&ctx, op); |
|
|
|
break; |
|
|
|
case INDEX_op_set_label: |
|
|
|
|