qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Subject: [PULL 06/29] tcg/optimize: Build and use z_bits and o_bits in fold_eqv
Date: Mon, 30 Jun 2025 09:28:32 -0600	[thread overview]
Message-ID: <20250630152855.148018-7-richard.henderson@linaro.org> (raw)
In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org>

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
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



  parent reply	other threads:[~2025-06-30 15:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 15:28 [PULL 00/29] tcg patch queue Richard Henderson
2025-06-30 15:28 ` [PULL 01/29] tcg/optimize: Introduce arg_const_val Richard Henderson
2025-06-30 15:28 ` [PULL 02/29] tcg/optimize: Add one's mask to TempOptInfo Richard Henderson
2025-06-30 15:28 ` [PULL 03/29] tcg/optimize: Introduce fold_masks_zosa Richard Henderson
2025-06-30 15:28 ` [PULL 04/29] tcg/optimize: Build and use o_bits in fold_and Richard Henderson
2025-06-30 15:28 ` [PULL 05/29] tcg/optimize: Build and use o_bits in fold_andc Richard Henderson
2025-06-30 15:28 ` Richard Henderson [this message]
2025-06-30 15:28 ` [PULL 07/29] tcg/optimize: Build and use z_bits and o_bits in fold_nand Richard Henderson
2025-06-30 15:28 ` [PULL 08/29] tcg/optimize: Build and use z_bits and o_bits in fold_nor Richard Henderson
2025-06-30 15:28 ` [PULL 09/29] tcg/optimize: Build and use z_bits and o_bits in fold_not Richard Henderson
2025-06-30 15:28 ` [PULL 10/29] tcg/optimize: Build and use one and affected bits in fold_or Richard Henderson
2025-06-30 15:28 ` [PULL 11/29] tcg/optimize: Build and use zero, one and affected bits in fold_orc Richard Henderson
2025-06-30 15:28 ` [PULL 12/29] tcg/optimize: Build and use o_bits in fold_xor Richard Henderson
2025-06-30 15:28 ` [PULL 13/29] tcg/optimize: Build and use o_bits in fold_bswap Richard Henderson
2025-06-30 15:28 ` [PULL 14/29] tcg/optimize: Build and use o_bits in fold_deposit Richard Henderson
2025-06-30 15:28 ` [PULL 15/29] tcg/optimize: Build and use o_bits in fold_extract Richard Henderson
2025-06-30 15:28 ` [PULL 16/29] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Richard Henderson
2025-06-30 15:28 ` [PULL 17/29] tcg/optimize: Build and use o_bits in fold_exts Richard Henderson
2025-06-30 15:28 ` [PULL 18/29] tcg/optimize: Build and use o_bits in fold_extu Richard Henderson
2025-06-30 15:28 ` [PULL 19/29] tcg/optimize: Build and use o_bits in fold_movcond Richard Henderson
2025-06-30 15:28 ` [PULL 20/29] tcg/optimize: Build and use o_bits in fold_sextract Richard Henderson
2025-06-30 15:28 ` [PULL 21/29] tcg/optimize: Build and use o_bits in fold_shift Richard Henderson
2025-06-30 15:28 ` [PULL 22/29] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Richard Henderson
2025-06-30 15:28 ` [PULL 23/29] tcg/optimize: Fold and to extract during optimize Richard Henderson
2025-06-30 15:28 ` [PULL 24/29] tcg/optimize: Simplify fold_and constant checks Richard Henderson
2025-06-30 15:28 ` [PULL 25/29] tcg/optimize: Simplify fold_andc " Richard Henderson
2025-06-30 15:28 ` [PULL 26/29] tcg/optimize: Simplify fold_orc " Richard Henderson
2025-06-30 15:28 ` [PULL 27/29] tcg/optimize: Simplify fold_eqv " Richard Henderson
2025-06-30 15:28 ` [PULL 28/29] tcg/riscv: Fix typo in tgen_extract Richard Henderson
2025-06-30 15:28 ` [PULL 29/29] tcg: Fix constant propagation in tcg_reg_alloc_dup Richard Henderson
2025-07-01 19:04   ` Michael Tokarev
2025-07-01 19:58     ` Richard Henderson
2025-07-01 11:22 ` [PULL 00/29] tcg patch queue Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250630152855.148018-7-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).