tcg: Merge INDEX_op_sar_{i32,i64}

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-01-08 08:05:18 -08:00
parent b5aafbaa83
commit 3949f365eb
7 changed files with 18 additions and 26 deletions

View file

@ -458,10 +458,10 @@ static uint64_t do_constant_folding_2(TCGOpcode op, TCGType type,
}
return (uint64_t)x >> (y & 63);
case INDEX_op_sar_i32:
return (int32_t)x >> (y & 31);
case INDEX_op_sar_i64:
case INDEX_op_sar:
if (type == TCG_TYPE_I32) {
return (int32_t)x >> (y & 31);
}
return (int64_t)x >> (y & 63);
case INDEX_op_rotr_i32:
@ -2600,7 +2600,7 @@ static bool fold_shift(OptContext *ctx, TCGOp *op)
}
switch (op->opc) {
CASE_OP_32_64(sar):
case INDEX_op_sar:
/*
* Arithmetic right shift will not reduce the number of
* input sign repetitions.
@ -3027,7 +3027,7 @@ void tcg_optimize(TCGContext *s)
break;
CASE_OP_32_64(rotl):
CASE_OP_32_64(rotr):
CASE_OP_32_64(sar):
case INDEX_op_sar:
case INDEX_op_shl:
case INDEX_op_shr:
done = fold_shift(&ctx, op);