[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 29/60] tcg/optimize: Split out fold_extract, fold_sextract
From: |
Richard Henderson |
Subject: |
[PULL v2 29/60] tcg/optimize: Split out fold_extract, fold_sextract |
Date: |
Thu, 28 Oct 2021 21:32:58 -0700 |
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 48 ++++++++++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index faedbdbfb8..3bd5f043c8 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -888,6 +888,18 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
return fold_const2(ctx, op);
}
+static bool fold_extract(OptContext *ctx, TCGOp *op)
+{
+ if (arg_is_const(op->args[1])) {
+ uint64_t t;
+
+ t = arg_info(op->args[1])->val;
+ t = extract64(t, op->args[2], op->args[3]);
+ return tcg_opt_gen_movi(ctx, op, op->args[0], t);
+ }
+ return false;
+}
+
static bool fold_extract2(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
@@ -1126,6 +1138,18 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op)
return tcg_opt_gen_movi(ctx, op, op->args[0], i);
}
+static bool fold_sextract(OptContext *ctx, TCGOp *op)
+{
+ if (arg_is_const(op->args[1])) {
+ uint64_t t;
+
+ t = arg_info(op->args[1])->val;
+ t = sextract64(t, op->args[2], op->args[3]);
+ return tcg_opt_gen_movi(ctx, op, op->args[0], t);
+ }
+ return false;
+}
+
static bool fold_shift(OptContext *ctx, TCGOp *op)
{
return fold_const2(ctx, op);
@@ -1727,24 +1751,6 @@ void tcg_optimize(TCGContext *s)
}
break;
- CASE_OP_32_64(extract):
- if (arg_is_const(op->args[1])) {
- tmp = extract64(arg_info(op->args[1])->val,
- op->args[2], op->args[3]);
- tcg_opt_gen_movi(&ctx, op, op->args[0], tmp);
- continue;
- }
- break;
-
- CASE_OP_32_64(sextract):
- if (arg_is_const(op->args[1])) {
- tmp = sextract64(arg_info(op->args[1])->val,
- op->args[2], op->args[3]);
- tcg_opt_gen_movi(&ctx, op, op->args[0], tmp);
- continue;
- }
- break;
-
default:
break;
@@ -1779,6 +1785,9 @@ void tcg_optimize(TCGContext *s)
CASE_OP_32_64(eqv):
done = fold_eqv(&ctx, op);
break;
+ CASE_OP_32_64(extract):
+ done = fold_extract(&ctx, op);
+ break;
CASE_OP_32_64(extract2):
done = fold_extract2(&ctx, op);
break;
@@ -1856,6 +1865,9 @@ void tcg_optimize(TCGContext *s)
case INDEX_op_setcond2_i32:
done = fold_setcond2(&ctx, op);
break;
+ CASE_OP_32_64(sextract):
+ done = fold_sextract(&ctx, op);
+ break;
CASE_OP_32_64_VEC(sub):
done = fold_sub(&ctx, op);
break;
--
2.25.1
- [PULL v2 28/60] tcg/optimize: Split out fold_extract2, (continued)
- [PULL v2 28/60] tcg/optimize: Split out fold_extract2, Richard Henderson, 2021/10/29
- [PULL v2 30/60] tcg/optimize: Split out fold_deposit, Richard Henderson, 2021/10/29
- [PULL v2 32/60] tcg/optimize: Split out fold_bswap, Richard Henderson, 2021/10/29
- [PULL v2 33/60] tcg/optimize: Split out fold_dup, fold_dup2, Richard Henderson, 2021/10/29
- [PULL v2 34/60] tcg/optimize: Split out fold_mov, Richard Henderson, 2021/10/29
- [PULL v2 23/60] tcg/optimize: Split out fold_brcond, Richard Henderson, 2021/10/29
- [PULL v2 37/60] tcg/optimize: Split out fold_xi_to_i, Richard Henderson, 2021/10/29
- [PULL v2 31/60] tcg/optimize: Split out fold_count_zeros, Richard Henderson, 2021/10/29
- [PULL v2 36/60] tcg/optimize: Split out fold_xx_to_x, Richard Henderson, 2021/10/29
- [PULL v2 35/60] tcg/optimize: Split out fold_xx_to_i, Richard Henderson, 2021/10/29
- [PULL v2 29/60] tcg/optimize: Split out fold_extract, fold_sextract,
Richard Henderson <=
- [PULL v2 39/60] tcg/optimize: Split out fold_to_not, Richard Henderson, 2021/10/29
- [PULL v2 38/60] tcg/optimize: Add type to OptContext, Richard Henderson, 2021/10/29
- [PULL v2 40/60] tcg/optimize: Split out fold_sub_to_neg, Richard Henderson, 2021/10/29
- [PULL v2 41/60] tcg/optimize: Split out fold_xi_to_x, Richard Henderson, 2021/10/29
- [PULL v2 42/60] tcg/optimize: Split out fold_ix_to_i, Richard Henderson, 2021/10/29
- [PULL v2 43/60] tcg/optimize: Split out fold_masks, Richard Henderson, 2021/10/29
- [PULL v2 45/60] tcg/optimize: Expand fold_addsub2_i32 to 64-bit ops, Richard Henderson, 2021/10/29
- [PULL v2 48/60] tcg/optimize: Stop forcing z_mask to "garbage" for 32-bit values, Richard Henderson, 2021/10/29
- [PULL v2 60/60] softmmu: fix for "after access" watchpoints, Richard Henderson, 2021/10/29
- [PULL v2 44/60] tcg/optimize: Expand fold_mulu2_i32 to all 4-arg multiplies, Richard Henderson, 2021/10/29