* [PATCH v2 00/27] tcg/optimize: Track and use known 1's
@ 2025-06-03 8:08 Richard Henderson
2025-06-03 8:08 ` [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val Richard Henderson
` (27 more replies)
0 siblings, 28 replies; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
We already track and use known 0's; do the same for 1's.
This actually simplifies some of the logical operations,
where before required checking for a constant value.
Changes for v2:
- Some simplifications suggested by Paolo.
- Merge affected bit handling into fold_masks_zosa.
There's an optimization ordering preference for
1) constant result
2) copy result
3) computed result
Having fold_affected_mask separate performed 2 before 1.
- Rearrange the and->extract optimization, because it
would perform 3 before 1 and 2.
r~
Richard Henderson (27):
tcg/optimize: Introduce arg_const_val
tcg/optimize: Add one's mask to TempOptInfo
tcg/optimize: Introduce fold_masks_zosa
tcg/optimize: Build and use o_bits in fold_and
tcg/optimize: Build and use o_bits in fold_andc
tcg/optimize: Build and use z_bits and o_bits in fold_eqv
tcg/optimize: Build and use z_bits and o_bits in fold_nand
tcg/optimize: Build and use z_bits and o_bits in fold_nor
tcg/optimize: Build and use z_bits and o_bits in fold_not
tcg/optimize: Build and use one and affected bits in fold_or
tcg/optimize: Build and use zero, one and affected bits in fold_orc
tcg/optimize: Build and use o_bits in fold_xor
tcg/optimize: Build and use o_bits in fold_bswap
tcg/optimize: Build and use o_bits in fold_deposit
tcg/optimize: Build and use o_bits in fold_extract
tcg/optimize: Build and use z_bits and o_bits in fold_extract2
tcg/optimize: Build and use o_bits in fold_exts
tcg/optimize: Build and use o_bits in fold_extu
tcg/optimize: Build and use o_bits in fold_movcond
tcg/optimize: Build and use o_bits in fold_sextract
tcg/optimize: Build and use o_bits in fold_shift
tcg/optimize: Use fold_and in do_constant_folding_cond[12]
tcg/optimize: Fold and to extract during optimize
tcg/optimize: Simplify fold_and constant checks
tcg/optimize: Simplify fold_andc constant checks
tcg/optimize: Simplify fold_orc constant checks
tcg/optimize: Simplify fold_eqv constant checks
tcg/optimize.c | 456 +++++++++++++++++++++++++++++--------------------
1 file changed, 274 insertions(+), 182 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 56+ messages in thread
* [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:45 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo Richard Henderson
` (26 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Use arg_const_val instead of direct access to the TempOptInfo val
member. Rename both val and is_const to catch all direct accesses.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 78 ++++++++++++++++++++++++++------------------------
1 file changed, 41 insertions(+), 37 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 10a76c5461..73a272eeb3 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -39,11 +39,11 @@ typedef struct MemCopyInfo {
} MemCopyInfo;
typedef struct TempOptInfo {
- bool is_const;
+ bool is_const_;
TCGTemp *prev_copy;
TCGTemp *next_copy;
QSIMPLEQ_HEAD(, MemCopyInfo) mem_copy;
- uint64_t val;
+ uint64_t val_;
uint64_t z_mask; /* mask bit is 0 if and only if value bit is 0 */
uint64_t s_mask; /* mask bit is 1 if value bit matches msb */
} TempOptInfo;
@@ -73,12 +73,12 @@ static inline TempOptInfo *arg_info(TCGArg arg)
static inline bool ti_is_const(TempOptInfo *ti)
{
- return ti->is_const;
+ return ti->is_const_;
}
static inline uint64_t ti_const_val(TempOptInfo *ti)
{
- return ti->val;
+ return ti->val_;
}
static inline bool ti_is_const_val(TempOptInfo *ti, uint64_t val)
@@ -101,6 +101,11 @@ static inline bool arg_is_const(TCGArg arg)
return ts_is_const(arg_temp(arg));
}
+static inline uint64_t arg_const_val(TCGArg arg)
+{
+ return ti_const_val(arg_info(arg));
+}
+
static inline bool arg_is_const_val(TCGArg arg, uint64_t val)
{
return ts_is_const_val(arg_temp(arg), val);
@@ -137,12 +142,12 @@ static void init_ts_info(OptContext *ctx, TCGTemp *ts)
ti->prev_copy = ts;
QSIMPLEQ_INIT(&ti->mem_copy);
if (ts->kind == TEMP_CONST) {
- ti->is_const = true;
- ti->val = ts->val;
+ ti->is_const_ = true;
+ ti->val_ = ts->val;
ti->z_mask = ts->val;
ti->s_mask = INT64_MIN >> clrsb64(ts->val);
} else {
- ti->is_const = false;
+ ti->is_const_ = false;
ti->z_mask = -1;
ti->s_mask = 0;
}
@@ -229,7 +234,7 @@ static void reset_ts(OptContext *ctx, TCGTemp *ts)
pi->next_copy = ti->next_copy;
ti->next_copy = ts;
ti->prev_copy = ts;
- ti->is_const = false;
+ ti->is_const_ = false;
ti->z_mask = -1;
ti->s_mask = 0;
@@ -394,8 +399,8 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src)
di->prev_copy = src_ts;
ni->prev_copy = dst_ts;
si->next_copy = dst_ts;
- di->is_const = si->is_const;
- di->val = si->val;
+ di->is_const_ = si->is_const_;
+ di->val_ = si->val_;
if (!QSIMPLEQ_EMPTY(&si->mem_copy)
&& cmp_better_copy(src_ts, dst_ts) == dst_ts) {
@@ -687,8 +692,8 @@ static int do_constant_folding_cond(TCGType type, TCGArg x,
TCGArg y, TCGCond c)
{
if (arg_is_const(x) && arg_is_const(y)) {
- uint64_t xv = arg_info(x)->val;
- uint64_t yv = arg_info(y)->val;
+ uint64_t xv = arg_const_val(x);
+ uint64_t yv = arg_const_val(y);
switch (type) {
case TCG_TYPE_I32:
@@ -801,14 +806,14 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
* TSTNE x,i -> NE x,0 if i includes all nonzero bits of x
*/
if (args_are_copies(*p1, *p2) ||
- (arg_is_const(*p2) && (i1->z_mask & ~arg_info(*p2)->val) == 0)) {
+ (arg_is_const(*p2) && (i1->z_mask & ~arg_const_val(*p2)) == 0)) {
*p2 = arg_new_constant(ctx, 0);
*pcond = tcg_tst_eqne_cond(cond);
return -1;
}
/* TSTNE x,i -> LT x,0 if i only includes sign bit copies */
- if (arg_is_const(*p2) && (arg_info(*p2)->val & ~i1->s_mask) == 0) {
+ if (arg_is_const(*p2) && (arg_const_val(*p2) & ~i1->s_mask) == 0) {
*p2 = arg_new_constant(ctx, 0);
*pcond = tcg_tst_ltge_cond(cond);
return -1;
@@ -849,13 +854,13 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGOp *op, TCGArg *args)
bh = args[3];
if (arg_is_const(bl) && arg_is_const(bh)) {
- tcg_target_ulong blv = arg_info(bl)->val;
- tcg_target_ulong bhv = arg_info(bh)->val;
+ tcg_target_ulong blv = arg_const_val(bl);
+ tcg_target_ulong bhv = arg_const_val(bh);
uint64_t b = deposit64(blv, 32, 32, bhv);
if (arg_is_const(al) && arg_is_const(ah)) {
- tcg_target_ulong alv = arg_info(al)->val;
- tcg_target_ulong ahv = arg_info(ah)->val;
+ tcg_target_ulong alv = arg_const_val(al);
+ tcg_target_ulong ahv = arg_const_val(ah);
uint64_t a = deposit64(alv, 32, 32, ahv);
r = do_constant_folding_cond_64(a, b, c);
@@ -989,9 +994,8 @@ static bool finish_folding(OptContext *ctx, TCGOp *op)
static bool fold_const1(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1])) {
- uint64_t t;
+ uint64_t t = arg_const_val(op->args[1]);
- t = arg_info(op->args[1])->val;
t = do_constant_folding(op->opc, ctx->type, t, 0);
return tcg_opt_gen_movi(ctx, op, op->args[0], t);
}
@@ -1001,8 +1005,8 @@ static bool fold_const1(OptContext *ctx, TCGOp *op)
static bool fold_const2(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
- uint64_t t1 = arg_info(op->args[1])->val;
- uint64_t t2 = arg_info(op->args[2])->val;
+ uint64_t t1 = arg_const_val(op->args[1]);
+ uint64_t t2 = arg_const_val(op->args[2]);
t1 = do_constant_folding(op->opc, ctx->type, t1, t2);
return tcg_opt_gen_movi(ctx, op, op->args[0], t1);
@@ -1486,8 +1490,8 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op)
}
if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) {
- uint64_t tv = arg_info(op->args[2])->val;
- uint64_t fv = arg_info(op->args[3])->val;
+ uint64_t tv = arg_const_val(op->args[2]);
+ uint64_t fv = arg_const_val(op->args[3]);
if (tv == -1 && fv == 0) {
return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]);
@@ -1504,7 +1508,7 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op)
}
}
if (arg_is_const(op->args[2])) {
- uint64_t tv = arg_info(op->args[2])->val;
+ uint64_t tv = arg_const_val(op->args[2]);
if (tv == -1) {
op->opc = INDEX_op_or_vec;
op->args[2] = op->args[3];
@@ -1518,7 +1522,7 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op)
}
}
if (arg_is_const(op->args[3])) {
- uint64_t fv = arg_info(op->args[3])->val;
+ uint64_t fv = arg_const_val(op->args[3]);
if (fv == 0) {
op->opc = INDEX_op_and_vec;
return fold_and(ctx, op);
@@ -1876,7 +1880,7 @@ static bool fold_divide(OptContext *ctx, TCGOp *op)
static bool fold_dup(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1])) {
- uint64_t t = arg_info(op->args[1])->val;
+ uint64_t t = arg_const_val(op->args[1]);
t = dup_const(TCGOP_VECE(op), t);
return tcg_opt_gen_movi(ctx, op, op->args[0], t);
}
@@ -1886,8 +1890,8 @@ static bool fold_dup(OptContext *ctx, TCGOp *op)
static bool fold_dup2(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
- uint64_t t = deposit64(arg_info(op->args[1])->val, 32, 32,
- arg_info(op->args[2])->val);
+ uint64_t t = deposit64(arg_const_val(op->args[1]), 32, 32,
+ arg_const_val(op->args[2]));
return tcg_opt_gen_movi(ctx, op, op->args[0], t);
}
@@ -1958,8 +1962,8 @@ static bool fold_extract(OptContext *ctx, TCGOp *op)
static bool fold_extract2(OptContext *ctx, TCGOp *op)
{
if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
- uint64_t v1 = arg_info(op->args[1])->val;
- uint64_t v2 = arg_info(op->args[2])->val;
+ uint64_t v1 = arg_const_val(op->args[1]);
+ uint64_t v2 = arg_const_val(op->args[2]);
int shr = op->args[3];
if (ctx->type == TCG_TYPE_I32) {
@@ -2127,8 +2131,8 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op)
swap_commutative(op->args[0], &op->args[2], &op->args[3]);
if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) {
- uint64_t a = arg_info(op->args[2])->val;
- uint64_t b = arg_info(op->args[3])->val;
+ uint64_t a = arg_const_val(op->args[2]);
+ uint64_t b = arg_const_val(op->args[3]);
uint64_t h, l;
TCGArg rl, rh;
TCGOp *op2;
@@ -2330,7 +2334,7 @@ static int fold_setcond_zmask(OptContext *ctx, TCGOp *op, bool neg)
}
a_zmask = arg_info(op->args[1])->z_mask;
- b_val = arg_info(op->args[2])->val;
+ b_val = arg_const_val(op->args[2]);
cond = op->args[3];
if (ctx->type == TCG_TYPE_I32) {
@@ -2418,7 +2422,7 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TCGOp *op, bool neg)
}
src2 = op->args[2];
- val = arg_info(src2)->val;
+ val = arg_const_val(src2);
if (!is_power_of_2(val)) {
return;
}
@@ -2669,7 +2673,7 @@ static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op)
TCGOpcode neg_op;
bool have_neg;
- if (!arg_is_const(op->args[1]) || arg_info(op->args[1])->val != 0) {
+ if (!arg_is_const_val(op->args[1], 0)) {
return false;
}
@@ -2719,7 +2723,7 @@ static bool fold_sub(OptContext *ctx, TCGOp *op)
/* Fold sub r,x,i to add r,x,-i */
if (arg_is_const(op->args[2])) {
- uint64_t val = arg_info(op->args[2])->val;
+ uint64_t val = arg_const_val(op->args[2]);
op->opc = INDEX_op_add;
op->args[2] = arg_new_constant(ctx, -val);
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
2025-06-03 8:08 ` [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:44 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa Richard Henderson
` (25 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Add o_mask mirroring z_mask, but for 1's instead of 0's.
Drop is_const and val fields, which now logically overlap.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 51 ++++++++++++++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 73a272eeb3..ce3cb4d7bc 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -39,12 +39,11 @@ typedef struct MemCopyInfo {
} MemCopyInfo;
typedef struct TempOptInfo {
- bool is_const_;
TCGTemp *prev_copy;
TCGTemp *next_copy;
QSIMPLEQ_HEAD(, MemCopyInfo) mem_copy;
- uint64_t val_;
uint64_t z_mask; /* mask bit is 0 if and only if value bit is 0 */
+ uint64_t o_mask; /* mask bit is 1 if and only if value bit is 1 */
uint64_t s_mask; /* mask bit is 1 if value bit matches msb */
} TempOptInfo;
@@ -73,12 +72,14 @@ static inline TempOptInfo *arg_info(TCGArg arg)
static inline bool ti_is_const(TempOptInfo *ti)
{
- return ti->is_const_;
+ /* If all bits that are not known zeros are known ones, it's constant. */
+ return ti->z_mask == ti->o_mask;
}
static inline uint64_t ti_const_val(TempOptInfo *ti)
{
- return ti->val_;
+ /* If constant, both z_mask and o_mask contain the value. */
+ return ti->z_mask;
}
static inline bool ti_is_const_val(TempOptInfo *ti, uint64_t val)
@@ -142,13 +143,12 @@ static void init_ts_info(OptContext *ctx, TCGTemp *ts)
ti->prev_copy = ts;
QSIMPLEQ_INIT(&ti->mem_copy);
if (ts->kind == TEMP_CONST) {
- ti->is_const_ = true;
- ti->val_ = ts->val;
ti->z_mask = ts->val;
+ ti->o_mask = ts->val;
ti->s_mask = INT64_MIN >> clrsb64(ts->val);
} else {
- ti->is_const_ = false;
ti->z_mask = -1;
+ ti->o_mask = 0;
ti->s_mask = 0;
}
}
@@ -234,8 +234,8 @@ static void reset_ts(OptContext *ctx, TCGTemp *ts)
pi->next_copy = ti->next_copy;
ti->next_copy = ts;
ti->prev_copy = ts;
- ti->is_const_ = false;
ti->z_mask = -1;
+ ti->o_mask = 0;
ti->s_mask = 0;
if (!QSIMPLEQ_EMPTY(&ti->mem_copy)) {
@@ -390,6 +390,7 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src)
op->args[1] = src;
di->z_mask = si->z_mask;
+ di->o_mask = si->o_mask;
di->s_mask = si->s_mask;
if (src_ts->type == dst_ts->type) {
@@ -399,13 +400,19 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op, TCGArg dst, TCGArg src)
di->prev_copy = src_ts;
ni->prev_copy = dst_ts;
si->next_copy = dst_ts;
- di->is_const_ = si->is_const_;
- di->val_ = si->val_;
if (!QSIMPLEQ_EMPTY(&si->mem_copy)
&& cmp_better_copy(src_ts, dst_ts) == dst_ts) {
move_mem_copies(dst_ts, src_ts);
}
+ } else if (dst_ts->type == TCG_TYPE_I32) {
+ di->z_mask = (int32_t)di->z_mask;
+ di->o_mask = (int32_t)di->o_mask;
+ di->s_mask |= INT32_MIN;
+ } else {
+ di->z_mask |= MAKE_64BIT_MASK(32, 32);
+ di->o_mask = (uint32_t)di->o_mask;
+ di->s_mask = INT64_MIN;
}
return true;
}
@@ -1032,8 +1039,8 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op)
* If z_mask allows, fold the output to constant zero.
* The passed s_mask may be augmented by z_mask.
*/
-static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
- uint64_t z_mask, int64_t s_mask)
+static bool fold_masks_zos(OptContext *ctx, TCGOp *op, uint64_t z_mask,
+ uint64_t o_mask, int64_t s_mask)
{
const TCGOpDef *def = &tcg_op_defs[op->opc];
TCGTemp *ts;
@@ -1052,11 +1059,16 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
*/
if (ctx->type == TCG_TYPE_I32) {
z_mask = (int32_t)z_mask;
+ o_mask = (int32_t)o_mask;
s_mask |= INT32_MIN;
}
- if (z_mask == 0) {
- return tcg_opt_gen_movi(ctx, op, op->args[0], 0);
+ /* Bits that are known 1 and bits that are known 0 must not overlap. */
+ tcg_debug_assert((o_mask & ~z_mask) == 0);
+
+ /* All bits that are not known zero are known one is a constant. */
+ if (z_mask == o_mask) {
+ return tcg_opt_gen_movi(ctx, op, op->args[0], o_mask);
}
ts = arg_temp(op->args[0]);
@@ -1068,20 +1080,27 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
/* Canonicalize s_mask and incorporate data from z_mask. */
rep = clz64(~s_mask);
rep = MAX(rep, clz64(z_mask));
+ rep = MAX(rep, clz64(~o_mask));
rep = MAX(rep - 1, 0);
ti->s_mask = INT64_MIN >> rep;
return true;
}
+static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t s_mask)
+{
+ return fold_masks_zos(ctx, op, z_mask, 0, s_mask);
+}
+
static bool fold_masks_z(OptContext *ctx, TCGOp *op, uint64_t z_mask)
{
- return fold_masks_zs(ctx, op, z_mask, 0);
+ return fold_masks_zos(ctx, op, z_mask, 0, 0);
}
static bool fold_masks_s(OptContext *ctx, TCGOp *op, uint64_t s_mask)
{
- return fold_masks_zs(ctx, op, -1, s_mask);
+ return fold_masks_zos(ctx, op, -1, 0, s_mask);
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
2025-06-03 8:08 ` [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val Richard Henderson
2025-06-03 8:08 ` [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:44 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and Richard Henderson
` (24 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Add a new function with an affected mask. This will allow
folding to a constant to happen before folding to a copy,
without having to mind the ordering in all users.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index ce3cb4d7bc..49ef039932 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1039,8 +1039,8 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op)
* If z_mask allows, fold the output to constant zero.
* The passed s_mask may be augmented by z_mask.
*/
-static bool fold_masks_zos(OptContext *ctx, TCGOp *op, uint64_t z_mask,
- uint64_t o_mask, int64_t s_mask)
+static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
+ uint64_t o_mask, int64_t s_mask, uint64_t a_mask)
{
const TCGOpDef *def = &tcg_op_defs[op->opc];
TCGTemp *ts;
@@ -1061,6 +1061,7 @@ static bool fold_masks_zos(OptContext *ctx, TCGOp *op, uint64_t z_mask,
z_mask = (int32_t)z_mask;
o_mask = (int32_t)o_mask;
s_mask |= INT32_MIN;
+ a_mask = (uint32_t)a_mask;
}
/* Bits that are known 1 and bits that are known 0 must not overlap. */
@@ -1071,6 +1072,11 @@ static bool fold_masks_zos(OptContext *ctx, TCGOp *op, uint64_t z_mask,
return tcg_opt_gen_movi(ctx, op, op->args[0], o_mask);
}
+ /* If no bits are affected, the operation devolves to a copy. */
+ if (a_mask == 0) {
+ return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]);
+ }
+
ts = arg_temp(op->args[0]);
reset_ts(ctx, ts);
@@ -1090,17 +1096,17 @@ static bool fold_masks_zos(OptContext *ctx, TCGOp *op, uint64_t z_mask,
static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
uint64_t z_mask, uint64_t s_mask)
{
- return fold_masks_zos(ctx, op, z_mask, 0, s_mask);
+ return fold_masks_zosa(ctx, op, z_mask, 0, s_mask, -1);
}
static bool fold_masks_z(OptContext *ctx, TCGOp *op, uint64_t z_mask)
{
- return fold_masks_zos(ctx, op, z_mask, 0, 0);
+ return fold_masks_zosa(ctx, op, z_mask, 0, 0, -1);
}
static bool fold_masks_s(OptContext *ctx, TCGOp *op, uint64_t s_mask)
{
- return fold_masks_zos(ctx, op, -1, 0, s_mask);
+ return fold_masks_zosa(ctx, op, -1, 0, s_mask, -1);
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (2 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:46 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc Richard Henderson
` (23 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 49ef039932..d9ccbb36e2 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1422,7 +1422,7 @@ static bool fold_addco(OptContext *ctx, TCGOp *op)
static bool fold_and(OptContext *ctx, TCGOp *op)
{
- uint64_t z1, z2, z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
@@ -1434,18 +1434,9 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
- z1 = t1->z_mask;
- z2 = t2->z_mask;
- /*
- * Known-zeros does not imply known-ones. Therefore unless
- * arg2 is constant, we can't infer affected bits from it.
- */
- if (ti_is_const(t2) && fold_affected_mask(ctx, op, z1 & ~z2)) {
- return true;
- }
-
- z_mask = z1 & z2;
+ z_mask = t1->z_mask & t2->z_mask;
+ o_mask = t1->o_mask & t2->o_mask;
/*
* Sign repetitions are perforce all identical, whether they are 1 or 0.
@@ -1453,7 +1444,10 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
*/
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ /* Affected bits are those not known zero, masked by those known one. */
+ a_mask = t1->z_mask & ~t2->o_mask;
+
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
}
static bool fold_andc(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (3 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:46 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv Richard Henderson
` (22 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index d9ccbb36e2..123734b167 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1452,7 +1452,7 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
static bool fold_andc(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
if (fold_const2(ctx, op) ||
@@ -1464,7 +1464,6 @@ static bool fold_andc(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
- z_mask = t1->z_mask;
if (ti_is_const(t2)) {
/* Fold andc r,x,i to and r,x,~i. */
@@ -1485,20 +1484,14 @@ static bool fold_andc(OptContext *ctx, TCGOp *op)
return fold_and(ctx, op);
}
- /*
- * Known-zeros does not imply known-ones. Therefore unless
- * arg2 is constant, we can't infer anything from it.
- */
- if (ti_is_const(t2)) {
- uint64_t v2 = ti_const_val(t2);
- if (fold_affected_mask(ctx, op, z_mask & v2)) {
- return true;
- }
- z_mask &= ~v2;
- }
-
+ z_mask = t1->z_mask & ~t2->o_mask;
+ o_mask = t1->o_mask & ~t2->z_mask;
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+
+ /* Affected bits are those not known zero, masked by those known zero. */
+ a_mask = t1->z_mask & t2->z_mask;
+
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
}
static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (4 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:47 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand Richard Henderson
` (21 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 123734b167..6d35a2e58b 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1093,6 +1093,12 @@ static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
return true;
}
+static bool fold_masks_zos(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t o_mask, uint64_t s_mask)
+{
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, -1);
+}
+
static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
uint64_t z_mask, uint64_t s_mask)
{
@@ -1916,7 +1922,7 @@ static bool fold_dup2(OptContext *ctx, TCGOp *op)
static bool fold_eqv(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
@@ -1946,8 +1952,12 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
}
t1 = arg_info(op->args[1]);
+
+ z_mask = (t1->z_mask | ~t2->o_mask) & (t2->z_mask | ~t1->o_mask);
+ o_mask = ~(t1->z_mask | t2->z_mask) | (t1->o_mask & t2->o_mask);
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_extract(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (5 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:47 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor Richard Henderson
` (20 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 6d35a2e58b..758f7b142e 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2197,16 +2197,22 @@ static bool fold_multiply2(OptContext *ctx, TCGOp *op)
static bool fold_nand(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask;
+ uint64_t z_mask, o_mask, s_mask;
+ TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
fold_xi_to_not(ctx, op, -1)) {
return true;
}
- s_mask = arg_info(op->args[1])->s_mask
- & arg_info(op->args[2])->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+ t1 = arg_info(op->args[1]);
+ t2 = arg_info(op->args[2]);
+
+ z_mask = ~(t1->o_mask & t2->o_mask);
+ o_mask = ~(t1->z_mask & t2->z_mask);
+ s_mask = t1->s_mask & t2->s_mask;
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_neg_no_const(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (6 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not Richard Henderson
` (19 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 758f7b142e..29d1f29124 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2231,16 +2231,22 @@ static bool fold_neg(OptContext *ctx, TCGOp *op)
static bool fold_nor(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask;
+ uint64_t z_mask, o_mask, s_mask;
+ TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
fold_xi_to_not(ctx, op, 0)) {
return true;
}
- s_mask = arg_info(op->args[1])->s_mask
- & arg_info(op->args[2])->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+ t1 = arg_info(op->args[1]);
+ t2 = arg_info(op->args[2]);
+
+ z_mask = ~(t1->o_mask | t2->o_mask);
+ o_mask = ~(t1->z_mask | t2->z_mask);
+ s_mask = t1->s_mask & t2->s_mask;
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_not(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (7 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or Richard Henderson
` (18 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 29d1f29124..d22396f6d7 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2251,10 +2251,14 @@ static bool fold_nor(OptContext *ctx, TCGOp *op)
static bool fold_not(OptContext *ctx, TCGOp *op)
{
+ TempOptInfo *t1;
+
if (fold_const1(ctx, op)) {
return true;
}
- return fold_masks_s(ctx, op, arg_info(op->args[1])->s_mask);
+
+ t1 = arg_info(op->args[1]);
+ return fold_masks_zos(ctx, op, ~t1->o_mask, ~t1->z_mask, t1->s_mask);
}
static bool fold_or(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (8 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc Richard Henderson
` (17 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index d22396f6d7..ce065d0e22 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2263,7 +2263,7 @@ static bool fold_not(OptContext *ctx, TCGOp *op)
static bool fold_or(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
@@ -2274,9 +2274,15 @@ static bool fold_or(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
+
z_mask = t1->z_mask | t2->z_mask;
+ o_mask = t1->o_mask | t2->o_mask;
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+
+ /* Affected bits are those not known one, masked by those known zero. */
+ a_mask = ~t1->o_mask & t2->z_mask;
+
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
}
static bool fold_orc(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (9 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:49 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor Richard Henderson
` (16 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index ce065d0e22..795f1c900e 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2287,7 +2287,7 @@ static bool fold_or(OptContext *ctx, TCGOp *op)
static bool fold_orc(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask;
+ uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
if (fold_const2(ctx, op) ||
@@ -2318,8 +2318,15 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
}
t1 = arg_info(op->args[1]);
+
+ z_mask = t1->z_mask | ~t2->o_mask;
+ o_mask = t1->o_mask | ~t2->z_mask;
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_s(ctx, op, s_mask);
+
+ /* Affected bits are those not known one, masked by those known one. */
+ a_mask = ~t1->o_mask & t2->o_mask;
+
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
}
static bool fold_qemu_ld_1reg(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (10 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:49 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap Richard Henderson
` (15 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 795f1c900e..572d314578 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -3039,7 +3039,7 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp *op)
static bool fold_xor(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1, *t2;
if (fold_const2_commutative(ctx, op) ||
@@ -3051,9 +3051,12 @@ static bool fold_xor(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
t2 = arg_info(op->args[2]);
- z_mask = t1->z_mask | t2->z_mask;
+
+ z_mask = (t1->z_mask | t2->z_mask) & ~(t1->o_mask & t2->o_mask);
+ o_mask = (t1->o_mask & ~t2->z_mask) | (t2->o_mask & ~t1->z_mask);
s_mask = t1->s_mask & t2->s_mask;
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
/* Propagate constants and copies, fold constant expressions. */
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (11 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:52 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit Richard Henderson
` (14 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 49 ++++++++++++++++++++++++-------------------------
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 572d314578..c9c53f796f 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1671,53 +1671,52 @@ static bool fold_brcond2(OptContext *ctx, TCGOp *op)
static bool fold_bswap(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask, sign;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1 = arg_info(op->args[1]);
+ int flags = op->args[2];
if (ti_is_const(t1)) {
return tcg_opt_gen_movi(ctx, op, op->args[0],
do_constant_folding(op->opc, ctx->type,
- ti_const_val(t1),
- op->args[2]));
+ ti_const_val(t1), flags));
}
z_mask = t1->z_mask;
+ o_mask = t1->o_mask;
+ s_mask = 0;
+
switch (op->opc) {
case INDEX_op_bswap16:
z_mask = bswap16(z_mask);
- sign = INT16_MIN;
+ o_mask = bswap16(o_mask);
+ if (flags & TCG_BSWAP_OS) {
+ z_mask = (int16_t)z_mask;
+ o_mask = (int16_t)o_mask;
+ s_mask = INT16_MIN;
+ } else if (!(flags & TCG_BSWAP_OZ)) {
+ z_mask |= MAKE_64BIT_MASK(16, 48);
+ }
break;
case INDEX_op_bswap32:
z_mask = bswap32(z_mask);
- sign = INT32_MIN;
+ o_mask = bswap32(o_mask);
+ if (flags & TCG_BSWAP_OS) {
+ z_mask = (int32_t)z_mask;
+ o_mask = (int32_t)o_mask;
+ s_mask = INT32_MIN;
+ } else if (!(flags & TCG_BSWAP_OZ)) {
+ z_mask |= MAKE_64BIT_MASK(32, 32);
+ }
break;
case INDEX_op_bswap64:
z_mask = bswap64(z_mask);
- sign = INT64_MIN;
+ o_mask = bswap64(o_mask);
break;
default:
g_assert_not_reached();
}
- s_mask = 0;
- switch (op->args[2] & (TCG_BSWAP_OZ | TCG_BSWAP_OS)) {
- case TCG_BSWAP_OZ:
- break;
- case TCG_BSWAP_OS:
- /* If the sign bit may be 1, force all the bits above to 1. */
- if (z_mask & sign) {
- z_mask |= sign;
- }
- /* The value and therefore s_mask is explicitly sign-extended. */
- s_mask = sign;
- break;
- default:
- /* The high bits are undefined: force all bits above the sign to 1. */
- z_mask |= sign << 1;
- break;
- }
-
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_call(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (12 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:53 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract Richard Henderson
` (13 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index c9c53f796f..043568a10d 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1847,7 +1847,7 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op)
int ofs = op->args[3];
int len = op->args[4];
int width = 8 * tcg_type_size(ctx->type);
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask;
if (ti_is_const(t1) && ti_is_const(t2)) {
return tcg_opt_gen_movi(ctx, op, op->args[0],
@@ -1882,7 +1882,9 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op)
}
z_mask = deposit64(t1->z_mask, ofs, len, t2->z_mask);
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ o_mask = deposit64(t1->o_mask, ofs, len, t2->o_mask);
+
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_divide(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (13 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Richard Henderson
` (12 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 043568a10d..f5fc0cfff9 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1963,7 +1963,7 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
static bool fold_extract(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask_old, z_mask;
+ uint64_t z_mask, o_mask, a_mask;
TempOptInfo *t1 = arg_info(op->args[1]);
int pos = op->args[2];
int len = op->args[3];
@@ -1973,13 +1973,11 @@ static bool fold_extract(OptContext *ctx, TCGOp *op)
extract64(ti_const_val(t1), pos, len));
}
- z_mask_old = t1->z_mask;
- z_mask = extract64(z_mask_old, pos, len);
- if (pos == 0 && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) {
- return true;
- }
+ z_mask = extract64(t1->z_mask, pos, len);
+ o_mask = extract64(t1->o_mask, pos, len);
+ a_mask = pos ? -1 : t1->z_mask ^ z_mask;
- return fold_masks_z(ctx, op, z_mask);
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, 0, a_mask);
}
static bool fold_extract2(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (14 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts Richard Henderson
` (11 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index f5fc0cfff9..86d958267a 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1099,6 +1099,12 @@ static bool fold_masks_zos(OptContext *ctx, TCGOp *op,
return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, -1);
}
+static bool fold_masks_zo(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t o_mask)
+{
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, 0, -1);
+}
+
static bool fold_masks_zs(OptContext *ctx, TCGOp *op,
uint64_t z_mask, uint64_t s_mask)
{
@@ -1982,21 +1988,27 @@ static bool fold_extract(OptContext *ctx, TCGOp *op)
static bool fold_extract2(OptContext *ctx, TCGOp *op)
{
- if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) {
- uint64_t v1 = arg_const_val(op->args[1]);
- uint64_t v2 = arg_const_val(op->args[2]);
- int shr = op->args[3];
+ TempOptInfo *t1 = arg_info(op->args[1]);
+ TempOptInfo *t2 = arg_info(op->args[2]);
+ uint64_t z1 = t1->z_mask;
+ uint64_t z2 = t2->z_mask;
+ uint64_t o1 = t1->o_mask;
+ uint64_t o2 = t2->o_mask;
+ int shr = op->args[3];
- if (ctx->type == TCG_TYPE_I32) {
- v1 = (uint32_t)v1 >> shr;
- v2 = (uint64_t)((int32_t)v2 << (32 - shr));
- } else {
- v1 >>= shr;
- v2 <<= 64 - shr;
- }
- return tcg_opt_gen_movi(ctx, op, op->args[0], v1 | v2);
+ if (ctx->type == TCG_TYPE_I32) {
+ z1 = (uint32_t)z1 >> shr;
+ o1 = (uint32_t)o1 >> shr;
+ z2 = (uint64_t)((int32_t)z2 << (32 - shr));
+ o2 = (uint64_t)((int32_t)o2 << (32 - shr));
+ } else {
+ z1 >>= shr;
+ o1 >>= shr;
+ z2 <<= 64 - shr;
+ o2 <<= 64 - shr;
}
- return finish_folding(ctx, op);
+
+ return fold_masks_zo(ctx, op, z1 | z2, o1 | o2);
}
static bool fold_exts(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (15 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu Richard Henderson
` (10 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 86d958267a..103c94b12f 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2013,7 +2013,7 @@ static bool fold_extract2(OptContext *ctx, TCGOp *op)
static bool fold_exts(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask, z_mask;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1;
if (fold_const1(ctx, op)) {
@@ -2022,17 +2022,19 @@ static bool fold_exts(OptContext *ctx, TCGOp *op)
t1 = arg_info(op->args[1]);
z_mask = t1->z_mask;
+ o_mask = t1->o_mask;
s_mask = t1->s_mask;
switch (op->opc) {
case INDEX_op_ext_i32_i64:
s_mask |= INT32_MIN;
z_mask = (int32_t)z_mask;
+ o_mask = (int32_t)o_mask;
break;
default:
g_assert_not_reached();
}
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_extu(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (16 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts Richard Henderson
@ 2025-06-03 8:08 ` Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond Richard Henderson
` (9 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:08 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 103c94b12f..42d5ee23c0 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2039,25 +2039,31 @@ static bool fold_exts(OptContext *ctx, TCGOp *op)
static bool fold_extu(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask;
+ uint64_t z_mask, o_mask;
+ TempOptInfo *t1;
if (fold_const1(ctx, op)) {
return true;
}
- z_mask = arg_info(op->args[1])->z_mask;
+ t1 = arg_info(op->args[1]);
+ z_mask = t1->z_mask;
+ o_mask = t1->o_mask;
+
switch (op->opc) {
case INDEX_op_extrl_i64_i32:
case INDEX_op_extu_i32_i64:
z_mask = (uint32_t)z_mask;
+ o_mask = (uint32_t)o_mask;
break;
case INDEX_op_extrh_i64_i32:
z_mask >>= 32;
+ o_mask >>= 32;
break;
default:
g_assert_not_reached();
}
- return fold_masks_z(ctx, op, z_mask);
+ return fold_masks_zo(ctx, op, z_mask, o_mask);
}
static bool fold_mb(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (17 preceding siblings ...)
2025-06-03 8:08 ` [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract Richard Henderson
` (8 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 42d5ee23c0..abcbee9111 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2097,7 +2097,7 @@ static bool fold_mov(OptContext *ctx, TCGOp *op)
static bool fold_movcond(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask;
+ uint64_t z_mask, o_mask, s_mask;
TempOptInfo *tt, *ft;
int i;
@@ -2123,6 +2123,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
tt = arg_info(op->args[3]);
ft = arg_info(op->args[4]);
z_mask = tt->z_mask | ft->z_mask;
+ o_mask = tt->o_mask & ft->o_mask;
s_mask = tt->s_mask & ft->s_mask;
if (ti_is_const(tt) && ti_is_const(ft)) {
@@ -2145,7 +2146,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op)
}
}
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
static bool fold_mul(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (18 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift Richard Henderson
` (7 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
This was the last use of fold_affected_mask,
now fully replaced by fold_masks_zosa.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index abcbee9111..673849f07a 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1121,22 +1121,6 @@ static bool fold_masks_s(OptContext *ctx, TCGOp *op, uint64_t s_mask)
return fold_masks_zosa(ctx, op, -1, 0, s_mask, -1);
}
-/*
- * An "affected" mask bit is 0 if and only if the result is identical
- * to the first input. Thus if the entire mask is 0, the operation
- * is equivalent to a copy.
- */
-static bool fold_affected_mask(OptContext *ctx, TCGOp *op, uint64_t a_mask)
-{
- if (ctx->type == TCG_TYPE_I32) {
- a_mask = (uint32_t)a_mask;
- }
- if (a_mask == 0) {
- return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]);
- }
- return false;
-}
-
/*
* Convert @op to NOT, if NOT is supported by the host.
* Return true f the conversion is successful, which will still
@@ -2669,7 +2653,7 @@ static bool fold_setcond2(OptContext *ctx, TCGOp *op)
static bool fold_sextract(OptContext *ctx, TCGOp *op)
{
- uint64_t z_mask, s_mask, s_mask_old;
+ uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1 = arg_info(op->args[1]);
int pos = op->args[2];
int len = op->args[3];
@@ -2679,16 +2663,14 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op)
sextract64(ti_const_val(t1), pos, len));
}
- s_mask_old = t1->s_mask;
- s_mask = s_mask_old >> pos;
+ s_mask = t1->s_mask >> pos;
s_mask |= -1ull << (len - 1);
-
- if (pos == 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old)) {
- return true;
- }
+ a_mask = pos ? -1 : s_mask & ~t1->s_mask;
z_mask = sextract64(t1->z_mask, pos, len);
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ o_mask = sextract64(t1->o_mask, pos, len);
+
+ return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
}
static bool fold_shift(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (19 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:56 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Richard Henderson
` (6 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 673849f07a..0b441bc611 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2675,7 +2675,7 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op)
static bool fold_shift(OptContext *ctx, TCGOp *op)
{
- uint64_t s_mask, z_mask;
+ uint64_t s_mask, z_mask, o_mask;
TempOptInfo *t1, *t2;
if (fold_const2(ctx, op) ||
@@ -2688,14 +2688,16 @@ static bool fold_shift(OptContext *ctx, TCGOp *op)
t2 = arg_info(op->args[2]);
s_mask = t1->s_mask;
z_mask = t1->z_mask;
+ o_mask = t1->o_mask;
if (ti_is_const(t2)) {
int sh = ti_const_val(t2);
z_mask = do_constant_folding(op->opc, ctx->type, z_mask, sh);
+ o_mask = do_constant_folding(op->opc, ctx->type, o_mask, sh);
s_mask = do_constant_folding(op->opc, ctx->type, s_mask, sh);
- return fold_masks_zs(ctx, op, z_mask, s_mask);
+ return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
}
switch (op->opc) {
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12]
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (20 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:56 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize Richard Henderson
` (5 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
When lowering tst comparisons, completely fold the and
opcode that we generate.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 0b441bc611..aa64f15779 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -784,6 +784,7 @@ static bool swap_commutative2(TCGArg *p1, TCGArg *p2)
* Return -1 if the condition can't be simplified,
* and the result of the condition (0 or 1) if it can.
*/
+static bool fold_and(OptContext *ctx, TCGOp *op);
static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
TCGArg *p1, TCGArg *p2, TCGArg *pcond)
{
@@ -834,6 +835,7 @@ static int do_constant_folding_cond1(OptContext *ctx, TCGOp *op, TCGArg dest,
op2->args[0] = tmp;
op2->args[1] = *p1;
op2->args[2] = *p2;
+ fold_and(ctx, op2);
*p1 = tmp;
*p2 = arg_new_constant(ctx, 0);
@@ -929,9 +931,12 @@ static int do_constant_folding_cond2(OptContext *ctx, TCGOp *op, TCGArg *args)
op1->args[0] = t1;
op1->args[1] = al;
op1->args[2] = bl;
+ fold_and(ctx, op1);
+
op2->args[0] = t2;
op2->args[1] = ah;
op2->args[2] = bh;
+ fold_and(ctx, op1);
args[0] = t1;
args[1] = t2;
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (21 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks Richard Henderson
` (4 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index aa64f15779..06ccf39d64 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1044,8 +1044,9 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op)
* If z_mask allows, fold the output to constant zero.
* The passed s_mask may be augmented by z_mask.
*/
-static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
- uint64_t o_mask, int64_t s_mask, uint64_t a_mask)
+static bool fold_masks_zosa_int(OptContext *ctx, TCGOp *op,
+ uint64_t z_mask, uint64_t o_mask,
+ int64_t s_mask, uint64_t a_mask)
{
const TCGOpDef *def = &tcg_op_defs[op->opc];
TCGTemp *ts;
@@ -1095,6 +1096,13 @@ static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
rep = MAX(rep - 1, 0);
ti->s_mask = INT64_MIN >> rep;
+ return false;
+}
+
+static bool fold_masks_zosa(OptContext *ctx, TCGOp *op, uint64_t z_mask,
+ uint64_t o_mask, int64_t s_mask, uint64_t a_mask)
+{
+ fold_masks_zosa_int(ctx, op, z_mask, o_mask, s_mask, -1);
return true;
}
@@ -1448,7 +1456,26 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
/* Affected bits are those not known zero, masked by those known one. */
a_mask = t1->z_mask & ~t2->o_mask;
- return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask);
+ if (!fold_masks_zosa_int(ctx, op, z_mask, o_mask, s_mask, a_mask)) {
+ if (ti_is_const(t2)) {
+ /*
+ * Canonicalize on extract, if valid. This aids x86 with its
+ * 2 operand MOVZBL and 2 operand AND, selecting the TCGOpcode
+ * which does not require matching operands. Other backends can
+ * trivially expand the extract to AND during code generation.
+ */
+ uint64_t val = ti_const_val(t2);
+ if (!(val & (val + 1))) {
+ unsigned len = ctz64(~val);
+ if (TCG_TARGET_extract_valid(ctx->type, 0, len)) {
+ op->opc = INDEX_op_extract;
+ op->args[2] = 0;
+ op->args[3] = len;
+ }
+ }
+ }
+ }
+ return true;
}
static bool fold_andc(OptContext *ctx, TCGOp *op)
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (22 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 25/27] tcg/optimize: Simplify fold_andc " Richard Henderson
` (3 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
If operand 2 is constant, then the computation of z_mask
and a_mask will produce the same results as the explicit
checks via fold_xi_to_i and fold_xi_to_x. Shift the call
of fold_xx_to_x down below the ti_is_const(t2) check.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 06ccf39d64..f3a2328fe4 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1434,10 +1434,7 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
- if (fold_const2_commutative(ctx, op) ||
- fold_xi_to_i(ctx, op, 0) ||
- fold_xi_to_x(ctx, op, -1) ||
- fold_xx_to_x(ctx, op)) {
+ if (fold_const2_commutative(ctx, op)) {
return true;
}
@@ -1473,6 +1470,8 @@ static bool fold_and(OptContext *ctx, TCGOp *op)
op->args[3] = len;
}
}
+ } else {
+ fold_xx_to_x(ctx, op);
}
}
return true;
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 25/27] tcg/optimize: Simplify fold_andc constant checks
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (23 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 26/27] tcg/optimize: Simplify fold_orc " Richard Henderson
` (2 subsequent siblings)
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
If operand 2 is constant, then the computation of z_mask and a_mask
will produce the same results as the explicit check via fold_xi_to_i.
Shift the calls of fold_xx_to_i and fold_ix_to_not down below the
i2->is_const check.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index f3a2328fe4..8d14a38f9d 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1482,10 +1482,7 @@ static bool fold_andc(OptContext *ctx, TCGOp *op)
uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
- if (fold_const2(ctx, op) ||
- fold_xx_to_i(ctx, op, 0) ||
- fold_xi_to_x(ctx, op, 0) ||
- fold_ix_to_not(ctx, op, -1)) {
+ if (fold_const2(ctx, op)) {
return true;
}
@@ -1510,6 +1507,10 @@ static bool fold_andc(OptContext *ctx, TCGOp *op)
op->args[2] = arg_new_constant(ctx, ~ti_const_val(t2));
return fold_and(ctx, op);
}
+ if (fold_xx_to_i(ctx, op, 0) ||
+ fold_ix_to_not(ctx, op, -1)) {
+ return true;
+ }
z_mask = t1->z_mask & ~t2->o_mask;
o_mask = t1->o_mask & ~t2->z_mask;
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 26/27] tcg/optimize: Simplify fold_orc constant checks
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (24 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 25/27] tcg/optimize: Simplify fold_andc " Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv " Richard Henderson
2025-06-23 18:45 ` [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
If operand 2 is constant, then the computation of z_mask and a_mask
will produce the same results as the explicit check via fold_xi_to_i.
Shift the calls of fold_xx_to_i and fold_ix_to_not down below the
i2->is_const check.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 8d14a38f9d..a48ddd9171 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2326,10 +2326,7 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
uint64_t z_mask, o_mask, s_mask, a_mask;
TempOptInfo *t1, *t2;
- if (fold_const2(ctx, op) ||
- fold_xx_to_i(ctx, op, -1) ||
- fold_xi_to_x(ctx, op, -1) ||
- fold_ix_to_not(ctx, op, 0)) {
+ if (fold_const2(ctx, op)) {
return true;
}
@@ -2352,7 +2349,10 @@ static bool fold_orc(OptContext *ctx, TCGOp *op)
op->args[2] = arg_new_constant(ctx, ~ti_const_val(t2));
return fold_or(ctx, op);
}
-
+ if (fold_xx_to_i(ctx, op, -1) ||
+ fold_ix_to_not(ctx, op, 0)) {
+ return true;
+ }
t1 = arg_info(op->args[1]);
z_mask = t1->z_mask | ~t2->o_mask;
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv constant checks
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (25 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 26/27] tcg/optimize: Simplify fold_orc " Richard Henderson
@ 2025-06-03 8:09 ` Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-23 18:45 ` [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
27 siblings, 1 reply; 56+ messages in thread
From: Richard Henderson @ 2025-06-03 8:09 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini
Both cases are handled by fold_xor after conversion.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index a48ddd9171..62a128bc9b 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1948,9 +1948,7 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op)
uint64_t z_mask, o_mask, s_mask;
TempOptInfo *t1, *t2;
- if (fold_const2_commutative(ctx, op) ||
- fold_xi_to_x(ctx, op, -1) ||
- fold_xi_to_not(ctx, op, 0)) {
+ if (fold_const2_commutative(ctx, op)) {
return true;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 56+ messages in thread
* Re: [PATCH v2 00/27] tcg/optimize: Track and use known 1's
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
` (26 preceding siblings ...)
2025-06-03 8:09 ` [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv " Richard Henderson
@ 2025-06-23 18:45 ` Richard Henderson
27 siblings, 0 replies; 56+ messages in thread
From: Richard Henderson @ 2025-06-23 18:45 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Pierrick Bouvier, Philippe Mathieu-Daudé
Ping.
On 6/3/25 01:08, Richard Henderson wrote:
> We already track and use known 0's; do the same for 1's.
> This actually simplifies some of the logical operations,
> where before required checking for a constant value.
>
> Changes for v2:
> - Some simplifications suggested by Paolo.
>
> - Merge affected bit handling into fold_masks_zosa.
> There's an optimization ordering preference for
> 1) constant result
> 2) copy result
> 3) computed result
> Having fold_affected_mask separate performed 2 before 1.
>
> - Rearrange the and->extract optimization, because it
> would perform 3 before 1 and 2.
>
>
> r~
>
>
> Richard Henderson (27):
> tcg/optimize: Introduce arg_const_val
> tcg/optimize: Add one's mask to TempOptInfo
> tcg/optimize: Introduce fold_masks_zosa
> tcg/optimize: Build and use o_bits in fold_and
> tcg/optimize: Build and use o_bits in fold_andc
> tcg/optimize: Build and use z_bits and o_bits in fold_eqv
> tcg/optimize: Build and use z_bits and o_bits in fold_nand
> tcg/optimize: Build and use z_bits and o_bits in fold_nor
> tcg/optimize: Build and use z_bits and o_bits in fold_not
> tcg/optimize: Build and use one and affected bits in fold_or
> tcg/optimize: Build and use zero, one and affected bits in fold_orc
> tcg/optimize: Build and use o_bits in fold_xor
> tcg/optimize: Build and use o_bits in fold_bswap
> tcg/optimize: Build and use o_bits in fold_deposit
> tcg/optimize: Build and use o_bits in fold_extract
> tcg/optimize: Build and use z_bits and o_bits in fold_extract2
> tcg/optimize: Build and use o_bits in fold_exts
> tcg/optimize: Build and use o_bits in fold_extu
> tcg/optimize: Build and use o_bits in fold_movcond
> tcg/optimize: Build and use o_bits in fold_sextract
> tcg/optimize: Build and use o_bits in fold_shift
> tcg/optimize: Use fold_and in do_constant_folding_cond[12]
> tcg/optimize: Fold and to extract during optimize
> tcg/optimize: Simplify fold_and constant checks
> tcg/optimize: Simplify fold_andc constant checks
> tcg/optimize: Simplify fold_orc constant checks
> tcg/optimize: Simplify fold_eqv constant checks
>
> tcg/optimize.c | 456 +++++++++++++++++++++++++++++--------------------
> 1 file changed, 274 insertions(+), 182 deletions(-)
>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo
2025-06-03 8:08 ` [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo Richard Henderson
@ 2025-06-25 14:44 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:44 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Add o_mask mirroring z_mask, but for 1's instead of 0's.
> Drop is_const and val fields, which now logically overlap.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 51 ++++++++++++++++++++++++++++++++++----------------
> 1 file changed, 35 insertions(+), 16 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa
2025-06-03 8:08 ` [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa Richard Henderson
@ 2025-06-25 14:44 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:44 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Add a new function with an affected mask. This will allow
> folding to a constant to happen before folding to a copy,
> without having to mind the ordering in all users.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val
2025-06-03 8:08 ` [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val Richard Henderson
@ 2025-06-25 14:45 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:45 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Use arg_const_val instead of direct access to the TempOptInfo val
> member. Rename both val and is_const to catch all direct accesses.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 78 ++++++++++++++++++++++++++------------------------
> 1 file changed, 41 insertions(+), 37 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and
2025-06-03 8:08 ` [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and Richard Henderson
@ 2025-06-25 14:46 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:46 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc
2025-06-03 8:08 ` [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc Richard Henderson
@ 2025-06-25 14:46 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:46 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 23 ++++++++---------------
> 1 file changed, 8 insertions(+), 15 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv
2025-06-03 8:08 ` [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv Richard Henderson
@ 2025-06-25 14:47 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:47 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand
2025-06-03 8:08 ` [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand Richard Henderson
@ 2025-06-25 14:47 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:47 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor
2025-06-03 8:08 ` [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor Richard Henderson
@ 2025-06-25 14:48 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:48 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not
2025-06-03 8:08 ` [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not Richard Henderson
@ 2025-06-25 14:48 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:48 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or
2025-06-03 8:08 ` [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or Richard Henderson
@ 2025-06-25 14:48 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:48 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc
2025-06-03 8:08 ` [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc Richard Henderson
@ 2025-06-25 14:49 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:49 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor
2025-06-03 8:08 ` [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor Richard Henderson
@ 2025-06-25 14:49 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:49 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap
2025-06-03 8:08 ` [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap Richard Henderson
@ 2025-06-25 14:52 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:52 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 49 ++++++++++++++++++++++++-------------------------
> 1 file changed, 24 insertions(+), 25 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit
2025-06-03 8:08 ` [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit Richard Henderson
@ 2025-06-25 14:53 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:53 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract
2025-06-03 8:08 ` [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract Richard Henderson
@ 2025-06-25 14:54 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:54 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2
2025-06-03 8:08 ` [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Richard Henderson
@ 2025-06-25 14:54 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:54 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 38 +++++++++++++++++++++++++-------------
> 1 file changed, 25 insertions(+), 13 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts
2025-06-03 8:08 ` [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts Richard Henderson
@ 2025-06-25 14:54 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:54 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu
2025-06-03 8:08 ` [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu Richard Henderson
@ 2025-06-25 14:55 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:55 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:08 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond
2025-06-03 8:09 ` [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond Richard Henderson
@ 2025-06-25 14:55 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:55 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract
2025-06-03 8:09 ` [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract Richard Henderson
@ 2025-06-25 14:55 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:55 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> This was the last use of fold_affected_mask,
> now fully replaced by fold_masks_zosa.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 30 ++++++------------------------
> 1 file changed, 6 insertions(+), 24 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift
2025-06-03 8:09 ` [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift Richard Henderson
@ 2025-06-25 14:56 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:56 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12]
2025-06-03 8:09 ` [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Richard Henderson
@ 2025-06-25 14:56 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:56 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> When lowering tst comparisons, completely fold the and
> opcode that we generate.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 5 +++++
> 1 file changed, 5 insertions(+)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize
2025-06-03 8:09 ` [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize Richard Henderson
@ 2025-06-25 14:57 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:57 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 33 ++++++++++++++++++++++++++++++---
> 1 file changed, 30 insertions(+), 3 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks
2025-06-03 8:09 ` [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks Richard Henderson
@ 2025-06-25 14:57 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:57 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> If operand 2 is constant, then the computation of z_mask
> and a_mask will produce the same results as the explicit
> checks via fold_xi_to_i and fold_xi_to_x. Shift the call
> of fold_xx_to_x down below the ti_is_const(t2) check.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 25/27] tcg/optimize: Simplify fold_andc constant checks
2025-06-03 8:09 ` [PATCH v2 25/27] tcg/optimize: Simplify fold_andc " Richard Henderson
@ 2025-06-25 14:57 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:57 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> If operand 2 is constant, then the computation of z_mask and a_mask
> will produce the same results as the explicit check via fold_xi_to_i.
> Shift the calls of fold_xx_to_i and fold_ix_to_not down below the
> i2->is_const check.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 26/27] tcg/optimize: Simplify fold_orc constant checks
2025-06-03 8:09 ` [PATCH v2 26/27] tcg/optimize: Simplify fold_orc " Richard Henderson
@ 2025-06-25 14:57 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:57 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> If operand 2 is constant, then the computation of z_mask and a_mask
> will produce the same results as the explicit check via fold_xi_to_i.
> Shift the calls of fold_xx_to_i and fold_ix_to_not down below the
> i2->is_const check.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
* Re: [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv constant checks
2025-06-03 8:09 ` [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv " Richard Henderson
@ 2025-06-25 14:57 ` Pierrick Bouvier
0 siblings, 0 replies; 56+ messages in thread
From: Pierrick Bouvier @ 2025-06-25 14:57 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: pbonzini
On 6/3/25 1:09 AM, Richard Henderson wrote:
> Both cases are handled by fold_xor after conversion.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tcg/optimize.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
^ permalink raw reply [flat|nested] 56+ messages in thread
end of thread, other threads:[~2025-06-25 14:58 UTC | newest]
Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 8:08 [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
2025-06-03 8:08 ` [PATCH v2 01/27] tcg/optimize: Introduce arg_const_val Richard Henderson
2025-06-25 14:45 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 02/27] tcg/optimize: Add one's mask to TempOptInfo Richard Henderson
2025-06-25 14:44 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 03/27] tcg/optimize: Introduce fold_masks_zosa Richard Henderson
2025-06-25 14:44 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 04/27] tcg/optimize: Build and use o_bits in fold_and Richard Henderson
2025-06-25 14:46 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 05/27] tcg/optimize: Build and use o_bits in fold_andc Richard Henderson
2025-06-25 14:46 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 06/27] tcg/optimize: Build and use z_bits and o_bits in fold_eqv Richard Henderson
2025-06-25 14:47 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 07/27] tcg/optimize: Build and use z_bits and o_bits in fold_nand Richard Henderson
2025-06-25 14:47 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 08/27] tcg/optimize: Build and use z_bits and o_bits in fold_nor Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 09/27] tcg/optimize: Build and use z_bits and o_bits in fold_not Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 10/27] tcg/optimize: Build and use one and affected bits in fold_or Richard Henderson
2025-06-25 14:48 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 11/27] tcg/optimize: Build and use zero, one and affected bits in fold_orc Richard Henderson
2025-06-25 14:49 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 12/27] tcg/optimize: Build and use o_bits in fold_xor Richard Henderson
2025-06-25 14:49 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 13/27] tcg/optimize: Build and use o_bits in fold_bswap Richard Henderson
2025-06-25 14:52 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 14/27] tcg/optimize: Build and use o_bits in fold_deposit Richard Henderson
2025-06-25 14:53 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 15/27] tcg/optimize: Build and use o_bits in fold_extract Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 16/27] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 17/27] tcg/optimize: Build and use o_bits in fold_exts Richard Henderson
2025-06-25 14:54 ` Pierrick Bouvier
2025-06-03 8:08 ` [PATCH v2 18/27] tcg/optimize: Build and use o_bits in fold_extu Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 19/27] tcg/optimize: Build and use o_bits in fold_movcond Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 20/27] tcg/optimize: Build and use o_bits in fold_sextract Richard Henderson
2025-06-25 14:55 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 21/27] tcg/optimize: Build and use o_bits in fold_shift Richard Henderson
2025-06-25 14:56 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Richard Henderson
2025-06-25 14:56 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 23/27] tcg/optimize: Fold and to extract during optimize Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 24/27] tcg/optimize: Simplify fold_and constant checks Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 25/27] tcg/optimize: Simplify fold_andc " Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 26/27] tcg/optimize: Simplify fold_orc " Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-03 8:09 ` [PATCH v2 27/27] tcg/optimize: Simplify fold_eqv " Richard Henderson
2025-06-25 14:57 ` Pierrick Bouvier
2025-06-23 18:45 ` [PATCH v2 00/27] tcg/optimize: Track and use known 1's Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).