From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297409; cv=none; d=zohomail.com; s=zohoarc; b=IswYMSkj8KoxUD/4/PrRzFWmfNiis1OAW4joifjaz+yuKY1zkIJuoa4GL17dzytLBL2F21zQLTykV8lFQh/g5XHbSRLBBRg/MGIAUzmL5CQ7FsFGW4rWxOQ/Qnp199hXYN2NUdO7rEE7HvW6NCk7K5tqVj7XuUtBrH5D42KpKRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297409; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9k8aWRJjxyTp4jNgYkvWpCY0WQOKjkozcD5mUGHV/AA=; b=BK5xxi9xlet0rIyR7YFlyAGcKSEKGqH4rWwYqCpTdi/nSAYW4OzKjDrrrlXiDW+54h//o8HNQnOvX+h3SukYg27o0xeXe8g/sXslDqexMHEHokxouhd+N2THjtdaZ3neHrR8Gm8rSsGxytJqemeHA1j22tSvWbFjtlHPwYIifrE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297409441897.7355507513822; Mon, 30 Jun 2025 08:30:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRl-0000RA-VL; Mon, 30 Jun 2025 11:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0000MY-QA for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:14 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRJ-0008Br-4V for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:06 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-611a7c617b4so1411821eaf.3 for ; Mon, 30 Jun 2025 08:29:00 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297338; x=1751902138; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9k8aWRJjxyTp4jNgYkvWpCY0WQOKjkozcD5mUGHV/AA=; b=bR1XR63jneIX+WC9li05ExO/VnB6mae82G9H1zY5cuJXMgfxDHESM8MU6AVPgnpxmp JVdC5ygXnioZ1oICLv50o2DEA6Uiz51WMAK96XsSrY6vy0/+UXSoCrxPixs09FCcmbwk LTmI9B5epHiDojHNUIdTsdEVP6ZH0ctGG0AG2o4f+FrCZpjRarRcWhnHuSVVg2IHJ015 XyNewqoQicwNKr/+JptQeaTBskGjHi+19Gi05Re+AKZE9+9vyjZd6Ety6WvI7zPpq18t LUFCFAFFL+/S32NkYI85EDawTTL3ZkobLRtWgNm9bNknM1rRF9ys00Xm3leaSR+VOgj0 KbwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297338; x=1751902138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9k8aWRJjxyTp4jNgYkvWpCY0WQOKjkozcD5mUGHV/AA=; b=N9HTEOcUoP6/O2s4KUqWLlnq6mLcw56Zde2+LTUXTozbuJ/KvHjIhjU/Qt6Krw/ded vM0FWdofZvGYoJXgF3QGRGAUh2YvHFKHtNME1MhKJSV/ME6lBUY3dChC/scZbp6cgfHw j4HmPmtdSd75eNRpZR3VcFV25qVvgRe6jC+o7M3L8FX2GPDtYaB3qIUtqeI5VVZR716S Ch7QvwnAJd2M1OUvB677gDD0wCGkcTdF/dOrt4QpzRwlFrLOhRj+/eisMoYyBsvqY7Fo TltGwOqM+k8LXJYWbKzSjrNXNwFlkXY16hr8oAnnZFlDKzUNUfxQ0oDCCN8bd/EsJJYQ heNw== X-Gm-Message-State: AOJu0YzBTC0R3q6pRrkkve6zFfEMz2VIEOHZXvrrqu4tCu9cZLY4UKPz SWkYFxWhixuy92WmWaDbYBo3FSkiLhD7TD8BpqCw1btgirXGSfX9czhPsfymVQgepsQsv6pvwXR B/lhs X-Gm-Gg: ASbGncv8fS6pKWu/Z1iU97T3PpvsnXXwCLfvKslzXJMKN6v98m+Y5uexTZ9IeVTaNBy VPfXQzsSC2yvKTH7m8odYWHPNLnyuK+Eh+hgrRft8asrqMfoOTQuFOCJiLIIeSYQFqLzsEv2wcB xX5EGcy41DAWCmCI+j/SygceOeeXf5qoH1/xoQ1rK9qLpvh5pMPEiqPq1IX6nclVNjFvqhW2oy2 dM18WkjFALiQC6rfzrkx0bVcsZvsubv0s2jTiz4ImnagGtKRG/PAZD2W9REqzJ0wTDkpCc2hthX 8uvu8C4iDae3yM2qv0CTpThe35+LQVQfDyDzAQ2pYMHBZcdzcya+GD+Hb7b15xxV7VllFw== X-Google-Smtp-Source: AGHT+IF33+2//z+3eMWjjYxXF30OjZur30vqemPptNFaGIHP5MgoWzZZu6Mi+B1GWcltPXet+NivBQ== X-Received: by 2002:a05:6871:588a:b0:29e:5de2:cffb with SMTP id 586e51a60fabf-2efed4f26ffmr9086174fac.17.1751297338358; Mon, 30 Jun 2025 08:28:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 01/29] tcg/optimize: Introduce arg_const_val Date: Mon, 30 Jun 2025 09:28:27 -0600 Message-ID: <20250630152855.148018-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297410998116600 Content-Type: text/plain; charset="utf-8" Use arg_const_val instead of direct access to the TempOptInfo val member. Rename both val and is_const to catch all direct accesses. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 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) =20 static inline bool ti_is_const(TempOptInfo *ti) { - return ti->is_const; + return ti->is_const_; } =20 static inline uint64_t ti_const_val(TempOptInfo *ti) { - return ti->val; + return ti->val_; } =20 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)); } =20 +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 =3D ts; QSIMPLEQ_INIT(&ti->mem_copy); if (ts->kind =3D=3D TEMP_CONST) { - ti->is_const =3D true; - ti->val =3D ts->val; + ti->is_const_ =3D true; + ti->val_ =3D ts->val; ti->z_mask =3D ts->val; ti->s_mask =3D INT64_MIN >> clrsb64(ts->val); } else { - ti->is_const =3D false; + ti->is_const_ =3D false; ti->z_mask =3D -1; ti->s_mask =3D 0; } @@ -229,7 +234,7 @@ static void reset_ts(OptContext *ctx, TCGTemp *ts) pi->next_copy =3D ti->next_copy; ti->next_copy =3D ts; ti->prev_copy =3D ts; - ti->is_const =3D false; + ti->is_const_ =3D false; ti->z_mask =3D -1; ti->s_mask =3D 0; =20 @@ -394,8 +399,8 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *op,= TCGArg dst, TCGArg src) di->prev_copy =3D src_ts; ni->prev_copy =3D dst_ts; si->next_copy =3D dst_ts; - di->is_const =3D si->is_const; - di->val =3D si->val; + di->is_const_ =3D si->is_const_; + di->val_ =3D si->val_; =20 if (!QSIMPLEQ_EMPTY(&si->mem_copy) && cmp_better_copy(src_ts, dst_ts) =3D=3D dst_ts) { @@ -687,8 +692,8 @@ static int do_constant_folding_cond(TCGType type, TCGAr= g x, TCGArg y, TCGCond c) { if (arg_is_const(x) && arg_is_const(y)) { - uint64_t xv =3D arg_info(x)->val; - uint64_t yv =3D arg_info(y)->val; + uint64_t xv =3D arg_const_val(x); + uint64_t yv =3D arg_const_val(y); =20 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) =3D=3D 0)= ) { + (arg_is_const(*p2) && (i1->z_mask & ~arg_const_val(*p2)) =3D=3D 0)= ) { *p2 =3D arg_new_constant(ctx, 0); *pcond =3D tcg_tst_eqne_cond(cond); return -1; } =20 /* 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) =3D=3D 0) { + if (arg_is_const(*p2) && (arg_const_val(*p2) & ~i1->s_mask) =3D=3D 0) { *p2 =3D arg_new_constant(ctx, 0); *pcond =3D tcg_tst_ltge_cond(cond); return -1; @@ -849,13 +854,13 @@ static int do_constant_folding_cond2(OptContext *ctx,= TCGOp *op, TCGArg *args) bh =3D args[3]; =20 if (arg_is_const(bl) && arg_is_const(bh)) { - tcg_target_ulong blv =3D arg_info(bl)->val; - tcg_target_ulong bhv =3D arg_info(bh)->val; + tcg_target_ulong blv =3D arg_const_val(bl); + tcg_target_ulong bhv =3D arg_const_val(bh); uint64_t b =3D deposit64(blv, 32, 32, bhv); =20 if (arg_is_const(al) && arg_is_const(ah)) { - tcg_target_ulong alv =3D arg_info(al)->val; - tcg_target_ulong ahv =3D arg_info(ah)->val; + tcg_target_ulong alv =3D arg_const_val(al); + tcg_target_ulong ahv =3D arg_const_val(ah); uint64_t a =3D deposit64(alv, 32, 32, ahv); =20 r =3D 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 =3D arg_const_val(op->args[1]); =20 - t =3D arg_info(op->args[1])->val; t =3D 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 =3D arg_info(op->args[1])->val; - uint64_t t2 =3D arg_info(op->args[2])->val; + uint64_t t1 =3D arg_const_val(op->args[1]); + uint64_t t2 =3D arg_const_val(op->args[2]); =20 t1 =3D 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 *o= p) } =20 if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { - uint64_t tv =3D arg_info(op->args[2])->val; - uint64_t fv =3D arg_info(op->args[3])->val; + uint64_t tv =3D arg_const_val(op->args[2]); + uint64_t fv =3D arg_const_val(op->args[3]); =20 if (tv =3D=3D -1 && fv =3D=3D 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 *o= p) } } if (arg_is_const(op->args[2])) { - uint64_t tv =3D arg_info(op->args[2])->val; + uint64_t tv =3D arg_const_val(op->args[2]); if (tv =3D=3D -1) { op->opc =3D INDEX_op_or_vec; op->args[2] =3D op->args[3]; @@ -1518,7 +1522,7 @@ static bool fold_bitsel_vec(OptContext *ctx, TCGOp *o= p) } } if (arg_is_const(op->args[3])) { - uint64_t fv =3D arg_info(op->args[3])->val; + uint64_t fv =3D arg_const_val(op->args[3]); if (fv =3D=3D 0) { op->opc =3D 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 =3D arg_info(op->args[1])->val; + uint64_t t =3D arg_const_val(op->args[1]); t =3D 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 =3D deposit64(arg_info(op->args[1])->val, 32, 32, - arg_info(op->args[2])->val); + uint64_t t =3D 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); } =20 @@ -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 =3D arg_info(op->args[1])->val; - uint64_t v2 =3D arg_info(op->args[2])->val; + uint64_t v1 =3D arg_const_val(op->args[1]); + uint64_t v2 =3D arg_const_val(op->args[2]); int shr =3D op->args[3]; =20 if (ctx->type =3D=3D 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]); =20 if (arg_is_const(op->args[2]) && arg_is_const(op->args[3])) { - uint64_t a =3D arg_info(op->args[2])->val; - uint64_t b =3D arg_info(op->args[3])->val; + uint64_t a =3D arg_const_val(op->args[2]); + uint64_t b =3D 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) } =20 a_zmask =3D arg_info(op->args[1])->z_mask; - b_val =3D arg_info(op->args[2])->val; + b_val =3D arg_const_val(op->args[2]); cond =3D op->args[3]; =20 if (ctx->type =3D=3D TCG_TYPE_I32) { @@ -2418,7 +2422,7 @@ static void fold_setcond_tst_pow2(OptContext *ctx, TC= GOp *op, bool neg) } =20 src2 =3D op->args[2]; - val =3D arg_info(src2)->val; + val =3D arg_const_val(src2); if (!is_power_of_2(val)) { return; } @@ -2669,7 +2673,7 @@ static bool fold_sub_to_neg(OptContext *ctx, TCGOp *o= p) TCGOpcode neg_op; bool have_neg; =20 - if (!arg_is_const(op->args[1]) || arg_info(op->args[1])->val !=3D 0) { + if (!arg_is_const_val(op->args[1], 0)) { return false; } =20 @@ -2719,7 +2723,7 @@ static bool fold_sub(OptContext *ctx, TCGOp *op) =20 /* Fold sub r,x,i to add r,x,-i */ if (arg_is_const(op->args[2])) { - uint64_t val =3D arg_info(op->args[2])->val; + uint64_t val =3D arg_const_val(op->args[2]); =20 op->opc =3D INDEX_op_add; op->args[2] =3D arg_new_constant(ctx, -val); --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297538; cv=none; d=zohomail.com; s=zohoarc; b=nqHi1nw9NoboUpFxRRuh9+Zy0OFCiS9myRkOq9/yAOP98MUvcMHysMBuzIvrTc23KQVnJTnqK68HjqO1tMQWvK16gVJ2kIc0lF9cWx2mce/LJh8lSo4ZZdQMvKJslQYjXeduMY7545MY6f4kDAe4OplRPnt/n+DqnL1qKrbHd0s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297538; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M12tAd32b4j4J9tYOUE2ZqQJWZcff/+m5slN6I8JAp0=; b=APzB4It+JEV7s8WWhmWgTW4Y2VEVK/1TjMP/4+biXF1zIzMs/udLfa4yrrRe0tzDwNg5T3M1v+7vzAokMfUiR3JYV8Hrig7v0NuGstbjy45F2y6/ODx6SYMDKpYj6rWysB+zqCDA863IDeIJSB7wPfu7fIozQMwYD7mnJVpyODI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297538176393.4967837774941; Mon, 30 Jun 2025 08:32:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRa-0000QM-4r; Mon, 30 Jun 2025 11:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0000Ma-QI for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:14 -0400 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRL-0008Bz-GR for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:10 -0400 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-60d63174f05so502202eaf.0 for ; Mon, 30 Jun 2025 08:29:00 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297339; x=1751902139; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M12tAd32b4j4J9tYOUE2ZqQJWZcff/+m5slN6I8JAp0=; b=YwB6OnWYcUKAfzkG8LGPJZO5fOQHwGN8jTmOfspdXSKFX/huHFNdvSB4m3TC4FjrKg ZuMjrjTdz4V9nGa44mcrGN4QhXGWipxWRfqRE64vwrTa9cXrIM/la5VKA9V8nEs5KmTv NjxUVvm78pBkK4jV71TtLBJM6jriDNdGxz3jU3Zrl6ajr172HNgEC9icKNr8nXKTFXI/ AY8Uptozj19ADFkJRy1N+RcIQkU5wNvSfl6oTIKjuYI6z60NrG+2rgRegtuhLWtinjVy 8jtEgCNAdIAM/723m13fomgYJ/1OYk08SrHZ535HGa7Gfv6NgUTQYVoBEU/A21FGMx/Z ekfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297339; x=1751902139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M12tAd32b4j4J9tYOUE2ZqQJWZcff/+m5slN6I8JAp0=; b=kGDpEJXC6ioMP3poAICRxQUZasvXcf9ddyEAUe34OvGZyrBbKRlv1pDIc41nA6ntZQ mWijB6UX4Vjbb3VwHaLV3fDuQp6pKjY8h6mEJ+eLfulx7mT9OPdjEG9UazPQjlSf1V8r zxspRQGUzA98QLO2WCtWEWaBDRj5brS1Xyh0nJrWJCrUjweDyeVdwt2yTkZqJKHUpCjl O93eGGSgMmeUPplzcOe011HPjrUnh+tltJUNIgyu0XJBai81ryuLiesAVaxYjajK6CGo c1Lfdd2JLSvzyNZLm6TvqpV8TewK1z9ZnY48TmPUDvcLCi4pblDzGUqE22GXHinlyI2j +sGA== X-Gm-Message-State: AOJu0YwYt9Xxbf+qUM2samBuy6lote4wWTZgHc/qgH47EPbQ5J5sTqpP xx4tvG0A/oz9dbPBncd7SXmUkvW0keZnOMw8c4k8G9aaLL3wufcKhjBfyhmNIiBVjgHrjUvtxRr 8DE9h X-Gm-Gg: ASbGncuxQRg/MJSEfYCXJQecuh2NtP1vpLCxs9XYNhy0MEuCl7xReIyRbnP6mpH7FcI SAz9f+1zN0CHJj3L/nKlXdSsxRaBMPWbvHkB6XNP63c6ilYW2w+44VuMs8iRpfDgE6uGFVf+BV1 7ynwMHm1FDaUbMw5HGVpMIRaFAAumCPtV4FwupFA41Do4ZLp0Y/D65xoq2MBG/jOOeaxY5TRR0j cFh17J/YVzeepyJ8TlVBFIM0oFPKyrL7kKcjkURttLUI/ca2+5oQ3DVjTAw/umbMlzbpzJbI4jg +QCdzi1pHL/F5y2x91f4Nzpv5IzXF+yJxA+MuK9P9HxkqD5M1pIZcnYDVIAoeBgE/bnSxg== X-Google-Smtp-Source: AGHT+IE6iN6wCvs6SA5USnRkYkzCZfiX+BYq54eNNT+0jbKtyOo478uuUe5TnX4ZYsZZMKNQCPScbQ== X-Received: by 2002:a05:6871:451:b0:2c2:4e19:1cdf with SMTP id 586e51a60fabf-2efed6bc3d9mr9577489fac.25.1751297339129; Mon, 30 Jun 2025 08:28:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 02/29] tcg/optimize: Add one's mask to TempOptInfo Date: Mon, 30 Jun 2025 09:28:28 -0600 Message-ID: <20250630152855.148018-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c29; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc29.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297540667116600 Content-Type: text/plain; charset="utf-8" Add o_mask mirroring z_mask, but for 1's instead of 0's. Drop is_const and val fields, which now logically overlap. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 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; =20 @@ -73,12 +72,14 @@ static inline TempOptInfo *arg_info(TCGArg arg) =20 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 =3D=3D ti->o_mask; } =20 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; } =20 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 =3D ts; QSIMPLEQ_INIT(&ti->mem_copy); if (ts->kind =3D=3D TEMP_CONST) { - ti->is_const_ =3D true; - ti->val_ =3D ts->val; ti->z_mask =3D ts->val; + ti->o_mask =3D ts->val; ti->s_mask =3D INT64_MIN >> clrsb64(ts->val); } else { - ti->is_const_ =3D false; ti->z_mask =3D -1; + ti->o_mask =3D 0; ti->s_mask =3D 0; } } @@ -234,8 +234,8 @@ static void reset_ts(OptContext *ctx, TCGTemp *ts) pi->next_copy =3D ti->next_copy; ti->next_copy =3D ts; ti->prev_copy =3D ts; - ti->is_const_ =3D false; ti->z_mask =3D -1; + ti->o_mask =3D 0; ti->s_mask =3D 0; =20 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] =3D src; =20 di->z_mask =3D si->z_mask; + di->o_mask =3D si->o_mask; di->s_mask =3D si->s_mask; =20 if (src_ts->type =3D=3D dst_ts->type) { @@ -399,13 +400,19 @@ static bool tcg_opt_gen_mov(OptContext *ctx, TCGOp *o= p, TCGArg dst, TCGArg src) di->prev_copy =3D src_ts; ni->prev_copy =3D dst_ts; si->next_copy =3D dst_ts; - di->is_const_ =3D si->is_const_; - di->val_ =3D si->val_; =20 if (!QSIMPLEQ_EMPTY(&si->mem_copy) && cmp_better_copy(src_ts, dst_ts) =3D=3D dst_ts) { move_mem_copies(dst_ts, src_ts); } + } else if (dst_ts->type =3D=3D TCG_TYPE_I32) { + di->z_mask =3D (int32_t)di->z_mask; + di->o_mask =3D (int32_t)di->o_mask; + di->s_mask |=3D INT32_MIN; + } else { + di->z_mask |=3D MAKE_64BIT_MASK(32, 32); + di->o_mask =3D (uint32_t)di->o_mask; + di->s_mask =3D 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 =3D &tcg_op_defs[op->opc]; TCGTemp *ts; @@ -1052,11 +1059,16 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *o= p, */ if (ctx->type =3D=3D TCG_TYPE_I32) { z_mask =3D (int32_t)z_mask; + o_mask =3D (int32_t)o_mask; s_mask |=3D INT32_MIN; } =20 - if (z_mask =3D=3D 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) =3D=3D 0); + + /* All bits that are not known zero are known one is a constant. */ + if (z_mask =3D=3D o_mask) { + return tcg_opt_gen_movi(ctx, op, op->args[0], o_mask); } =20 ts =3D arg_temp(op->args[0]); @@ -1068,20 +1080,27 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *o= p, /* Canonicalize s_mask and incorporate data from z_mask. */ rep =3D clz64(~s_mask); rep =3D MAX(rep, clz64(z_mask)); + rep =3D MAX(rep, clz64(~o_mask)); rep =3D MAX(rep - 1, 0); ti->s_mask =3D INT64_MIN >> rep; =20 return true; } =20 +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); } =20 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); } =20 /* --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297502; cv=none; d=zohomail.com; s=zohoarc; b=lpj/UxiU2oDqDn5zecnhp4xUDd905mR/xYdkRRIgPCkwyeOCnI5ypGchix3GUlKu9qJ7rcP49JBvjcox7Y+EDBYZkoOeQLQFcBq8ub+tuMPfRspFFu9oqmkVh7LYlFfGxpRwcajDwDtKVQ2XqqWB7iqTbCBbqCQASLDBIMfP5do= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297502; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wYFMkZRnODWXYI8aKbzMijakPdkXTuLx1FksNfTSw70=; b=k4bMP2bj8bKvoCPZ3DNNqBIpT2/V0llsv9PfDcLs6XlXb5t0wztINAdSNLbUB0ccEDOhUQj1mXaB6JeEe7tylDS/cOif4bEbdVVvkmnnATOJoYQ+dZ9xxOrZGvliSzRAO8H+Z2tTFmehLoYSkyz8+CKi4ScetZ3bae6MPxWQ3fQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297502867255.60402315470446; Mon, 30 Jun 2025 08:31:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRa-0000QK-2z; Mon, 30 Jun 2025 11:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0000MU-N4 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:14 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRL-0008C8-QV for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:07 -0400 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-72c14138668so1388551a34.2 for ; Mon, 30 Jun 2025 08:29:01 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297340; x=1751902140; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wYFMkZRnODWXYI8aKbzMijakPdkXTuLx1FksNfTSw70=; b=mNFFzk6hqi4jSI9e710xJ+PswnurkwhTkGrCFJIHAu429/bx1cvAchNepG2dp8b52L rl+G5QjOSRScPBWnNRXB9Xr0aCoNMhS3Ku6oWsdPzSYN6znCCRH7n03En7HufLmxe20r JeY9+fPZhRiQZbnGsPmhIhWffRFdn1/v58VmRMOdK+6yAYOb4stQ23YB4LqRI5qmLQNu jC47A07I1HZjdMXeDC6K4WokQdpsO8iz4+qP7aJgu1meJI0ft+NYWRqJGmFNiR5XyQTN Mrw3zd2x3Jryu/QzAyzWh6DNnwgWoKlvsq9PeUeYD0s2L/f0WVwRVtgLANIsdADxAmZz jl9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297340; x=1751902140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wYFMkZRnODWXYI8aKbzMijakPdkXTuLx1FksNfTSw70=; b=nXU0kJq7KbxugGsxf/s9xnxboWdVN0QUT79ki/UUdRm6K836Zn/IdLs5tsMdytCgoU kGJdoVCauLECvm/RsJa59FzxSu6Lu7QN1Tr/6H+20xt1RgZBZB9NtwDtdf2namWN1WHN uoPCQqtjdQ6MRfjbPtnFM5mPrm1cjjypGToFKh5asb/LLHKs1hQv+0I+yYjQPlujd3Hy +eHLy73fZk5hmRbzqn61PClLwV1qHveKCjeHojx1pe9jwU/psap3K27QI34wnm6mcJv3 DTvZED7eZAZOnC+i9DyYATIAohhvVkihNGWfEwg9eg8VglcEr9L3LKa+9KBILx7B2e1g 6ngA== X-Gm-Message-State: AOJu0YxriLHaUcXsDRdmaCn/aM/CVY8zquJrm95KmqHbJIvF5zZJ1Jj1 7OuXXD5XNZbYtAi0vHTQnwNqpx6NHjoSmqVEUhym17CdkpR91RNfMAALD6zqk/YjOxIf36gUtvA WHDnI X-Gm-Gg: ASbGncvo6IlVabS2ejyfsSE3C6jNMHBRzLFUAL0r1Nn2VoBB07vlSafYcPe7T+0CDpb IbnIdCh8/MZvLMLN6lllLY8lY6+Nq3rx9Pb3vRhXhn44ds0r7pMP2oUzT4exWALAz5w4kVpIAp0 cvUUXxLRCGNQfuWuKy3tKkR0TInIsWQOcSpTyqA7n+5ciTm+IHWF79P+Ns1xp4OeRyzRqruWmaN FFQzdx1/JHaO96dSNWwfzcbZKN2rotLRxxgtHj3MdSt/VQSk8nkQFlqC9QDLddKgL0U+MKnmGHX UhvCVb9zn1vpqvI5IKvd1925o76afvxzQh70JQC6zHsT5CAmU8/ji6KV6cOw3BV/L2LvIw== X-Google-Smtp-Source: AGHT+IEf3Tgf9IdmLblcBIjNPX9XRYSmcfMfEYooXUB94kSuEdAeqahqvETES6LuV6DYtxflUFLNGQ== X-Received: by 2002:a05:6830:2c01:b0:739:f7a5:66c with SMTP id 46e09a7af769-73afc2cf333mr8472664a34.0.1751297339937; Mon, 30 Jun 2025 08:28:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 03/29] tcg/optimize: Introduce fold_masks_zosa Date: Mon, 30 Jun 2025 09:28:29 -0600 Message-ID: <20250630152855.148018-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297504099116600 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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_ma= sk) { const TCGOpDef *def =3D &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 =3D (int32_t)z_mask; o_mask =3D (int32_t)o_mask; s_mask |=3D INT32_MIN; + a_mask =3D (uint32_t)a_mask; } =20 /* 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 *o= p, uint64_t z_mask, return tcg_opt_gen_movi(ctx, op, op->args[0], o_mask); } =20 + /* If no bits are affected, the operation devolves to a copy. */ + if (a_mask =3D=3D 0) { + return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[1]); + } + ts =3D arg_temp(op->args[0]); reset_ts(ctx, ts); =20 @@ -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); } =20 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); } =20 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); } =20 /* --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297945; cv=none; d=zohomail.com; s=zohoarc; b=CeTUgut+5z9vUnJNpOdWfcQTN9AGO1KVa6ox4VWiijDytMgrcI6qjeyWlh2U9jg83Zx+SC76cwPIcIO95OUImfr66YtWDkULWfhVFmcCp8zhvXsPQAkoFLC/tEf/VwBtpi+yvsfxdgkwK8xsOuf+DjccJXcVEW2Gi2qcRPUW9iQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297945; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jMI3zk1yx7l0ZvxOUeqOoFW7RCKjr7ZEIlQI75AA6SE=; b=HkfXg2Q4VAAtq9kahrGqjsiMBSnErtHYZfQ74uhOgWSb41j5R3PiMhCzXcCu5JubM7ARbMPLETcg71WwN1sgIY4egzlPs8MF/naTtTsbn1x2QWxKzCKMnSizuv5X/xO3hLjKCUfqiiWo0O+G1D0PjNI81rLL13TXHpOYGdONct4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297945953112.55699042232015; Mon, 30 Jun 2025 08:39:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRW-0000MA-4l; Mon, 30 Jun 2025 11:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRN-0000L7-FN for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:08 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRL-0008CE-EG for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:05 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-73a43d327d6so1152074a34.2 for ; Mon, 30 Jun 2025 08:29:01 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297341; x=1751902141; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jMI3zk1yx7l0ZvxOUeqOoFW7RCKjr7ZEIlQI75AA6SE=; b=KCgK177sx0JKReZZkHgLFD/2rLfzvBwXRahhM3WVd804UTxZlCZyOWWDMiQxF/Ypn1 Mh/tOKVP8ZtKNwQR/c7l5nOfUrauMYmeICFZFw7AxYjyyro4ZUkSkXpE1EhVMYuQOyxV DSmmOKJawz0YAIAh5b7iSxiFC2wQfsdM2KCsgF1oCbqbWCBe9J9LFaym/CYK53BAHxB/ pz9MGuT+gABsavWbfxtsDGikgWw+e7QqIBl6yVP7ZC9M4bDpxN1ewmvnCyYIETk19/4H Bfp7Lm0gNpCjKIXVU/1R2+IDZHKrj3xegqPuP8bVL9yCClFxPPNg1PB8fUgEtZSrVHo4 F/6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297341; x=1751902141; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jMI3zk1yx7l0ZvxOUeqOoFW7RCKjr7ZEIlQI75AA6SE=; b=L7+LY+/LmMAIz7l2bOXZCGCQY9niyhMa+nNdxDAltbI9YJNR1bAA4/qjYHdUrqUQru BsOe1cLsht5Ro8NckZL4JmTfXp2LMaHcIRMU3wmE8GI0Ty3dnc2I3T7d5p6dNAi2GrkI ZMnP+3miWTJaN+mLUab2ySp/tCTcXAd0/G6EpA0ugDAd6rwrxCpohmlc/XMiiUj37f5A 5aZjMJTM7JniphYwDibHBuNdsr//3dILk+Hz7KodTYsJSfuO4NNiNji5SAzD+JlxlIo7 /hArwIn/dnLjHsyh5kRydFDGMahzQNv7B/BevQHc+J/+QWgf3suCM38v01r+ksqvUZVt MVNg== X-Gm-Message-State: AOJu0YzU6SbfENhGFSJjK9c/Bz6rW4w5+Ig/2rpBKKJYVcwEOrm/VzJf +EesHIHDp2a2zh8OqBktW5Ljy0//kLMuDC9p7aJ6haJ2sAkJtdOVDGPrYOyPtQC5JfLjJcHCwkX y9/AK X-Gm-Gg: ASbGncv4L3q6TcINAMeL0gMPYQRemDEjzh7LaLUlv5vhWEkX3++37xIZ7okTA5BJSwE HngnjE6eV2PajYm9YJQ71XHDLhswVXUtrz6y0RUV2/MM787+7r91gD+hGhefMnW021x8MW2GZ9J hx/HolhmSLfMkZgk+UnAbN+KdcnjoknDh9ZujwiZ/Wa/0u0zRBXXazZX8wuOuJjAgvnaGhA0nm6 bqzT+Le5CiNU2SkP30eLuszrgWyrrDZC0SNKlRjLfyyLxbM2ycgDsoSYdkiQSQ1v4oQ/DHdbfnt 1k9g8xwEvKOLnfQTi1Dj4MXuW41HaXC2brFKoo/UhmYJdG1Pyx5G2p1PcjIg1jDzqEi4mg== X-Google-Smtp-Source: AGHT+IFOimJtMECRJ37QymRBkd5IBS+R0nigGFd23VswaTuTca44zBjBci2ECOJpRrf5OpBeMhr0sw== X-Received: by 2002:a9d:6014:0:b0:73b:1efa:5f6d with SMTP id 46e09a7af769-73b1efa6d00mr3355738a34.16.1751297340892; Mon, 30 Jun 2025 08:29:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 04/29] tcg/optimize: Build and use o_bits in fold_and Date: Mon, 30 Jun 2025 09:28:30 -0600 Message-ID: <20250630152855.148018-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297946625116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 if (fold_const2_commutative(ctx, op) || @@ -1434,18 +1434,9 @@ static bool fold_and(OptContext *ctx, TCGOp *op) =20 t1 =3D arg_info(op->args[1]); t2 =3D arg_info(op->args[2]); - z1 =3D t1->z_mask; - z2 =3D t2->z_mask; =20 - /* - * 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 =3D z1 & z2; + z_mask =3D t1->z_mask & t2->z_mask; + o_mask =3D t1->o_mask & t2->o_mask; =20 /* * 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 =3D t1->s_mask & t2->s_mask; =20 - return fold_masks_zs(ctx, op, z_mask, s_mask); + /* Affected bits are those not known zero, masked by those known one. = */ + a_mask =3D t1->z_mask & ~t2->o_mask; + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } =20 static bool fold_andc(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297379; cv=none; d=zohomail.com; s=zohoarc; b=FKrdqarUalAM41CkTv4e7Y8ZnP3PrYC20s6QzrvtnuQcc2VMZy+7/GzWaQGeePZ3NSG8hYfr+Yrbwxz2YE5knyp5Vfq+Off9eVMttQfr51SCAsyJeFaJORCLYIvwKW56zllvreDXISB3HNIFuKmbViffRZWRV0HGtGWf+a6BZls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yh/Z6IcqrEAchgIs/HAf59KsDGYMrGPzRcjMoo8cwK8=; b=dzJEO/vxjl+p8RpTWV4J143o9Tfnc76rWOPkCtZJ3evr+V6f8+CEoPhWANZ64n6QZeMAhu4YK8gAZc2uocfi7rEmcgDtjd/cs8EvdXippi5DtAzigI/VHBXnCzgwgpfoZ+H6I6U3vCVSRnnYXhH+69kV8dEtFB2NXO4bkQq1t0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129737974561.937472738038196; Mon, 30 Jun 2025 08:29:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRY-0000Nz-Cw; Mon, 30 Jun 2025 11:29:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0000MX-R6 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:15 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRM-0008CN-Tj for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:07 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-72c13802133so689138a34.3 for ; Mon, 30 Jun 2025 08:29:02 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297342; x=1751902142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yh/Z6IcqrEAchgIs/HAf59KsDGYMrGPzRcjMoo8cwK8=; b=U4zc9Gl6YGKZnVDkMfAnsgeKOtoYbYG4Tl3CFUmqWmoweyiz3Turn6J8HQUQ8yNO/n 3vw7pYVMpSpwo2/EmbIQR3xxQXBhpzqY9HDpzndXvj+UC4W2J2/D1z1q6ZokPLXMGp09 wCKatxMAIJmVPGIytmKfeAozRR6UzbU6d8vpFFxIyYSOzEhDfGMq1d8vyztoiT7gSyfs jqBu/9iVokEZMhUeUOJ5bvB7lN8Tw2t+tMkutpV+cAcFmfs+BJepVm3dZQf44L7b6w3m cHg3rAmOQZsY+O+jf/VwQkK4BO2EjqVSqIeuBRSATOwBIqE7VW837tTQeCFmHenHSdLf GYqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297342; x=1751902142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yh/Z6IcqrEAchgIs/HAf59KsDGYMrGPzRcjMoo8cwK8=; b=dEfrN9+dSGWkevllhNWzfI797+JE8KKqt78MwdmOWsbzdGTkyprVXK3acSSEwxiyx2 Rpp3MsH6fsJV7LD1MIl1Fcquts50HwOgXR7b7mZvy6Ujjip2wqoN8C4fevwB901RRJMp ahYcZLiwC45Dib5qsQP7bZ4xdhNG6/HIITL20wqIeNodzcwSsPUDSpMg2T857U4pQ7EB wiU7iNapHGUq3pTUeHUB2ylYDdLPOZBtzKGtrP4JCpDC4Y4ltQHmnzdvWPq4/KwM5Hvl QI9ZaJYEW30wZ89lSnh4IwH7gVUDW0Zd6WK6CRaDFV4rcnU1pextYK2ui7LQ4/qDmydn fvqQ== X-Gm-Message-State: AOJu0YwHHCZdYkkUtz+egB0HvFWsQDF2VMvQWYH4fK1Sf56dBURg+tUI saNjDZV0z9j3Qjf+NTJOo0qPQ72cjb25Q5KWx56H3q5KPkXHrQeW1OPbe8GEU2siJvpTILOwyuF m54ji X-Gm-Gg: ASbGncvQHQnr0y57xKKY3ZetIsYH6mhmU7gnNnXa1IVvCT+tRQo1HY94JqJHZoGtUgp ueX7+GpkpNPLJTi0Dc/+vQ8pdVzQoQJvIZ2eRCHOfoFpNomRN9y9K5U9a4q6RckHDuc/Kb2b+f3 YkaaSekZTduLX2SETJNt4R6GCM/Jq4KCHSmIPeVHYE6pjYxNSjptG5T/OE80NqrAhcDd0dqO82j 5EEeXMailUUVJjc0p/RO1knUZ7uuyRlJU3Mkq0vw03dldCYr7DJxK9jh0CTLoUbWm7qYh4ogynU JBKgmqiMsbbvJzmQLaJRywoEts6/yOr68dB82uu1+H8nN2lXNQqKTMAam7YcpzRGrVN+QQK+M6J a/jDC X-Google-Smtp-Source: AGHT+IEf1SYdbhSZ98xwb4RmNoV/X6CPJ7W1WySCrZZjvOr9QZYhKfPqHb0EqHbS6QQyoAUXSVv0iA== X-Received: by 2002:a05:6830:6086:b0:739:fc48:6831 with SMTP id 46e09a7af769-73afc6b2111mr11532843a34.21.1751297341845; Mon, 30 Jun 2025 08:29:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 05/29] tcg/optimize: Build and use o_bits in fold_andc Date: Mon, 30 Jun 2025 09:28:31 -0600 Message-ID: <20250630152855.148018-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297380383116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 if (fold_const2(ctx, op) || @@ -1464,7 +1464,6 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) =20 t1 =3D arg_info(op->args[1]); t2 =3D arg_info(op->args[2]); - z_mask =3D t1->z_mask; =20 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); } =20 - /* - * 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 =3D ti_const_val(t2); - if (fold_affected_mask(ctx, op, z_mask & v2)) { - return true; - } - z_mask &=3D ~v2; - } - + z_mask =3D t1->z_mask & ~t2->o_mask; + o_mask =3D t1->o_mask & ~t2->z_mask; s_mask =3D 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 =3D t1->z_mask & t2->z_mask; + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } =20 static bool fold_bitsel_vec(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297741; cv=none; d=zohomail.com; s=zohoarc; b=KoXCX9GqsItO0qJ+CGU+KiD3Vt78GHpb38ymOxtsFeSdE/YOAfI3NlcQaoVUH8eyCf99uSXFXQ+DdotMb5cgl4RYbZRrv/UdUtPIQCz63f/yw9cCfgceVCmyk8lO+UsSSmy58Tpcu+nUBXqUF7PELWHt+6eTXJDrsVFsckBZaTU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297741; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XWCTAyFZpYLfY4pk7pvKybm5SaB2cnEmwYcfGu+sc/k=; b=ZO17X8/5IdNVBkJazN6fCJ/VMt8nM9LcJXbSdUIkRrp2lDP6qFpmHIPU+TPCH/sutGmwPdgJlvbcZYGiB/9tmTWtbpGyb4MHFQB37EwHvEgE+LJX/xqa7xQGhYDGCMT+9yQlFq5xp6gaZzm+Yi0IAzXLP0pIKVlESDL+pO0f4uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129774118834.58870481310578; Mon, 30 Jun 2025 08:35:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRc-0000RF-07; Mon, 30 Jun 2025 11:29:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRY-0000Nw-Rs for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:16 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRM-0008Cb-W8 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:15 -0400 Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-72c09f8369cso1286858a34.3 for ; Mon, 30 Jun 2025 08:29:03 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297343; x=1751902143; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XWCTAyFZpYLfY4pk7pvKybm5SaB2cnEmwYcfGu+sc/k=; b=l6MbZY3fzcZgXpJDHg2vFGOJ8h09sxfu7b4E1iOcjpNxN2nzR3/uWY43K0bG/KCwas Tyjx7a7CV7JaDxswJEINIQUNj57m0AZltdv+ChnsrO7wna52sLas6OVt9I/GjUfBgqSi xJH/8F6qBeqPLY0yb0q9jj3S+VM+LrQBXQaPnJSScnCOym+LH6hY8F6vG8EieFUWnR/Y X1Jm4YxxWuEcZ8OFqkhOOAVNT5U6oor+F4rl0m2h9Yf/VpFqyu15JEGvDaDs+AZJGDty gdtjhKS71YjTqclE6lWlpHp5c/X237MRx9V6pw4Zc+G6Sjunfk4QNo2BB8VrGnPovnkD kSjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297343; x=1751902143; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XWCTAyFZpYLfY4pk7pvKybm5SaB2cnEmwYcfGu+sc/k=; b=h1ItHMtu8ig63Khu/p6xjmiNcHtboRUzG9JETEwa3DOqH+oXZ+MC4wRg3EMl+gIQn3 zeXHFRp/61JxuuLkZMEinh4UxDBBIkw9Hf/IIOb0qoqakJfG/qlVrvyK8IXkzhmu/Wyr 5R8shmODwG0wHn23YoQ/HKmN81fd7KybUL1abJq9UdoEr9BW8g7maLNOoX/QzpR9z32m DNXYEKALfBVaIZ9DwUJE/1tdHsk1WpbgxOgk83221mats45PfUK1yhwn0MLfg4l8IbiZ xTIBTngRTz68rbmIYK/VSnRdOI/BQzebdL6G3ABL00nf8KUHN6bzeSMLrrCK/Bo8wNA9 N5Yg== X-Gm-Message-State: AOJu0YxFUlzZUpLMTCTnM3IbuZVcEy1QjLg6pFRKSLYM0VpYAnC5ZqPA oxS/w1nTsXUM4adgmJ3W/fgfEnoQz5jU/oqMCq8gKvPw6j3e3krLeJf3KFyRRjQek3v4XXZ0ffL kcIwS X-Gm-Gg: ASbGnctGh6L1jgYbqmgAbfk382ZbD6SgVRrPRZYSexGfG1C8H//SFxwYMpG+lbGssah P6xrt+7bMqvGi90ovTWmXW2c5D5CSmMfY5Jqu4S0UMtoluuqsLwlM0WDJWqHufsTsGUj/IZ1JOb S5OMjNzEs0KBDrc/MlCMySBqYIP4NZ2KaU2Z8icxM9dEtORlXhlc1IU7L18SFgoqofSzF7dTgbx dUo/fmfH2ED1T8jFD3syEO/6nPTTL8cOTfWlZvH1sYSzCt43X8lr58KzHuLtJCaUWJfgvzFZbr0 DzCZ/X3yeCee7y9T3TElbuiZksbynXPPO16kLX+gNFu8ufDQUVhrt53Nwdw18Y/8+ThaPg== X-Google-Smtp-Source: AGHT+IFdVlZKuo/jzcP7bd7llTDjnN9z3gnNRDZSAooDBiiWgEmzAFJV0yE5ib5SCl2+byVQb2kHrg== X-Received: by 2002:a05:6830:7110:b0:73b:bd6:dfdd with SMTP id 46e09a7af769-73b0bd6e0camr6692075a34.14.1751297343030; Mon, 30 Jun 2025 08:29:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier 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 Message-ID: <20250630152855.148018-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297743224116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; } =20 +static bool fold_masks_zos(OptContext *ctx, TCGOp *op, + uint64_t z_mask, uint64_t o_mask, uint64_t s_ma= sk) +{ + 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) =20 static bool fold_eqv(OptContext *ctx, TCGOp *op) { - uint64_t s_mask; + uint64_t z_mask, o_mask, s_mask; TempOptInfo *t1, *t2; =20 if (fold_const2_commutative(ctx, op) || @@ -1946,8 +1952,12 @@ static bool fold_eqv(OptContext *ctx, TCGOp *op) } =20 t1 =3D arg_info(op->args[1]); + + z_mask =3D (t1->z_mask | ~t2->o_mask) & (t2->z_mask | ~t1->o_mask); + o_mask =3D ~(t1->z_mask | t2->z_mask) | (t1->o_mask & t2->o_mask); s_mask =3D 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); } =20 static bool fold_extract(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751298025; cv=none; d=zohomail.com; s=zohoarc; b=QbXX3Bm+doJ1Y70FC20HYtmWXztEMzNMaxdfYekq729uXBcBDvwSkrtQha2/qVeOH0JkEWtlzetM80DJpULFTOlzLglmPBwFDvCu+Kl/kQo75tHOy4F4SJG8X8RiLgPE7tD0hNsLo18KwV2t2fgEeRcnBULn0J8mZc5pTAAVDl0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751298025; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vEnCNhfCm6D5wZcrz5VqZsMscK+PR14Jrfi+YIMhByM=; b=mX+FL4bSY/v+qHo2GWvmVnEUa/VZds7AQGCsnOjzW2PhiKfXRvqbBhHTSBbYFRkG/EOfyil6JK8YHbkwtpCSUbSiG9PiqMkEmUm9XcGUi0Kn5N10UU2+WNo0xWyP32Ayr1cJBRW2c4e3PnVZ0vA/CZscIUi3tOB6YvB9tT7mSOM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751298025387887.248601773074; Mon, 30 Jun 2025 08:40:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRZ-0000QG-TQ; Mon, 30 Jun 2025 11:29:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRY-0000Ny-7e for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:16 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRU-0008Cm-SZ for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:15 -0400 Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-73af5dc0066so977071a34.1 for ; Mon, 30 Jun 2025 08:29:05 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297344; x=1751902144; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vEnCNhfCm6D5wZcrz5VqZsMscK+PR14Jrfi+YIMhByM=; b=Kaq0fLPV9DdCzlaco/4hlWJUHCfJ8R2fRrx827VgFgpOxliYse5u0TREAxVdeQ9vjV vHociOKi4lSjujthIKcAxj9/Y8ubIh6DXl5t03Muk7EMbHN47DUD+Hwa0DDTUinfRi2p dau4k0BCRkk6ioieyRWgrwQTmqP1cRfWvyKPoDnmKrKlDvMiMqFzodukYpR4CcNMcb2I CaYJJ6FWy1rWnTIsO70xzgNvkXQQsPvyz6pICeL90ddrFdrOKtwEggr6PtE3ZJCw86sY zFvbpzIkLcY1GCWohL6Ggl4ScYWa11PkQDs2lex/ZwwX8/7YuajeBIWekL0reWgU6G3D GMjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297344; x=1751902144; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vEnCNhfCm6D5wZcrz5VqZsMscK+PR14Jrfi+YIMhByM=; b=mAwXSZuVLAGsNxjl0OuRbppKBmxkwXlyrY2ZV/x+0x97B7yJiPgIdXwTkih+Oc6bEe BoE5ZeSjzLdAKiNSiSXdSRIOsSOEvWlJiA9G81MRnfYs3otFnQxTubsMxConhy3E1kbd kcuWx3L7fRON8ERxTV0pLVueWBTveIT+QFJWkT/gHKXl2/Es94CsEoDa+qg4d5ZC0qCl TAA3O4PPS+uEBXXylCg1jMk+by7KY5bzQ+AJqMkabAzmC67QlloTkYGsVLalg6jrHjCC vgDVl5AwUXTaJFZS3hcvzElJ73ochFNFZ9IAr+wNBmZ26whzdgEalY6yljqdOttj9y+n SURw== X-Gm-Message-State: AOJu0YzD/Y1XOpz68WWnkc75HroVkYdJeWvoulboNRZfCW2Pn03iyT/1 np1FYa4zzZPNHYA+RBlED4P2+3bdWT0GtpgAbvORJMsQNV1XXd9B/PYt4Ar5kkZdH5cW+zSK0ZM cxE5R X-Gm-Gg: ASbGnct4khj3yJnLoCE302OWiQWUyxjDzuilDXK3vM/U5xbwy4N8Jtl7V48vt6Ora4E muOJhIRPfiFlHBa6GAnKHdUd9GdodEerz50d/s4vaxLe+ypjlVLiw3o8radrdcUyiu1HtFYTOXk eFetKsnkSDPDnFa2/Adcm9Vq3lKBia9acwzYbbgM0FA+h+pA0Zwy9snGOnzdIbkaEMJ9LfPMaVi Ojn1L6LRwtI6h5qbOiuA7J8b/WXRH+eVm4wsobrahuD8sJLD8GvXHH5G0sPOt0MxG00q8/39WIn Jo5r8JkfpSqxIr7pgkx8hKNUcbXngnhEnIsFhQn+EK/e1J1yMi91SRZVR+YJBoocHKwJ9w== X-Google-Smtp-Source: AGHT+IHqkSinxrWjFPDoshhGjjlFnCX5VJNqr+lQveNzq+Xw56P8FgfEVVOkYOs/AVPvNEwvB10FjA== X-Received: by 2002:a05:6830:600c:b0:72b:84a7:47e0 with SMTP id 46e09a7af769-73afc4313d0mr7784699a34.1.1751297344070; Mon, 30 Jun 2025 08:29:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 07/29] tcg/optimize: Build and use z_bits and o_bits in fold_nand Date: Mon, 30 Jun 2025 09:28:33 -0600 Message-ID: <20250630152855.148018-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751298025906116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 static bool fold_nand(OptContext *ctx, TCGOp *op) { - uint64_t s_mask; + uint64_t z_mask, o_mask, s_mask; + TempOptInfo *t1, *t2; =20 if (fold_const2_commutative(ctx, op) || fold_xi_to_not(ctx, op, -1)) { return true; } =20 - s_mask =3D arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks_s(ctx, op, s_mask); + t1 =3D arg_info(op->args[1]); + t2 =3D arg_info(op->args[2]); + + z_mask =3D ~(t1->o_mask & t2->o_mask); + o_mask =3D ~(t1->z_mask & t2->z_mask); + s_mask =3D t1->s_mask & t2->s_mask; + + return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask); } =20 static bool fold_neg_no_const(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297665; cv=none; d=zohomail.com; s=zohoarc; b=NAQoEFjAknNKdbsXjKTZWhxE+S3bWV4CZh92LOGBKSAmCa7tKnNJDNBEnRHZH3mwcEG9+ZnvfJ+Kt9S/Nxbg0Z7NcfEGeH54r+H3DcT3JqWI/uX0UN6N8abK5PZ8hFc49cdh3fwOTwJqbsxu/16jK8rIM6dqh+zxyKBUwE8bgas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297665; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I+9e/WZAdV+G8EPFJA5xZ6p8rk/j+mp0LoyagvYRyY4=; b=beC35/iPNoEKa/N11x1ruwU0Ks56SahH5Wb2qEnrxuBJ1DvTSrTcQCxuuxAN+ShgXQ2qSIreIOj+5C3PQ1UYSODpiJM7ZuyCqdZ/ralU8N0z7wxIjRIEnpcYSvNHEnpqDb0F6zH3AQKY7erOli8iylA2MIgNSHaUaP33qx/+54o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297665180320.62853739562513; Mon, 30 Jun 2025 08:34:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSE-0000iw-UE; Mon, 30 Jun 2025 11:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRb-0000QF-Sk for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:19 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRX-0008Cs-Ic for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:17 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-73adf1a0c48so1185284a34.2 for ; Mon, 30 Jun 2025 08:29:06 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297345; x=1751902145; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I+9e/WZAdV+G8EPFJA5xZ6p8rk/j+mp0LoyagvYRyY4=; b=y4TIj4qNTYfEUhD/WRoviXWU1DzdA+5fvRnlcjDre+b2h1PYOob0PqbC6+OMBpPYXA KLRiD2yzrPHvy/1AUxb7AgpyeHpGmWNstzY5fgLWZ3e7m7UokgNU2rjkJuXh2IeKXOE/ eIFfgtEuh7hh/meE9CZhKVRNRmBi0dDYZdXe0ptoQioZ5DjN6hMNN7aNIejotkAQg16P iYkSl/DRrnF+364h2EQiV/bRSoHIhGv6+BRB9nr3AM8ApsjxCSz+yrxAsx/jwLd2/z1v o4QJlkQzcLuhbueG8RNPIEKWw5q7d3YFc4BonGdEBedKzhwgIiYrYelKVmTdWCKsbj9f 8RTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297345; x=1751902145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I+9e/WZAdV+G8EPFJA5xZ6p8rk/j+mp0LoyagvYRyY4=; b=PCfx9iNYe9HHdJqft1n0Q4zlXxG1ULkhXnqFwZyA7ZhHdanLOjf73xqWpKXQL2a5DY +UadC5+kel1kb6dqgs+eC8ZTH+9CBsMWVnMRg6xRQ4MDksvkL+rZ1nzEStxNCHcXI6dL hoxP3P0nJiP79o3CnaurwWhBeIfR9UgFd2FTLqXChXaPYqjBwAzcOr0clFWPaWk4jslO J9LRbUc8ikbIPxRWN03ArKvoqYccdLLNYSqeWEAp3AB7/3xtM2+Xv0SlS0LIHE4kMAfO EIp9xBxrAvD8Tc/Iig9IKh3ESfPsRWdwRG4JiCPFBJTYVV83WR9v7HT23/mvKOwx8sa4 4l5g== X-Gm-Message-State: AOJu0YwrNukffE/trYXTWptvQAh4XFEwOzKKq1dFzWPA8M/TB6+S2dbh eCXI3q7iadiADqxzWr7jsiwqLz/6ox40TQQiQHyKDMadiNNRRw5K6dlpzLxR+vacBL3Hk3RZY5r JCpBa X-Gm-Gg: ASbGncsg4uGLgJkLhkn+7DolbH5kEX89pGe+mOdxDWmo2oK0oDnB5feiH+tF0ROez0g j9/PIQHDtqPwTCHvtGeYGREZNrKkfPp8105g/b8X8+zL4lOKTntDSIE/EzZbwePOpJ1R3pFzk2u 7yukynt38CPN3W6n/u+te9X65osuXwoSLlnjhoi5IBOwbr5vNEAnZLw9NIXO91MVaicOOurRiLl T4q6vdGsrdHWJ0ASxnWv4YuCvKCxRJfY6sAdNPHwGXD7QGccRBmbQY76+ZL+LyV3VmTz7VOw56A 0YqOhBBwOPAw5bxixikDwEpDxCNiEeRLmh6oswYH0a/NCGSp+FbLX5TSmYAsEnqy8prC1g== X-Google-Smtp-Source: AGHT+IFKE/5FMQWgOxKibGHMmT2qP/sZbZLNCE8z/aJRmysU9Tqn0ETLaLxLx3YN5BQvN7k5uJ/T4Q== X-Received: by 2002:a05:6830:3c8f:b0:72b:a06b:dd71 with SMTP id 46e09a7af769-73afc3b9d16mr9167736a34.5.1751297344789; Mon, 30 Jun 2025 08:29:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 08/29] tcg/optimize: Build and use z_bits and o_bits in fold_nor Date: Mon, 30 Jun 2025 09:28:34 -0600 Message-ID: <20250630152855.148018-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297666611116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 static bool fold_nor(OptContext *ctx, TCGOp *op) { - uint64_t s_mask; + uint64_t z_mask, o_mask, s_mask; + TempOptInfo *t1, *t2; =20 if (fold_const2_commutative(ctx, op) || fold_xi_to_not(ctx, op, 0)) { return true; } =20 - s_mask =3D arg_info(op->args[1])->s_mask - & arg_info(op->args[2])->s_mask; - return fold_masks_s(ctx, op, s_mask); + t1 =3D arg_info(op->args[1]); + t2 =3D arg_info(op->args[2]); + + z_mask =3D ~(t1->o_mask | t2->o_mask); + o_mask =3D ~(t1->z_mask | t2->z_mask); + s_mask =3D t1->s_mask & t2->s_mask; + + return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask); } =20 static bool fold_not(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297666; cv=none; d=zohomail.com; s=zohoarc; b=BtD7vZvJiQd/fpEBfkf//36us5WqROXFnOZzDu2gDfYJU8VXT/cOGnRNrU/QCkb5atnOskAEh3ApC+kdZHayeN2MW7We7BfgoRGa0KKjsNOOuyz6AUvM/jQ5ANjqZPJohBO4VV/HT3KGKjMEV6+4CXX1MNGdRfjoOo/bCzb63hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297666; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5c+91NkfpqJwYGyED+jYrmkB7CYyaOBwzdlo8NQO7hw=; b=KssV1jypf8U3qXK50ViZqZq99CijTafmg521KHpfHAC3+7o/sEtdnCZluGcu5VX3/uxb4tVaLhibjT9EvkhGBKwY9il+/uavH+XHPlAwBjYtSI/LqZJXmd7aIAxmx82qQKe09JDvR4KG6yE1KaQ7L8jBnNYuv/kMtgZ3ZiqOMBU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297666602381.5803191730872; Mon, 30 Jun 2025 08:34:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSA-0000cp-7R; Mon, 30 Jun 2025 11:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SH-AP for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:28 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0008D1-Fz for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:20 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-72c16e658f4so1155440a34.1 for ; Mon, 30 Jun 2025 08:29:06 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297345; x=1751902145; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5c+91NkfpqJwYGyED+jYrmkB7CYyaOBwzdlo8NQO7hw=; b=Ov4nUR7366BItrK6VFRBjkZIzhc1vNZF29VcE7++PsrgcoKZv6T4SXRJsUu6xB+ry9 MsilsF72ifz56rx/5Iqcq/uzoYOKONXQVVQa9a4up943Ao3hY1r3TYUDRYwoYiPug2+Y NnfYn0pQcVWyJgJIG/exC2PO++9ABMAePdygzBoZUwcKzR7e8nUcGIeIN8B66Vu35OAB 2kj6ErUjfLxv/uJMCpl0Q5EV35ZFO8uOvz5chabGF6KLcQCiIvi9rxQXwfwZrVeMzCfX wBZRK59w/CIWdgsg3KjTxRZbAyx3ue1ZzeLPi4mZfucIpVFAaDrnvxCVcc7Qo3zkjB0B veSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297345; x=1751902145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5c+91NkfpqJwYGyED+jYrmkB7CYyaOBwzdlo8NQO7hw=; b=WnrcPkxWkLV0gz7QNYLzdR0IuUeOzzntLTXR3bA96An1pwnvEiHIo1yqNoQ97wgL0v VajdXkPUQz5HpfJdU92cwZE9C+t8lTWG8L/qT7JyLyhFvh1xEEHmIRlvsanGBV79055e oB/2i7ffj4hSW1C9Vuu4fuNbxOQrjB+GdZe64IS7uAwCnDpzm0CcGpTqM0BdSdFjBtaM L7/6WjMnciDukoOR9rihYZ5Cz+2BuCrULQOn3+ebFyqAezkaPCI6arY5YYZp4wTCm6V9 DyVUHEWOaO/1Lg7M7fXGm7zrLFNkcbWzCY5bh119vCasbd6fGxDuJL0O7rpmZkwhWE5G jBPg== X-Gm-Message-State: AOJu0YwQ2W0mYtaYQuPmqEqNSUBhgUvmX/yTeA8R/c6Ee01i0ErdpocA XXVvKOBgwNZIxbJDEsfBVID0G95qgmW9XWoodjooShtQUd3yEGVw1C+hxkbr179lzl+hSmGA3L7 HI3rB X-Gm-Gg: ASbGnctnUpMs/ky9kcjjFOUUYHTVFL3hxfmIUMzKckmpOBzwhwHJont1oJrISRKfYiW NP7+oeM9LECxxVDlUrf+kt+JwHp6seC8rEfQicGesj3O+m9ynAtGaCDlXKdULw4cPXhg5pUQiIx 69AyLUSE2NCYXghEOqhTvaYEI73hixG6MxFBJmMHF5XFCw1tsVxKt/dD3EDRnCW5GITWkd7yYI8 t1TNN8oKPiXGgUVGCLHOsEAaOMCeqSJpC0un0K9gTziv0oL7o6eWWGYUlVcdbEZzKpYQ6tJzlDK ZPPFh3y9wC1Ba3kM5KGfuTa4RoVx/bnC3uaGS1DVlhor8fvW1HT+jlAJRuFyQpcNKGAIkQ== X-Google-Smtp-Source: AGHT+IFPLbVctIP/ybUtl71PMLJlYJg/MJ6iJ0JNXcbYMsPHJoBBZly/RRZD4jXylJR8WU6RtETdfw== X-Received: by 2002:a05:6830:6f86:b0:739:f13a:6f41 with SMTP id 46e09a7af769-73afc731dccmr10535206a34.25.1751297345501; Mon, 30 Jun 2025 08:29:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 09/29] tcg/optimize: Build and use z_bits and o_bits in fold_not Date: Mon, 30 Jun 2025 09:28:35 -0600 Message-ID: <20250630152855.148018-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297668411116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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 =3D arg_info(op->args[1]); + return fold_masks_zos(ctx, op, ~t1->o_mask, ~t1->z_mask, t1->s_mask); } =20 static bool fold_or(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297607; cv=none; d=zohomail.com; s=zohoarc; b=lV1xu51PbHzHmauqpw4mYqzZYUSxqhZs/BxsGsNQw/afVf1Ps1S/xb//iP/0wWgG82ldfBUksjLuHAjbXFH6G7ZOoJPdVB7ZNUNQw8ERVD/VwEu8bctHf5/NSZYETfWFLkCHWQlikzFf6jAu2x52LepkQ9A9ZEYss+IjCwpiarw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297607; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ed37owTcRXNcXW8DIrgmIBeAmojXykiSQei3JzaOn08=; b=LckR4dZxWyjoUIL6mZ5YQxBbB0M90NAx5nbY7d92hVOZ3bjL1Q3xgEvBU+d6BnO1QmTR34XfjE16v0HzYP7HRIRbr/CZPAjSDL+0ctZ0XIAGTthorR2sC4KUpjIm0w/x1b+9Xw53FWVlcUBiJsY6f1Hwz4CXiRAIkeTDtEdQBlw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297607329196.05797623040905; Mon, 30 Jun 2025 08:33:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGRb-0000R6-63; Mon, 30 Jun 2025 11:29:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRZ-0000PG-BB for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:17 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0008D8-Ep for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:16 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-72c14138668so1388609a34.2 for ; Mon, 30 Jun 2025 08:29:07 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297346; x=1751902146; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ed37owTcRXNcXW8DIrgmIBeAmojXykiSQei3JzaOn08=; b=liJJz/igZHqOriXDvX39cNO0KnlwJugZXbJnBVi4FV8UARddiWWHSBkqBiZrP4ZGMq atN9eZ+JWpzicjt2LSCpWvsTX1TFWgYJpYfZ/QPQH75qaPUVvypqwH1nnjqNAbMiU7qI CKGjNwZY1YIIeDy9zigkBfKnA8kiIqlKwtQSZpC4KcdHC+CbxicZjyrailbLuOf/8pkt 2izIASUkgluiNKkjFjjMOzyYH3HUp8lhw/VbXJLaE9uLFcZEXOcKB+QZCThXwN92h9MZ iwb0XIEPxlITEL4MMD2LpyXGo6zpi/FMJky3qzWCpc6kltkW844kfJ1Z8GgREPb1qd+6 9JPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297346; x=1751902146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ed37owTcRXNcXW8DIrgmIBeAmojXykiSQei3JzaOn08=; b=QVTaq1erYrETfNzfEXgxNYRfCpLHZsM4TqxAXRPG3FlDCrNWge1KLlcfO0RB4YoyHo fHZqrloe8JtIFQty6DmBwvqyFmkmY6o9ZgP7Zh28r54bH55+UeFA7wNfdgYm7Hk/3HFI lck3JvvIHwRVRyb/pW9rWvmQOQ5WzBeS2VyK2/U8vHN0rE8PVSHYhf7UQ7X8gT2RpaVm AXeq8wYME15zCvdvvBO9zf/DnNW+kyXHTrGokG/lCdSfvooFtkm1IRNytvTmd5sV8tfY oNEAwzhO//cJ/8KqN140odn518G52vwL6hf5umbPpkkykO22MwpXh2eK3B9GUxJ/cdvS 8mMQ== X-Gm-Message-State: AOJu0YzBR7ubl7jkMsqNNkNM3LbUHucReXPTZbw5D9z9PHll/nPXy6Sn TpnXuYVcAVYmXsyU/2qbQ3jehuEswX0OHJ8L6G0/IK4F1spcP084dkHWSWx8yVDsk7n/m25x1s4 1G0gp X-Gm-Gg: ASbGncu8SZ7UxXIK5P4Cg234HyhRyOawNScJ9NgCeFR3FkseazjF/cE1cleA3pMbDpO ZehmKmOqLRMYcrwsPK0DQsNVCvMzLjLNEa4lyvAIXIGAf+gTHyBz88oWeW580k2AR9+sUh3B/zL o9Do7um7osehCqgj0lyeW3474Do82nClurmEichOfp7Uoj1FxFVft38JMKuioX+MpHnrt2CjnDB KXoovR5thh0jak5LWYbcSkB27e9CMZeIYskZ4zCyZ5yQsCuqO7Vrv0NuZr5+2deM/9omilzgQU0 8HI7Y5qqHshZTehtFBWRO4UjWYPVPyT+1my1Jopo8RNWai1PrAfX9OT8yC+34R52yF64pg== X-Google-Smtp-Source: AGHT+IGUke0U0sJhfZdWkrEj2q+qmKIdukEpJ7PbgBGvKa0j2Jqr0OoQHv/qqkisfPAlsOebI72SwA== X-Received: by 2002:a05:6830:630a:b0:72a:449e:2b69 with SMTP id 46e09a7af769-73afc6b249bmr9116087a34.28.1751297346265; Mon, 30 Jun 2025 08:29:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 10/29] tcg/optimize: Build and use one and affected bits in fold_or Date: Mon, 30 Jun 2025 09:28:36 -0600 Message-ID: <20250630152855.148018-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297609457116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 if (fold_const2_commutative(ctx, op) || @@ -2274,9 +2274,15 @@ static bool fold_or(OptContext *ctx, TCGOp *op) =20 t1 =3D arg_info(op->args[1]); t2 =3D arg_info(op->args[2]); + z_mask =3D t1->z_mask | t2->z_mask; + o_mask =3D t1->o_mask | t2->o_mask; s_mask =3D 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 =3D ~t1->o_mask & t2->z_mask; + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } =20 static bool fold_orc(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297595; cv=none; d=zohomail.com; s=zohoarc; b=PunZic53YAMnRHwrcj8pGirD5c6gCdtKvMi4uikab0+OAM5LpkmZUDwJCAOAM0UMOKqg9y3bYSLoLxNOllr1qV4Nbg66Clp0qLDoHWH4LbCsijKTjD0Qdky8zCJgtiUlNYt+KwHWgTOGWjhIAsV/7dKA1X69MVH/DkAbeUqr6Wk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297595; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=84zKQCvKoHSWIwpx/K6wMVzmeocb04Rl/dJUtZLC5CU=; b=ZPZw7Cfs5VwsNp5PvLV5TeBJh74u1HD2o2Oic7t+ppWhWrvEU+CavU+aEKZpAKwETxB1JwbxgHPyKyoDnXIT7iIVFrQqTkGQ3BqAM0s9r0iwGgBvHjwwpv9liuSFm27lwhkRBkz7C1Ezqx1kF0Kr6ghUQwTdq6Gsz78uKLpX2wM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297595129888.7737791360373; Mon, 30 Jun 2025 08:33:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS6-0000bX-N2; Mon, 30 Jun 2025 11:29:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRZ-0000PN-Gm for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:17 -0400 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0008DE-Ew for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:17 -0400 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-2db2f23f174so3177689fac.2 for ; Mon, 30 Jun 2025 08:29:10 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297347; x=1751902147; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=84zKQCvKoHSWIwpx/K6wMVzmeocb04Rl/dJUtZLC5CU=; b=pP+PW3mvkGQO4MIJhzeGIibMI9F+BH1ln3geLy6l62EUhLwqPQtxQly+KluTQsRapt UpRIZdn2071J5FqfKsPv5/dTtl3zCtgS7v3au16qJDxygwB8WYiCmU727enHhyb7sgo8 7+HGccBGQGRfF4DtkJiK5GgWVPqQVzoA1XbSm553E0qEqlCLM6XeiA/VeaMmRJB0wNf9 IX7nDQkuPpnK0rVDrCi7q6XrtVYknIpy3OxECvr41URJN1891KeDdFtg4mPxC2lbgT47 tAUcyx1i8Z3aJV+5/pGO0r5AcC9qgWCoMBLJ3BJ1yr/RX9Db4sjYMKfuiq+vIgESVbQA /1dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297347; x=1751902147; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=84zKQCvKoHSWIwpx/K6wMVzmeocb04Rl/dJUtZLC5CU=; b=MyeRR4BW8HzeSi2vB52gMpnxAyU9SmG4ON5vnqmbOlo9gMDjLcBMB1UQzhVdhxeVAL f82txyMO0jMYfl2Cr7PA8FYIwhMwGEGYmJqkqq1nfGWbkAgwqYT6jhn8y/JKgcmpjvlR XqIXNgA8SJD0EL2uc58zXWUJpje1OoPN6ntUeddcTEAKBBMBKPP1VUzSTT5/sYUsmsHA MLSdgIccmXih5RQzMxqSpYEBinv59ujYQTVQ87AjBF8tGN9574Q4iQqbM+Pgt/lyOUBG 7hFMrLQ2jv1RdIMaHCPIkI6HFdpvM8LeC9FghvSabBkuBANhh0Zn9GWwUEnbsrMye0yF oz0A== X-Gm-Message-State: AOJu0YwrJZFPGapZXofEkrPVCgpvl3rgZQ3mkc8sxJXsFZKCI+8Uu0JU 27KEA1Jb1GbiY0aBC7hN4tBfqNYM38za5FCrCake3fBJQ0GPdccFyKpqJv5RBvhCsEEO/gG8uEn TiOCN X-Gm-Gg: ASbGnctv7QNRjc03iqe3g/2i827m8R04Bqtg38qbly/SHIzlTB4vzdbB8wvTE/+JM82 9X0h+d+nkQETyKEvWsfWecXA61K3TNQCuJxPFwj/7434o7oTZu8BDE8GrFveFYQdDlAi3vqQwHq /+G03n4qKw43GsrsJb8mdQKZY0TTo+oMDRyR66ClIqG1i5OesnxxyrV5KvPa3LZ7ZQ0HPUZlkCg IZwWv3LtXvpZfeu1lqTi87bJbgNkKbdun3qX8+JS9z9a+e5TiFqe1SS+eaqjyRhK4HUCfi5/Qhg Y1AxjoRVO/Rj82r4slzQICNTKgSWSRA7HZLX16n6IlVGj/MsNwhXYXDVOySS4GT6QTX2OwNhpwe IHj2N X-Google-Smtp-Source: AGHT+IFoKniVh+6fObNxOIkEMKc1YTSkW7rCpHZaxH8NLrWE3ditynHgUEArmSKHvaRO2FqERRvDVQ== X-Received: by 2002:a05:6870:9496:b0:29e:3c8d:61a0 with SMTP id 586e51a60fabf-2efed44d8fdmr9096424fac.8.1751297347027; Mon, 30 Jun 2025 08:29:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 11/29] tcg/optimize: Build and use zero, one and affected bits in fold_orc Date: Mon, 30 Jun 2025 09:28:37 -0600 Message-ID: <20250630152855.148018-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297597219116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 if (fold_const2(ctx, op) || @@ -2318,8 +2318,15 @@ static bool fold_orc(OptContext *ctx, TCGOp *op) } =20 t1 =3D arg_info(op->args[1]); + + z_mask =3D t1->z_mask | ~t2->o_mask; + o_mask =3D t1->o_mask | ~t2->z_mask; s_mask =3D 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 =3D ~t1->o_mask & t2->o_mask; + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } =20 static bool fold_qemu_ld_1reg(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297454; cv=none; d=zohomail.com; s=zohoarc; b=BaN4gfzCQPQJpiPUg9lOfee3GiMnDkHwr0L9hCOTssrAtxNHJ8T+Xc6VycWp3nIpsh2DgXtdFB+bB/I5v4hGDLvMe06GdX0/7k06MQ+wDYWRGcDAWWhurgWrJZNnEmX4ID5nIFdiOWMOuJrJv9vV6S1iI93uroj42BQU8KHc8iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297454; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rrC9y1MRX+O18Fhj9PQjZIyYMT4ErGepHphLgADpIME=; b=GSvAMrjMARBrdSCbSJnxXu8LrmkPlwhcZfuAcEfUARvPAqltd69y8IiPxC1938tZvZ2zaPmcuiQtxiA7fxW69z5i0yx0n4BalJowIaaxMXTyycbuo9pwHBVOVcMMyBYouPS8PQOZzlmhsVgSRdFLBXr18SD8nSNm1Y3HCUBpvw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297454835233.26335328061236; Mon, 30 Jun 2025 08:30:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSb-0001Wm-AJ; Mon, 30 Jun 2025 11:30:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SC-8N for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:26 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRX-0008DF-I2 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:22 -0400 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-72bc3987a05so2807962a34.1 for ; Mon, 30 Jun 2025 08:29:09 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297348; x=1751902148; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rrC9y1MRX+O18Fhj9PQjZIyYMT4ErGepHphLgADpIME=; b=KJJI8khfSp/TddwRHGY9dEyh1ebmzX5qhKP8b2qwjNzPwxnrsnkBadF4foscL0WJSP 8R0A3C4A2191P69w22ooIe9OK6XsFsaHGMepifKS9kKfP+IpY31MnGteUC4UFEgqlWgY R+Wr7hNbJ2oc5enlnap/mkUiv5c+v6YcaIeaaJIt+wkMflot6HCjE3BgVv/CQSaW7z7J 9LlXjCIwR8SSnKZYhvWQJ876zBVCT3Y0AuV9zMYyqkdXZYgWe+8PjBu4oUVr52PGjl4k q6q6MrFA4dYjwQwBZp01/4XAMLG4NmDAsjl+TlZlaYK5hsc8MEudA9UIuO1Jh60lTCxF d7tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297348; x=1751902148; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rrC9y1MRX+O18Fhj9PQjZIyYMT4ErGepHphLgADpIME=; b=xBmLxjmSjLUsgWueShwvL0jqa68CKOEgSvLMRDzu1HoIeDJQvPNfaX9zWzDYVb0eR9 KaBQaYjAIdFjwMavrICSjbNePBrWV9Ff9tdAQHRSvqSVZ+34f14q9Q93lnRNdWJTrDIR y6R/G0cse1WnkuEm0B5QcJsYNyEC0catl+VMi5hwT7va1BlFv3rtLkTz1ZTL2vk41Hn0 p3aOAIEnF+PTBJHsyxjSKouS7ZaeuCKrB3GhLPMol5ULOSdO3A5+QiW1W5BlH0MAjmlo A8sS/gbmWGqdoPWp1mD1xbh9DvkN5WeGyNkLuIlOzHllTJLxcZkZFo3c0C/X6/3ioFt5 08ng== X-Gm-Message-State: AOJu0YyxdFo/cpn0fJFpn8+2s1tFk8vuKHAXnxt0OrOHiezgs9tGqrAJ NJ6lljx/U5KYu4XqC9+pZIn5990kPamGoLWJ/Imb9s4WQtwrie2shzImotWXnIIc/H1p4RNHf5G Lt4b7 X-Gm-Gg: ASbGnctexaV63lDcdpxzY1HuT88HqdhQDPu4ltZ6rVGqLKlMVrD1uSD8NeMWzyjSw2P Bl6128zOXj3VQ0FmFxogUozXFRGs32eah+4Bhp3if6azYtcP0M1+gP+K5JlE2rE8loE67/Ea2op lMI6PrJE/s8T8phmL0MsrNtIqzAifJj6w87lAU/TMdb3AlWAyqpVwL5HNbWVOBwvirfOqORijcY S5SvVjp/m5fUhpBz3NbsQAIaZ8ua2paD66pgEUWrDznVifg27nv+P3FY4pOSR2rXZPEs5p9Qlo0 w4LkgMS0aLqkiZ2JIDNQJciNtQ7qG00fuQINHubK/DC0ygKSXCVkS5zvege6ROD78vqlzw== X-Google-Smtp-Source: AGHT+IG0xNzhxt7UrY7HZq+ScBmwwqGVF+3mChlCw3vStPo10QbUDtAdUP2g2BtXzXyVdjQU8nOWjw== X-Received: by 2002:a05:6830:2b23:b0:72a:1222:9e8a with SMTP id 46e09a7af769-73afc8e7176mr9473278a34.14.1751297347862; Mon, 30 Jun 2025 08:29:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 12/29] tcg/optimize: Build and use o_bits in fold_xor Date: Mon, 30 Jun 2025 09:28:38 -0600 Message-ID: <20250630152855.148018-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297455425116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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, TCGO= p *op) =20 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; =20 if (fold_const2_commutative(ctx, op) || @@ -3051,9 +3051,12 @@ static bool fold_xor(OptContext *ctx, TCGOp *op) =20 t1 =3D arg_info(op->args[1]); t2 =3D arg_info(op->args[2]); - z_mask =3D t1->z_mask | t2->z_mask; + + z_mask =3D (t1->z_mask | t2->z_mask) & ~(t1->o_mask & t2->o_mask); + o_mask =3D (t1->o_mask & ~t2->z_mask) | (t2->o_mask & ~t1->z_mask); s_mask =3D 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); } =20 /* Propagate constants and copies, fold constant expressions. */ --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751298107; cv=none; d=zohomail.com; s=zohoarc; b=lvISDQVPxr41wlTZ6Llqc8p2e6jdADXTCZYMcId95PCLb/ik2ZIzjVzPMHdv3DuOPYA4jlPFFznHdNpC6TSKjFkfUo4p/N8ZxCYXTl/XTbvwRbYawtgDYBNu69Sq+PMd7uJ9XYdjtDv/rxO+NGEuYcmHtUjvfaxlxSS1SgxlL0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751298107; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jitYedPynmCQ1Qys4MAPCF+b+h++9TRiJKtdi+1sPEg=; b=frfg9aho0NWOQwzamUKkM7K7enUx4WFoZo90aKJAIA3GJZZZ1Zk+klnYHxKiiqS9z9achzUX6Hq00CMwfxN9Q+/XuYcI/0RZx4GgUmb50SwVg0q4IF/zy0pigjYOh0BPwU31zs4sTZkeVQ31NkoSaR654tDC6Iaj77KyPoYsMeg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751298107027510.0707178710496; Mon, 30 Jun 2025 08:41:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS8-0000cb-Dj; Mon, 30 Jun 2025 11:29:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SA-8H for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:25 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRW-0008DO-El for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:21 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-73a44512c8aso998048a34.0 for ; Mon, 30 Jun 2025 08:29:09 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297349; x=1751902149; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jitYedPynmCQ1Qys4MAPCF+b+h++9TRiJKtdi+1sPEg=; b=s7HVG1aM4qlpjWMoEix5gjwiuA8V6M2LReM50bgH9jr80mUi0pelqge8jLsgtwnRE7 JS33GBk7IGPOZjQM7Pn766XoacJDstP45mdrD6UGja9zMIHeYuBsGu8F2aN37Q+kmr4F u53nxBMTxvYJsp8jGn6Mvd570bgEe9QBcetWpld04ajnLiTqmw6rI3kfogwX769h6lrn AIcvDxO19VUksrYwv60Vmhad9GlfinxqI+NLLHVvzrXA0AI4I0NcvHF4dZfiztXU5894 /g27ZAH/IxsfAPdPmlwKcfIrSf1AMX1lzTCt/aoHEyqxsoezD1SYB6JPMQe350q6FqWW Cz8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297349; x=1751902149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jitYedPynmCQ1Qys4MAPCF+b+h++9TRiJKtdi+1sPEg=; b=LLZU4GPmtktfIqqx+VO3qQ3bm4t8ib4Q20VIc13sxGrptZywUEjWX9kjF41vTgsmJk pCsHk5Wv/LDA9x2cW7C8FqENimuGzQd0Vi+usn60jHgg7w3Xoi5BdOQ0NMKp8f0fuiY+ erBfKnx5TE5XHShLd/J+oAxUugFh44IioXuGYc+uuQz+sY1Z1scH0Tw2hEdeU6VOV4f1 bEkat+2aAdvvNeN02lk+m5kEqYp0deXqtnqAROciamQhgMe7Cwe2ILPcvCY0xBYM4ERA nhUcrrkuZ0V2fa87ISSPmUjezed+R/sguraJ2FtNJvO/bCxu9W/UJY8etkmhWyVQr1Ok k0TA== X-Gm-Message-State: AOJu0Yx53eQTq/kMIUBf6WTOb+jvm2bGnzWX/Fa1r0musXFcDM4q4yog bjvL4ymnIbUdHf2efordoErNJsAbWWMZYMJrkPP0VzAm4BwXFkAdRJPr5+hxRaaqZZjG9KhPWQ1 ih9hD X-Gm-Gg: ASbGncurS+Aw13t7qWH3wVF3YEfZi/fJ6sBcwGkRMoBZ4wlySk8Qiu/EpzZc2lmJarR AbdiNZm1NCbriB+fI2IOKUowGnL44MIbq6nYmWy/2o2cpFYPFhwiyNVM4UxBK0wELtN7zaiu3zN VIXrswwl4yZ8ctgz8jbo4ZL2RDqUQ7DslTFvG+dFxtGXOG19VIAlM2Gwc+VTL6BkAVg+dyPjEIQ NUfmpOkGXy64DJpGnFOYmkam4du+fUUDX+2LCsLnziPq6OaQO12kzEyS6el3MQut6UQkF/tICwn g4Eiyl+F8lIFyC5/e0UzBbYgSD0aMBs3yo9mpygTuCkQ09YBrCG3GaJs7g0QXELLlFsgicdV6n3 Fj4dC X-Google-Smtp-Source: AGHT+IEOhN/NbmGQfDtYJu9U4ZhRkQDTRiXHAHc7wRfEk6Nsp/RPFnocN/LQ7j8ClIxqAT/Ba0QrLw== X-Received: by 2002:a05:6830:b85:b0:73a:96e5:1997 with SMTP id 46e09a7af769-73afc53af71mr8754141a34.7.1751297348713; Mon, 30 Jun 2025 08:29:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 13/29] tcg/optimize: Build and use o_bits in fold_bswap Date: Mon, 30 Jun 2025 09:28:39 -0600 Message-ID: <20250630152855.148018-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751298108825116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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 =3D arg_info(op->args[1]); + int flags =3D op->args[2]; =20 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), flag= s)); } =20 z_mask =3D t1->z_mask; + o_mask =3D t1->o_mask; + s_mask =3D 0; + switch (op->opc) { case INDEX_op_bswap16: z_mask =3D bswap16(z_mask); - sign =3D INT16_MIN; + o_mask =3D bswap16(o_mask); + if (flags & TCG_BSWAP_OS) { + z_mask =3D (int16_t)z_mask; + o_mask =3D (int16_t)o_mask; + s_mask =3D INT16_MIN; + } else if (!(flags & TCG_BSWAP_OZ)) { + z_mask |=3D MAKE_64BIT_MASK(16, 48); + } break; case INDEX_op_bswap32: z_mask =3D bswap32(z_mask); - sign =3D INT32_MIN; + o_mask =3D bswap32(o_mask); + if (flags & TCG_BSWAP_OS) { + z_mask =3D (int32_t)z_mask; + o_mask =3D (int32_t)o_mask; + s_mask =3D INT32_MIN; + } else if (!(flags & TCG_BSWAP_OZ)) { + z_mask |=3D MAKE_64BIT_MASK(32, 32); + } break; case INDEX_op_bswap64: z_mask =3D bswap64(z_mask); - sign =3D INT64_MIN; + o_mask =3D bswap64(o_mask); break; default: g_assert_not_reached(); } =20 - s_mask =3D 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 |=3D sign; - } - /* The value and therefore s_mask is explicitly sign-extended. */ - s_mask =3D sign; - break; - default: - /* The high bits are undefined: force all bits above the sign to 1= . */ - z_mask |=3D 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); } =20 static bool fold_call(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297719; cv=none; d=zohomail.com; s=zohoarc; b=BwsC1SYVqIFmfgXlf6QGD08wsXD3/HQoXNnOU9W3eHjs03LWLU0RIXgX2ul4yReZ9t8rRJ6SHQl8VXf6WQOmR71oLZa9HnPnFgNhe7/G/9x++j3dhKqClQc6SaVLWhjPM3jgiAEIHOoLgHVTG8g1YezUjITglH3vGbVjSqu6258= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297719; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Jecekv+v6ZdBkwcM0IXQBLsbwinUXoi160CeHuz0xhU=; b=FcIogOay8Lljtnac67Hkp5IDgyEMjWhV6IHn03winBwi36avY6ppIggtM8Sf03RCqgGGZbVa7amjnefgbvYRrakJdpysuxZ9CStj1wm4C5SUV2PybfXIIToJYunLe93e599RilJHPR8k5DJZMbKb0+jUbGhUgzwIQs/EYHa7wuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297719159405.42282979237075; Mon, 30 Jun 2025 08:35:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSI-0000p4-IQ; Mon, 30 Jun 2025 11:30:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SD-97 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:28 -0400 Received: from mail-oa1-x31.google.com ([2001:4860:4864:20::31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRY-0008Da-Ko for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:22 -0400 Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-2eb5cbe41e1so3357478fac.0 for ; Mon, 30 Jun 2025 08:29:14 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297353; x=1751902153; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jecekv+v6ZdBkwcM0IXQBLsbwinUXoi160CeHuz0xhU=; b=sXqwiCb3MtvqoVfsL2M074JzdM1mThg0QdiCoMhZM5hmTlv5j6CaerFxZ99r9veVTv cGIH24ZEPjvpRQcCqrA8yHVybumZ6oi/fCyX6GdwVSoAPGo5o2yI5ev5Wo8qfII5+M27 cnxFwV2B/wVYtIM0KrIYVOvHJct157z3P1AwG7eXzYyr/UpfYFFC+Kj9cljkXSXbia/A 8kEETsMVLElkag7AB3DU5KNfiy5fqGaHtXIJGe9SD1/fcTu245zMXlzHybTn/vcKRRPL +SKWTVx0nUCw9v/vntxo4/xquiblTj9IsfCRo4X2qgxkC1eENwIi6lHOt1KDWI5j4rUm yRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297353; x=1751902153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jecekv+v6ZdBkwcM0IXQBLsbwinUXoi160CeHuz0xhU=; b=fp6EINyAmtE5bHV2zE1UFt8U2AXjsH9+9GCdE4rbfyCTyZNewCMICHtfmJgTSEzQ+Q 2W/ocPrLGXfpoSD8zx3vbYF1hSJemdKwSELMPHPug1vztfzUO0rgnayGC/eMQ6G8RUrp Gz6Q6h3BUolE9y8ce1tB+mmb8e7slb5V1whWWfKMzxTIoJ0maT1va6+1PwvL1mKee1h7 MhEz60AHa8QdLo+WhyhkoogFKjC3yxa5GnejhRiMpo25KhlvNZbfH2T5ixN8Qkhk1l9l aZgzzREkx9Q+GKwaq9t16SRax7Ei5dC89j5iWfq9X34IrDH6UNWMr+waXARFwjcrBSnd udAw== X-Gm-Message-State: AOJu0Yyc28mPPP+vybpkMvdfYjoDi+vOldTBeAhT4b04v94d5g/p9E9r Q9d8oIFqj9NQ/lkUltsFNglKwu/dFnTJHaXI1sAahSKH2zG54jYt8ggzRC9RrzuObTl9DmYlZDM ncqVs X-Gm-Gg: ASbGnctNcYC7KXwPT8Ot0gCl1PzE7j47NA/T6+mK6fwXkuM2Lan2QLYGP2m1Buv1/0S N51GRQk3K+P0CiGCCxB/H1OA13I8XPKt9tf7rW5XzOLUBHJgB0VgLKjIz4gi8MY/jUJjjub6pEt hn++5rjv90r4+YH9Y0zNUHo7r67BkFAPxP8f50FEqpSpupxvZPvPlj95NRtcT2NJQ2ZfDZQE6+9 M6QNihSiOskHk6nOKF4qoByCCF0k41n/Sgn41DvUXqfxmUTrt9UwUPLQFgOIM0DUE86LwXSljHR 0Vp2Ob/xIvvhX0uV0mIThQP8wHJssEkka4IX1uwpSEo0o3GypgRsQClFqy7vI7vXoHsJEw== X-Google-Smtp-Source: AGHT+IGSX9NflLOndu+Om58F9eq4VbHii/mHMK11mS0WsKTvPvzOJNvf/MTOzmWrBaGryAFabNKs3A== X-Received: by 2002:a05:6870:b4a5:b0:29e:4340:b1b with SMTP id 586e51a60fabf-2efed4c0f4amr10477191fac.9.1751297349494; Mon, 30 Jun 2025 08:29:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 14/29] tcg/optimize: Build and use o_bits in fold_deposit Date: Mon, 30 Jun 2025 09:28:40 -0600 Message-ID: <20250630152855.148018-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::31; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x31.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297721212116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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 =3D op->args[3]; int len =3D op->args[4]; int width =3D 8 * tcg_type_size(ctx->type); - uint64_t z_mask, s_mask; + uint64_t z_mask, o_mask, s_mask; =20 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) } =20 z_mask =3D deposit64(t1->z_mask, ofs, len, t2->z_mask); - return fold_masks_zs(ctx, op, z_mask, s_mask); + o_mask =3D deposit64(t1->o_mask, ofs, len, t2->o_mask); + + return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask); } =20 static bool fold_divide(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297596; cv=none; d=zohomail.com; s=zohoarc; b=mQP8dqMSUlWICphpqaXUgHlL6UkxPhmCgp0jqUdxZVkwOA8yFODnDFhBDVxHKTbqRPyg1Z+HjTl9D9zxXiOQOoGh7Ri9fZGPJDoicvti60hQIjoR1Dektxy28Z5P85F6HXte1FbdpyL0UfPSundYoLtnFCquNT9W3LuBIBWLFkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297596; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4H1axxFmY1zlJ3Z/D9SyseYLfrfcCGZjjnsW9t5XeR0=; b=ao2JzSZjinHk7dU0VXfdj+e3vcipvUTwbwvHZ+fG0qMAFzCdJxFUBjAHLiH5fYzWQADJGeTRh0jwY36otu9yxP06k5JvujXqsdTH23udTsfuoQGHA7itdoogBc8bWW/l+y2ezFtQSoi17zwuvTrXLOJ99qAm2nYDzFQ0gwTPVZw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129759652671.71007474023509; Mon, 30 Jun 2025 08:33:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSF-0000jL-7m; Mon, 30 Jun 2025 11:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRi-0000Sl-Tz for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:31 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRa-0008Dc-If for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:26 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-2e95ab2704fso1521509fac.3 for ; Mon, 30 Jun 2025 08:29:15 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297353; x=1751902153; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4H1axxFmY1zlJ3Z/D9SyseYLfrfcCGZjjnsW9t5XeR0=; b=Q/qeM8x7mJzp8jpKtx6NTFnQaA6a51QlFbcSjfpTfEKnGi7fMqxrVHlbnTbr4Pa1/J hB90XeoLHG7Qmw14QApusuqi+lsncgtLNQAcN02n1npLRgyIpOOfxQ9BK2E7URL2r5Ul nB9RNXgR/JKzfD8LOHiflgHjvzBh21RJYpok97S5VY/dEQvtC0zAF6MFJB8/Wl8Kkzul 7w4HEOyYoSvYfzNVgzfjN8CjF8Q0+h+0vzrvGSM2gTkiYiWayA7Z7L1Cx/UddNu/cHxC fmVA2/X0oqdViIP/ZWdhhhYrESnmt6APq+4GYb93MPxql4/L86TMwJpREUv0YnpiQ2SO aN+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297353; x=1751902153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4H1axxFmY1zlJ3Z/D9SyseYLfrfcCGZjjnsW9t5XeR0=; b=VDZCqCgl5o2ATI02fJUpszdixMUZCSin97lddYq6tZBBsxZVeTkFXdQjsf4UlnFzDs LZtVTqTEH4iiQj3aeRn6muvn7WW1/6qHDjAUf1/4pwWIM7XwBbi/HN86870Dz57whtHj U6M6Q9lEXYlICpoEpdp5QvVyGl3ShwbZb7x52hq7NMHpZayGeBm3B+fsAJZTWuCyOSEu x23bCLmfXewySFK/ygboU/S1jCIeJt8Kiv63Kggs4YTDyQkNbN2YFkR3TJar6OgY1GS8 fG7E/N7rwYf4sRwGkIw0GZZRWUUR0S6uJstMqCdGdxZ6P8cMymxAaYASaGNfU/zv+whw vVEQ== X-Gm-Message-State: AOJu0Yx+TEvDZk98gP6DRUHdHPSNgG8XVOKd8jgCqIYWVaJ5QK0u8n5G 55hW4xXSSSEyMcVbiRBALEx5cAyIvQKkYctHWtRc+P9fplTcWN5QPFASR902HaIDenLr16ojjeI iTn/e X-Gm-Gg: ASbGncsvw3qQMlhkIIMb9GutFA9zlSwbP+UeTSkTEtGOYGZeF8I2X4kbD/q/kpYC4yE bWtf0oKomiUFWYb+lLJHG68v0aCObKKJ02yE67WwmMnqwzojAUASCq/5NfHZWSehUFd8RwoBHj9 qVorEBVSAJ2o54vWrs+D8NrL4Ef4ny75SS/E9zWz1SqbXsz0NeJyuRZBhPO0/wpvlJDplW4FeYR XGPgrtVpmhQDA8fB500fl3OxEiX+1yaK0094B/mYj3ydaNOhbvldY0R/PPg4YssXqUCxn6PSfqu DT2f3avwCeZe4Z85Cp4Zk/T6vdYozqDCNIycpQSIqNqYS223AefX0G6ZDoofEkJ90EsW/g== X-Google-Smtp-Source: AGHT+IFM3dsBfs9g8qYzS5Gapq6L3lMwKpkrRxAvthY67K1fn1kL6Wk3CerUrTy5i8w2Jsf6UDCFyA== X-Received: by 2002:a05:6871:3385:b0:2b8:78c0:2592 with SMTP id 586e51a60fabf-2efed7ce659mr8356105fac.23.1751297353608; Mon, 30 Jun 2025 08:29:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 15/29] tcg/optimize: Build and use o_bits in fold_extract Date: Mon, 30 Jun 2025 09:28:41 -0600 Message-ID: <20250630152855.148018-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x36.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297597223116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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 =3D arg_info(op->args[1]); int pos =3D op->args[2]; int len =3D op->args[3]; @@ -1973,13 +1973,11 @@ static bool fold_extract(OptContext *ctx, TCGOp *op) extract64(ti_const_val(t1), pos, len)); } =20 - z_mask_old =3D t1->z_mask; - z_mask =3D extract64(z_mask_old, pos, len); - if (pos =3D=3D 0 && fold_affected_mask(ctx, op, z_mask_old ^ z_mask)) { - return true; - } + z_mask =3D extract64(t1->z_mask, pos, len); + o_mask =3D extract64(t1->o_mask, pos, len); + a_mask =3D pos ? -1 : t1->z_mask ^ z_mask; =20 - return fold_masks_z(ctx, op, z_mask); + return fold_masks_zosa(ctx, op, z_mask, o_mask, 0, a_mask); } =20 static bool fold_extract2(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297497; cv=none; d=zohomail.com; s=zohoarc; b=msy+SR1+MAEeyAQRUGpugB21nsSGgT34CF4a3yNUYHaRnvvraYuDUegXfuwLa2JFy7+AZzk5/a6sUBVefftQP0J4j+n0MrwogTXoqf+K9Zy7t4KGWLVqY5dVGPeE/mHNOvF1zqZt/SVe8gAA8q+QsE3AT97d0l7MhOpBMMYE0ZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297497; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IHWQ9jZt0RU2JCkb2dK4Qaoa+rz63y9Og4hJnbZwLYw=; b=OEzIBCiLp86ZzergE0vJi9OHtxiF0Bi+N8CdRLE3MjAT3DGjS6vtRWK7zLwzQYw9THv0cTcXJLb00y+9GydCmY9umr0d7ZefRh5MZFQvWzY3Y4RhD5bYmUh1W6IxQTcx+S2JhikUygy0nb/k+Uos8cyIh4B+HzQebCOWjNBD504= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297497927570.7629533241942; Mon, 30 Jun 2025 08:31:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS9-0000ch-C7; Mon, 30 Jun 2025 11:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SG-9X for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:28 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRZ-0008EJ-8i for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:21 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-735a6faec9eso1242930a34.3 for ; Mon, 30 Jun 2025 08:29:15 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297354; x=1751902154; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IHWQ9jZt0RU2JCkb2dK4Qaoa+rz63y9Og4hJnbZwLYw=; b=SZjwAqNQJmKw2ESgvgvL4xmo0m/bsDYXkyo9g3IHgxS1/Z4OW/UgBvGrC8WdZ/4iz0 m/ipQn+96+oR5ZGyaZupCpXw7OMNbPVJ8yO/0KFYwW+QcUVp0GPzAYzyuP4m/8CvqW4q rDlFsnNA5oN96tSfKttaXsMaXXldc3aGDhsfv5ma6kER+2bZBmxojhLc92TOnGTwmjzh pKfZJkJugsU61dYx1m36pF8cHamuw3fOtFaJzbVsnJN1zTyXRhCuOhsVyA3UNrmkLup7 PtsxPUCuCX80ExhbkGIUVA28LhGhwo1mOm2cbqBoPbCAUXdtE2vif0e+tiY61E+V8URw MEnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297354; x=1751902154; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IHWQ9jZt0RU2JCkb2dK4Qaoa+rz63y9Og4hJnbZwLYw=; b=leTJ3+NJpo0MLUr5BVdIS6olRtQQpPZQau17RzfnammcarXRoGOMw5MOx8HnUDT1Qj EkOQZNyZQP+8F5tUm8KKw0Efuqz69+njeLoKwyzYCZmATdmE7gxum7A5LRHhvBQNjqV9 OOvX7midzKzA2yZl0b4hnfW4BQsCdY0cnVWGEcnbobv38lcjzA4meOfSVqKlXZZ5ypD6 GbPtJYNLsuSqhqLASdIH4FWWgFsvEQ9GhEz+jE4/Hvz9AN78NXY6puVjOLislCXzWOgt gmasentEn98KdNapBiMNG7THkJSppT8ebSQvBPkdzgV2PRUVICOpzyBRn+dPxgEW4ruw dWvQ== X-Gm-Message-State: AOJu0YyPgqr+CsInDoipZtyE0J73p0Q4N8vT2wfS89yvcMpB6ECn7tZN 109kcV3wntu98/6qc/lEe7pKIJSCQrNh4LyOjRiNabenjPFIcNh/Hw3C5EulEP8gu9SnpBTaLbo l69Nx X-Gm-Gg: ASbGncsdBo8uM8i5JW0Begp2HG83shTniz1RlRG4U6XaAl5Q1L8rMGKMSz8yzVYUiss hN5oiaH6TWMARweXui8bSNiTrUdTb8UXB3GlS5u7Nb63Pm/ofKKRvs+yshQD2Gzzuk/QNIv5AZa tDrECub/Ljxh9sgWNatHo+JzWAzLK5kdgVYbgrIyzIoZq7A8H0wjICHPrtGRBfv01BxinUzofWU FszQBNgwwNrqTriB+HRK1ioSoIVhs6Ap4uE6z+sK7itqfRaCYdaGJEVHPLqJYqImdvItrWe7aj+ Ebgm06aNvpgS/AiGRdt+osLETYcDmzu6X6lJY4DtxqGggwrtvEJF4IYzCyId9cmkKkz5RA== X-Google-Smtp-Source: AGHT+IHDKHVY5OjsZXBPx5e6hI03G79lclH4mk9cyO2yBCczfjGnX2j/CjvHE7Wr3imqNfdpaZdyNg== X-Received: by 2002:a05:6830:2c06:b0:736:8a4:6835 with SMTP id 46e09a7af769-73afc39b3c0mr7339256a34.2.1751297354522; Mon, 30 Jun 2025 08:29:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 16/29] tcg/optimize: Build and use z_bits and o_bits in fold_extract2 Date: Mon, 30 Jun 2025 09:28:42 -0600 Message-ID: <20250630152855.148018-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297499964116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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 *o= p, return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, -1); } =20 +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) =20 static bool fold_extract2(OptContext *ctx, TCGOp *op) { - if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { - uint64_t v1 =3D arg_const_val(op->args[1]); - uint64_t v2 =3D arg_const_val(op->args[2]); - int shr =3D op->args[3]; + TempOptInfo *t1 =3D arg_info(op->args[1]); + TempOptInfo *t2 =3D arg_info(op->args[2]); + uint64_t z1 =3D t1->z_mask; + uint64_t z2 =3D t2->z_mask; + uint64_t o1 =3D t1->o_mask; + uint64_t o2 =3D t2->o_mask; + int shr =3D op->args[3]; =20 - if (ctx->type =3D=3D TCG_TYPE_I32) { - v1 =3D (uint32_t)v1 >> shr; - v2 =3D (uint64_t)((int32_t)v2 << (32 - shr)); - } else { - v1 >>=3D shr; - v2 <<=3D 64 - shr; - } - return tcg_opt_gen_movi(ctx, op, op->args[0], v1 | v2); + if (ctx->type =3D=3D TCG_TYPE_I32) { + z1 =3D (uint32_t)z1 >> shr; + o1 =3D (uint32_t)o1 >> shr; + z2 =3D (uint64_t)((int32_t)z2 << (32 - shr)); + o2 =3D (uint64_t)((int32_t)o2 << (32 - shr)); + } else { + z1 >>=3D shr; + o1 >>=3D shr; + z2 <<=3D 64 - shr; + o2 <<=3D 64 - shr; } - return finish_folding(ctx, op); + + return fold_masks_zo(ctx, op, z1 | z2, o1 | o2); } =20 static bool fold_exts(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297646; cv=none; d=zohomail.com; s=zohoarc; b=ZhNgarSDtpOEkSDbmA8UzQ4Ddqylax8WFhNQvc6rIMSlJWQJ8TxLmAYijIfVAl0OZqdqHIbnoCjm6APV53PVU8vKwnYNZRY+nuHGM9i7KQOIpVhbqQlvxLKNDNRzByL+MsGpN2+GLTWpcl69VxZHfAw5DR27Fj88AnJ1msLQQ6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297646; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UlceHPyhFoGBS6k1Ha7sssoddrle3FjsPN6fMXf6Nt4=; b=Y4cht+VFp276o/DOQJu+Br4lFPuXFtP6tCDnt7lcnZWybdmquiJ4PH7s2SOgkwU1RDm/MQ9q68Jobzq2YGvu2crZHbtwdXH5QFADpgZW4t9Xaq81YX+5FvFAZPLR1I02YHwaMNaI45Uh8qdAWFixXjik56WaBQPVuYn7t3BVFk0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129764693426.827303633767656; Mon, 30 Jun 2025 08:34:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS7-0000bZ-5f; Mon, 30 Jun 2025 11:29:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRc-0000Rq-CD for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:24 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRZ-0008Ec-CR for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:19 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-2ef8df09ce9so1061393fac.1 for ; Mon, 30 Jun 2025 08:29:16 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297355; x=1751902155; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UlceHPyhFoGBS6k1Ha7sssoddrle3FjsPN6fMXf6Nt4=; b=zI56pnQDYgqkXfn8leK1gyqHMnN5Vz0hvNr7xcQrw2OaBuu+eVc0gcX5GQrJUik4xy IWM3ChvI1JcsDvAl+YeRkHgahz/rnZ+VtGcBsz1pSyK958++Mn/LFPXB3LQQZDheBlPf hqnsTl0eMG4HmWTJ+z1jebZ/PD5VfnUJQ3goCgjTXfPNptbP+NIw949JVuizKg7tFdXi G767mPquvf1XPMIDz+WivyihRWIEysuKkVXLUuOFrwSskFsXklzhtaPXOtttTWL28f1V lSGlgmb5784lW++2FUy41m/7jZ69aRkQ1tMuJMiEqgkhQjeRW98oGNJHorcUCcvJL76N W2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297355; x=1751902155; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UlceHPyhFoGBS6k1Ha7sssoddrle3FjsPN6fMXf6Nt4=; b=wrs9wobNFq0Mq0/dpoKet7vewiRyTFAlWmvfOTJj8y4CFo+o76OrePZOR7B9xCmhmd Xmkxn1nsGmpAUcJ9Api6SjJFrK04FGrHo91kT2me57jEuDp6EwjItNLSbKr/EzLKosKF MEPxg78p03Tj7fPHDZnV0RRTj/USFa6UvU64ZzmXkprhyaiK1qVS2iE9xUUW6AtmctGW qEjOj0yYwlCRgOVS5FHdyFMgaqIqlW9EWNDb+ouQF+b0kuZR/h3e9lpS0nq2IfRy9uan PpoHhLLYFBuPuz//DG2c5kJoDueMRs7DZoKsPKRfbMbZhBGuciufFKTLqbe4wvqOzuRi zPSw== X-Gm-Message-State: AOJu0YyPICfkvxVskqHVS3c5Tcxha3wQPhONGCe3ea/eihepbjmF41K2 u7PxOlaJCg2Lm3dSbTEHBwZCPCcMJx6OvXOdWmbbxRH/N3nWf/sGAGOGwxLjseFRnDhhzU5Orca qWahs X-Gm-Gg: ASbGncsOBLIa84j4bgsVnqrSIXLuEKoYdRIs4sBVBPDraZvd7Y6tLYaUrg+hZNWbcRb yZK8VYjttadtsDoG744p3/xgZ6F7/zk6JWQTJ49R3sm2ezJPWj7f7mmBFJwcH0gWyShzPp8V0cy MH00txERCn2pjBXg4u07HVdAD6117/3EruEwTket9/I7ybFGBt4gow2zf+BiFwtqB+TfjUaV6hX y0x6CAndkgmm2UwjZQzetue7M9RkVxSqvskbh7RHJimSHyFbFKyMd4ueghcKx/zT55koRiySeQn qVHsm83mMHMpbCZik/D4jf4rxrmvbLTVfMybxqW7U3bUmnribtc20jLSesXjX3RAmST4IQ== X-Google-Smtp-Source: AGHT+IFqTxfyMvAUmEBlnBJzbOh0qpph4WMzDBuktiRd+j7OXReAKN9ZGI6zE8DVqrYmRI9gd5ryWQ== X-Received: by 2002:a05:6870:be97:b0:2ea:8c15:d6d7 with SMTP id 586e51a60fabf-2efed6f3da6mr10067978fac.27.1751297355179; Mon, 30 Jun 2025 08:29:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 17/29] tcg/optimize: Build and use o_bits in fold_exts Date: Mon, 30 Jun 2025 09:28:43 -0600 Message-ID: <20250630152855.148018-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297648448116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 static bool fold_exts(OptContext *ctx, TCGOp *op) { - uint64_t s_mask, z_mask; + uint64_t z_mask, o_mask, s_mask; TempOptInfo *t1; =20 if (fold_const1(ctx, op)) { @@ -2022,17 +2022,19 @@ static bool fold_exts(OptContext *ctx, TCGOp *op) =20 t1 =3D arg_info(op->args[1]); z_mask =3D t1->z_mask; + o_mask =3D t1->o_mask; s_mask =3D t1->s_mask; =20 switch (op->opc) { case INDEX_op_ext_i32_i64: s_mask |=3D INT32_MIN; z_mask =3D (int32_t)z_mask; + o_mask =3D (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); } =20 static bool fold_extu(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297736; cv=none; d=zohomail.com; s=zohoarc; b=ktfkcsa1RRmY7k3h7aMYdyWHho23dltdlK6uShrotYHGvU/dVzQpXpQNITnkgyf7oFtweAZvZ1RztmGswaiYw5cy61OYP9RCTzV+qU5BY20S1bbtWyuEQeT8Jw8lvzcHBAJmf3qZ6e9YYRlJyLpqRZoZGPIns4I2KH6mGIa3hEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297736; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ePUHGe7gQBW0tgnDTQB1WBsKviMpiMLipvjg21yNeZI=; b=CcxOjHQAt/yQjnQy7uiwVO+GRgKAy7zRU8FkgBkHeKjaMVoO98hB7sHkF5Iux2Qny5pvtHL78Rd7zDYzdu0B9QRIbcBgV6zjCkb4wfg4EeDmw/Wnndd/i5QHkFmJcgUucuAGPwx4eqH5ADu1ojzerNqNgZqsfgNlv0c5y+uabYc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297736443700.4670600639006; Mon, 30 Jun 2025 08:35:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS8-0000cR-0P; Mon, 30 Jun 2025 11:29:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRl-0000T1-TY for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:34 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRb-0008F3-GL for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:29 -0400 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-7382a999970so2421266a34.3 for ; Mon, 30 Jun 2025 08:29:17 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297356; x=1751902156; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ePUHGe7gQBW0tgnDTQB1WBsKviMpiMLipvjg21yNeZI=; b=PastALWr++51CHa1xQkdW4/m/NEy2dZKS9lYsis1sFbLTob3XrEwpkH6MBJnj7moA+ TLzjSY3zxhZi9dIdK+SkcsjWUpYa7viZtWru6MbbpVvzvlhfHy/K98OesArJSrMKwgQj 3est7lmOTEno0ZIHEChc1I3n+zunRFyMSklguJWl9ZSSYwEHqJAaEFSUlBNsxtSNYj6P Ukqz1ZMZ6pC5LMx+rqAvlIlHWUZp6kGU4yry/yhI/eYfcnDL3OKB0HGVaf/r2cJNbmfb bbHS0jQDGcE1PtzcBafLAwz3oGCUfDXc0g6beVIlBwLOz9BJh89tjJxnhH4ofGBsh4WY PoXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297356; x=1751902156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ePUHGe7gQBW0tgnDTQB1WBsKviMpiMLipvjg21yNeZI=; b=efGxN5Nzep4j8hkAZhM8Eq0yCMSaCg2oPcVu1QMlnfWNOyx8nHXwNZZE+E/5LPDi8S lst80SZNnbqrIXFnhwgk4brb7F8d62BPZrBx3VFQFGAnIUfcw8R/c3BTefKhN1RYmxkI OAW0RlcugcfGjNaYQRlYL2chmu8xpD8BVTHodJ/nCalbCvneWdNm+8e1E51K/gM9bc1p JOAmY/O/PTomhYoJdfxaHLeFdF3ep+rN3PiHZpFrBkV+LM6uv/SJr74IZQO70hItsb3a 5AhVVDARa84mCsCVycN7jr1kDYNlrdMsfLwZnH/toI7j5CyFb9ZufvgmAQI7r4kEIPCI JG1w== X-Gm-Message-State: AOJu0YwmulWOWbKrvkgahPxxgxdjYSU2qv8alyvITseffrPt7fHU+ap1 JpR1NiH6Urjkq+HneW83YoKGoc6c6a0JjqSjM0tkJlkROPCLP7tb/nvxjwTzDY7RODIIAaMD2qd STFA2 X-Gm-Gg: ASbGncsKkquGF/Efg9QGicm7pNx8EOAfDxaqPr7AQGWr5VEMXlAlqqdI68cKEdRbCrr 5oCHBAOc5sMbGewvd+qoeyLOZfo7PK6UcLPcqL70saGPf0PLWz6llitPK0+JSxBFFxdXeVv1FRF QoJoSGGKJjqnoC8Tp89QrJGodH+Dlue307IVrs98zIsVIPCG1jOJMqS6IHzIEmyjF6AkMotYPFV nHIfc5JLZq6yqs52YHCbPTFL9B96nPXDBO5gWktwIdjFYiWUnATvv8HJOZSJzVuNLZ1y7a6jFEI b3wteG6tBdwov0kM5Y5y4ZlGr1dFIqtlB46BYn7ErIKMO6jmxlPWkxFUq+an4W0vujjNHQ== X-Google-Smtp-Source: AGHT+IFM6VQOtUnsSfH5Mq7WLgn3j7xwiiLm9jZVnze+lQCrvlbfJhJpHJxDsuAmw30kv1eT0saMMg== X-Received: by 2002:a05:6830:6687:b0:72b:93c9:41a6 with SMTP id 46e09a7af769-73afc640c34mr10986312a34.20.1751297355870; Mon, 30 Jun 2025 08:29:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 18/29] tcg/optimize: Build and use o_bits in fold_extu Date: Mon, 30 Jun 2025 09:28:44 -0600 Message-ID: <20250630152855.148018-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297737149116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 static bool fold_extu(OptContext *ctx, TCGOp *op) { - uint64_t z_mask; + uint64_t z_mask, o_mask; + TempOptInfo *t1; =20 if (fold_const1(ctx, op)) { return true; } =20 - z_mask =3D arg_info(op->args[1])->z_mask; + t1 =3D arg_info(op->args[1]); + z_mask =3D t1->z_mask; + o_mask =3D t1->o_mask; + switch (op->opc) { case INDEX_op_extrl_i64_i32: case INDEX_op_extu_i32_i64: z_mask =3D (uint32_t)z_mask; + o_mask =3D (uint32_t)o_mask; break; case INDEX_op_extrh_i64_i32: z_mask >>=3D 32; + o_mask >>=3D 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); } =20 static bool fold_mb(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297923; cv=none; d=zohomail.com; s=zohoarc; b=YDUzeTmhVE+6STsyA4BqhTT5TYffjVdD0FMSKXyc794rSMwUbEKhxX2l64PCQGq6MDYUJUBhVA1CppQ98kDkwmpDtF8gy0VJ9ngzaIo3EmRydVMGsS0SrrAns7sAhWjGuiFa9UpjrLvfjDFh25ltlX6iDu/Hv2y8IUzgOaXcWHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297923; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jATSbSJ+A/6hV81CQNrcRjhOil/0/zy3N0rZ0dVrd5E=; b=UV3pB+804oSt8TLIzlLtXXHvQDMx37l5a+92KhiOIlOxGosv2VzEocAcGSEowH1dsir58pSTJp2yHfb+SrXPaovEYxyMT9DbmQynU4h/09wYWBxlcFn0FmbvWMHJsITQR1HaoOIfh97E5gxwZe4xUaOA4o2liXMgosHsMribWus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297923506402.3637625519781; Mon, 30 Jun 2025 08:38:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSY-0001IX-FM; Mon, 30 Jun 2025 11:30:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRt-0000UK-Jx for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:43 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRg-0008Ev-Vq for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:37 -0400 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-735b9d558f9so991277a34.2 for ; Mon, 30 Jun 2025 08:29:17 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297357; x=1751902157; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jATSbSJ+A/6hV81CQNrcRjhOil/0/zy3N0rZ0dVrd5E=; b=RzN/QbadWUJLJRM7bp6inzASxeYh5yhiry8J8dIOusZ96iJMKZ/iaajEWr/dHdeHQI rcy3VH76mm/ULUCRJ2ZHkq0jTRl/HsvrHsJDZ1kvQXW9zp5cfSeAd+lD2e7gg4ohFuQZ ok+W+//gkFpIS89NQzvOH0allmpt9Q2H0Ym+E5aVb8YbSCK9x3Hmxajrbx966sqe8nQE Xr+I+mQuck+PLNhfDQRj+yHdQmNgz1lUGEEdV3wolmMXqR4olN/y42snbs0jj5inO3NN OLopB3Kl1Jo89iW8sApjpku7njce9Uh4KhhDdKZKIVt5Y4pjdCxWdzWJXAr8K452LBUk ve5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297357; x=1751902157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jATSbSJ+A/6hV81CQNrcRjhOil/0/zy3N0rZ0dVrd5E=; b=JMrUgAlOqDT/4XsKGtuVjXt5lDbYfDZezoOripqKvV31UJXZI4M5u/E55vEW8a7c2J myU9OFEsnVmmCv2YTsexYQEPKq7ZpEa04OEBC6o3oeW9TZT1I4vQfoKHm91G1XwKS6Uw EaG0nuWU8o+oJLZlLL/LfSZBVJgoFVPG8OJOuWUWAj8UfU3MFaeaBOZXHvzvIx6IFtKR NQGynDnKl9p4NL4rzsgtk5hqx83jXqSTfEmoJDS+fE2RdQS9V14nXrT+LSIuVM7Wf+8n DHRG7G1BaOyccVuCrrAGITw2tIGvOx/+qLLua09I411CzjH6uQW3lIH3H9ROllYRdkNQ 964g== X-Gm-Message-State: AOJu0YyGIL0yejAtTZjiiS2ggzbfNIRQvaf4DNSZdoCQASOQO3c+RQTd mSvMAZUqsOU4ln6uyXf4RPEh6VuJQ5IP2Q97CnFFWYAJYFoNudrLvc4up15bhU33pVyCwr7Fosi pJxj6 X-Gm-Gg: ASbGncsMYJQkR06hsgwKfnuIEn2SWOo8ALmrXpMQVRmIQB3qs+bJ7nDYDFims54lab6 VxiBsQ17HbWCiLafAjFejL6Rha4O1ioS6lZDihEOd5u01FxnOYqx6D6BFyG4U1H7yEQwGjxj5te GnGfzPAFCPXc/bQLy9ci+QG3iTEnXizy7s8ZpqFE2LClPs/tXEZKyzvOQGTdOURmsYUhZ2QrjGD GoGl3zOzK7UTx3DgDBSkM9rkdL0nbTNRK1AbSEzHG4AduxE8xSOVqR0R/ix1VvWiHeQ/pvbyudI kUKcyPCKfqmzU+vBxLnrL2GryNA+MMFWPI3zQaf0KBOUzz2ot5e/8ve6JEvvdxdBe5UVoA== X-Google-Smtp-Source: AGHT+IEl1JcnW8ChWE0clN2oKZy9369urTls19mcMvkU2K3XPtUhD9PhMGdscG/yyNrJTZJgwXw2yw== X-Received: by 2002:a05:6830:6c15:b0:73a:96e5:19cd with SMTP id 46e09a7af769-73afc55e1b6mr8786075a34.10.1751297356570; Mon, 30 Jun 2025 08:29:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 19/29] tcg/optimize: Build and use o_bits in fold_movcond Date: Mon, 30 Jun 2025 09:28:45 -0600 Message-ID: <20250630152855.148018-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::332; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297924363116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 @@ -2123,6 +2123,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) tt =3D arg_info(op->args[3]); ft =3D arg_info(op->args[4]); z_mask =3D tt->z_mask | ft->z_mask; + o_mask =3D tt->o_mask & ft->o_mask; s_mask =3D tt->s_mask & ft->s_mask; =20 if (ti_is_const(tt) && ti_is_const(ft)) { @@ -2145,7 +2146,7 @@ static bool fold_movcond(OptContext *ctx, TCGOp *op) } } =20 - return fold_masks_zs(ctx, op, z_mask, s_mask); + return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask); } =20 static bool fold_mul(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297515; cv=none; d=zohomail.com; s=zohoarc; b=W3rYEp4eL+/jWw7fZfSn47oVIFr9zo/gxRdbg9qXDa65g28CJlRTBvBZKP0I3xfNSADzusXhtqcoEB31C2zOMK5B/0p+5MQtjQgg4cnEiUXK7FdponvMGq74qdH0MOBTpVy9awe1RfIje7FIy3/hoqYOyy00GXGx/axlwpMwqNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297515; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fEFba83PMta+Yg5bkX3XrQ6GehU8yhJygO/yADzTlOE=; b=TytpFD7/wnE2TcNEZDEH0A3w/iuUARccHPBLWNEil88COeADRsqa026obNQb7NRtLJ363bIVDOzzYK5BcA01TFxEcat4rGq7Rio55RF+gBwQ8c4+oKKWyLt+OUYUfrKSo8jGIqDN9fmVj6dkMFKhk/IA190x4O8M9M+mU2yaTX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17512975157541001.4963726188955; Mon, 30 Jun 2025 08:31:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSC-0000f1-UP; Mon, 30 Jun 2025 11:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRl-0000Sz-Qy for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:34 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRb-0008FG-NZ for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:27 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-2ef493de975so1457043fac.1 for ; Mon, 30 Jun 2025 08:29:19 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297357; x=1751902157; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fEFba83PMta+Yg5bkX3XrQ6GehU8yhJygO/yADzTlOE=; b=EbthRygHQylIndNHcJYbcgM4alhNEI5MiQdJ/qJ6Vu2qK8JE0LuEPop8/9qzTP3N8S NuACIAbVjVUxSpK02TcCGmGJnoCMJXwTlB1K1U6yQ06Btr1Qp6YfGfJ6YqAKnDJIypXV GcX1UAWbxXf3DN/GDtFHGJZR4w470p9S3zpyO4dJbkIX4KVlsE+OhnDlqgCsUDd4dz4i 4avLfuI9nhqv2DuOaXZseDYjDWwiPFJ4ciNziV3kuyjb3zcgmK5Kz0f0NDXcijTgIjJL AiVzpBPoFV95FZ5QsBrIVUvcUDFAbZyLRosnw5uYuZ4fFnFly4dMs1+WUulqi6La3t7i 26ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297357; x=1751902157; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fEFba83PMta+Yg5bkX3XrQ6GehU8yhJygO/yADzTlOE=; b=RS9yGoUVTdN0jVzFBALLJcXTIsnHFISveEKur6Y8SsraFWOjrZcBX3heDRe1pvm3Al H5ls0smE9sGWahTu4nYUDDhfMOo8HyQDYYLbQX6uVILlZa+Pb0/WcwVnYqpmgLChWpGQ KG5mH9juxxD0Ft5+wHX966kvkIt0fXH+eFk8rUu5nVD3RrJEMHvIlWSopF3CDmzalo9q kuVh2nnomT6r9BAGwt091sA6TAbeTBLRSdmZ+G7JDC108qsU4ulkOlqPtIHP8wrKA2rQ ffaZmyiJDueljlMpfpB7h3ZqRtvCAt2OeqV2fenEXeL4IJbZ7bSQiBS4YgxMVOQq9PoC 9DSw== X-Gm-Message-State: AOJu0YzYXbc32bhGhFKXK1ioLX/JQyaMRCQHzeifJdrQ1clBeGhEtKud BQsiiBqVtLeLmRmGhix47x2uMBYA/7j5jqcDAclQm5DWSaHjcRUKZ+K72mdocBS/PRPTNCFJSZl TFmeL X-Gm-Gg: ASbGncu3jt2DMFiHQe8QIzOennzuiAiHnNgDBwhWKMo0s9J/xqsusi9U5EOUyvd341A 0eUAS97M10j4hBsEdCPR9NX7x3f8XceMi6ujld85E84Jo/KAxmrQ1hqwsnYekHM4r/z914jqbYE 4kxc/5NXO7VDo5gpV5j/MwzOfHK0kEekFWqofc18c0Os/OU2C5HV827RZcG8QgNxewE+Ugxj3L9 jR8xlFXnCHKy11f+05MQDjjpOUHH8BB9dzhyp5nARl7I7POYwKij0xqrb83lp9fr4Uxgm+0nuaf M6ouFsjB8nzjCiq75VdzVHz0CFo0eBLob0Bxl3iiKRb9+0RGx94YmrWeuJS7vtwpFx6V0g== X-Google-Smtp-Source: AGHT+IGsq9vNnTw5a4n2NHLNcp5aK4hXXymgmO7UqY+jhUUqS1Y8sgcYfGGTGOisG5XE+IRH74ru3w== X-Received: by 2002:a05:6871:a603:b0:2d0:4a2c:7c22 with SMTP id 586e51a60fabf-2efed695c8bmr8773468fac.18.1751297357296; Mon, 30 Jun 2025 08:29:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 20/29] tcg/optimize: Build and use o_bits in fold_sextract Date: Mon, 30 Jun 2025 09:28:46 -0600 Message-ID: <20250630152855.148018-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297516371116600 Content-Type: text/plain; charset="utf-8" This was the last use of fold_affected_mask, now fully replaced by fold_masks_zosa. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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); } =20 -/* - * 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 =3D=3D TCG_TYPE_I32) { - a_mask =3D (uint32_t)a_mask; - } - if (a_mask =3D=3D 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) =20 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 =3D arg_info(op->args[1]); int pos =3D op->args[2]; int len =3D op->args[3]; @@ -2679,16 +2663,14 @@ static bool fold_sextract(OptContext *ctx, TCGOp *o= p) sextract64(ti_const_val(t1), pos, len)); } =20 - s_mask_old =3D t1->s_mask; - s_mask =3D s_mask_old >> pos; + s_mask =3D t1->s_mask >> pos; s_mask |=3D -1ull << (len - 1); - - if (pos =3D=3D 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old))= { - return true; - } + a_mask =3D pos ? -1 : s_mask & ~t1->s_mask; =20 z_mask =3D sextract64(t1->z_mask, pos, len); - return fold_masks_zs(ctx, op, z_mask, s_mask); + o_mask =3D sextract64(t1->o_mask, pos, len); + + return fold_masks_zosa(ctx, op, z_mask, o_mask, s_mask, a_mask); } =20 static bool fold_shift(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751298067; cv=none; d=zohomail.com; s=zohoarc; b=d7USyylI4R5+V+bqheUNMy8Eng6fODfThAaRn0bLQbQtSkNXCXbF+wB6kp1QB8lNp0YM4hbyCQtCfHC9Fy9bEwSsjrzbKV+9odFXXqbhY9kQBwujnkDBmUWOh1iufZN8Mr0B/oIKaoTiXUD2gTXcn9F0gvlhOlbQxdJi5YUpnRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751298067; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RJ4j0E2WOSxfkWC/WL73iZDxZHFJ0TcMddjHVTP/mxs=; b=kZdRlzTtDr7q6yZ4A4QIxAXyijUI96Vx/R0Uc1G2nPMlcnCikg1fGRTm4X6f3dcF740VGeIVT4vG1VyqxbWqQkfwC/HV9YnrUXqB6JrEaGitTgADT+ItGeBhnSJpqZLreOhWVL1Dn+QXefm6LGH8YgA5Bg2tSFUfgedaJLQIfn4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129806783357.00717626323967; Mon, 30 Jun 2025 08:41:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGS8-0000cQ-07; Mon, 30 Jun 2025 11:29:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0000SB-8L for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:26 -0400 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRb-0008FX-D0 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:23 -0400 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-735ac221670so2257439a34.0 for ; Mon, 30 Jun 2025 08:29:18 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297358; x=1751902158; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RJ4j0E2WOSxfkWC/WL73iZDxZHFJ0TcMddjHVTP/mxs=; b=LrBkcB0rE7y5CIwnIMIlCozpmN2xu75eVe9LP3sFgsce9k6HZepRp+jG4vJxW1kL0W Q5gRVM2cbi5USoB6ckCMvv8dOeE/DpueGEQWutyQ21Xb7sDC6fscAWftAumwCKUwFkC3 zdBCDJa8cXsRRPM+R4d/VWn4kS5E3kB5un+0O6dibrlSVFAe/rCSFE8kceAsIJBsJEaP gT5LXrQtR0kHFeZNPuaNdXyrAbAKpIdnEu3yoYoD9SyIfigXrn1mF3Js7Zi3UQgMJTd/ OgtGpLmSJS1QtXz65VzItvqaqPUMp3GcQg4UjT005FgdJErFkmzr/WsGYWkZbqJeyj0H /sAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297358; x=1751902158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RJ4j0E2WOSxfkWC/WL73iZDxZHFJ0TcMddjHVTP/mxs=; b=qRva5bFvrLEoEmKnb3v/MzOejXGap88WDBDf+MaKJPUng8IEoITqwGHAkZdNBEdUpG BdFhUvqpK9Cc3/ts+Bw7JcjNMAESelrCjbsx+U7SLGHEN7pW+ZOYuiYzJnV+o07DDtYe DxiMJupIn/cp1ysQ6Avl14aZaTYv2ppvYf1vKfWcUZ9uUEkrQpBMK2YPekewQfVU/WaB hKYJsMStKu5nBV0wYe/wVdUytrSfedHQlXn82njXcqcI4OH+I6zhgguQTbXaryC7m/9C hcaIoW93CsSTPlSZSw3sKW7qj6Os254k3kcVXLpqyzy/aQnPJOF34lr7sL3pbdygKu1y PCSA== X-Gm-Message-State: AOJu0YwbKI1/JmXHynetrfdzooeBh1x0CSI/tPd9m7aFD43lFcoZwREv hjRccnZyCuF+gFMDsB5wZGqal5P9odQMmHJDCChW0Ej2mzGV3SWyLCVQlWxblOw6dqEZ4vYN3/d b4u8z X-Gm-Gg: ASbGncvtImy5FY0vjeHcqFpLlzJOF8T5yJkp+Y9r0+u15B2vZMdmFcRtrb+zIq6Fd8S 0/kpU8xmRxjisjBKe9+j5Exbuq6fGHcBbz0q4bLrQ5DR7mtYR6MvPhVrOww6DglElyROcGMeI8P HVVUPQIEayMNFZQYZait8McaKasZLFXIhs3r29V/1dFCJUTVCD+hzd5CF3mG1REoChMTKOkCSUT CWo4jAv0fWzQB9DaHOcsyarV+DbGQW4WBjWvQ4MOPmT+mPIuKDbM/AQ9hNzYglGyZxfFWaGLHDY rRy5JzYvbK2z1DiiPNjJorYmzZojz2RQGYpjjpJ8OBJ3RWJ5mPdFI7hxqNT/YrRGTGQJYg== X-Google-Smtp-Source: AGHT+IGeLbPp6XtfgEQGUVo8tDqXpX3YYpUwszm6hsiVRMmG//y79PRntXUr2KqvNsspIgHkv5YqYw== X-Received: by 2002:a05:6830:648e:b0:735:a6b9:3b48 with SMTP id 46e09a7af769-73ae9e7be78mr13214088a34.10.1751297357995; Mon, 30 Jun 2025 08:29:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 21/29] tcg/optimize: Build and use o_bits in fold_shift Date: Mon, 30 Jun 2025 09:28:47 -0600 Message-ID: <20250630152855.148018-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751298068388116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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) =20 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; =20 if (fold_const2(ctx, op) || @@ -2688,14 +2688,16 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) t2 =3D arg_info(op->args[2]); s_mask =3D t1->s_mask; z_mask =3D t1->z_mask; + o_mask =3D t1->o_mask; =20 if (ti_is_const(t2)) { int sh =3D ti_const_val(t2); =20 z_mask =3D do_constant_folding(op->opc, ctx->type, z_mask, sh); + o_mask =3D do_constant_folding(op->opc, ctx->type, o_mask, sh); s_mask =3D do_constant_folding(op->opc, ctx->type, s_mask, sh); =20 - return fold_masks_zs(ctx, op, z_mask, s_mask); + return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask); } =20 switch (op->opc) { --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297923; cv=none; d=zohomail.com; s=zohoarc; b=fmbWGByS6XCUwgo5SuiR9o8y559vlZh/oT20Smf6cP0F7Y/Pk/zXVlMnMziOweMA6KggKYQZ137InK5RJtiKWZqFvGicEMBd9jC+yyIoHmfRvKXzq6OnIujD3fpI9nLx7f6rSGpwcFpWGwXbevK5fGXOMsh2rmtZdo2qjHaU7hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297923; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YeB08dM1GirUDHHkoGDhYbViaKd2Vk7y8u9Bgs4GdjA=; b=m3cCtIaEfOtY+mDXxS7Y2rqgwvh/l9AePxdgFZha2fa5Bgho43mViNOLNISrKf2+/TyDAIm77tgumO3YCw0anAcpXRLVPwcVxdzRj9y3wUxA9f/s0aS+btTDQUYN3DhhPf+IDQj/+UL30sAqRYRdl1nLXjQyYKXqrhUh/0GBjYk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297923163792.6548754647689; Mon, 30 Jun 2025 08:38:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSD-0000ds-Pp; Mon, 30 Jun 2025 11:29:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRl-0000T0-R2 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:34 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRg-0008Fj-Bd for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:27 -0400 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-735a6d7c5b1so2381511a34.2 for ; Mon, 30 Jun 2025 08:29:19 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297359; x=1751902159; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YeB08dM1GirUDHHkoGDhYbViaKd2Vk7y8u9Bgs4GdjA=; b=TzBOuD39BOLwZA7tTD1rLE6UcDIVbUIyeV4CUPJfBjKdr9mHPF/43iLMEbiLseu7KY y7murzcZ/cuYnF5qOvz4w+Jks1Fhe/UUpDWeoX+hVe2mXJpKy4NhQU6jddoc8DsfuZwf 9TTVodHf0T3PmegpLZQeIpH836Iz59YYlPgXlCgzPtgUDwCmpnLiLMxXLlq4aBneEtGP Nm8ThHTga+bYWsndPPBdLNIUfLUu5WrOHCqVpGUD8qCEiioW/9OArinW3yRhsZ9LValj WJ4k5OXBVZfaSeJMS6zXQVoNvEfk2/+P0mzNigCDWcCT7DinIfq2YUN1LVRBCHdDXWJ7 D7uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297359; x=1751902159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YeB08dM1GirUDHHkoGDhYbViaKd2Vk7y8u9Bgs4GdjA=; b=RxQFFqRpZtycRBsBmiQumQ++6en59RNZfBKld0bAkZHwg8PY+Tg5QyQQyDvZ4GEEj2 FeLixCnTwYR8rPuKdd1b/Jfpj4BddxCWxsIbxkOi63n5c35Xa2h+yjJ01TzPFhxjm0bf YG91RummjNkQ09YCiVO4tQ7ogFd4wAwyxfrfO/YWVnjfPjkYWjNs/L3IbvCVzk/OpEkG jrbJIBxirnOiJioxXhosrc3MlmhjIKbw9AUSCuQ5xefvspAIGgatvI057HMdXD71JQwK sunOuLN+3RurZlu8EzyjgAujOVNCazCagoBrcP/r+p2mJJRRteZyvljqCDI2y/rxu+fV D7XA== X-Gm-Message-State: AOJu0YwM1tLH+/lxHi6JKUwsq3y6e9z+4P7yEcEYTjJTfuqxQV1d3U73 3wqjcwmitJAfpBCPFv4TOKJj4c7xDl5yeiVx9Bz98AjVTbTTAF6nGEXrha6V2Cc2vZ+exvonGwS BAXrb X-Gm-Gg: ASbGncvEnIbRXDs56yyDsBBDl2CrUS6rAZue2nKNRy43gRP5zGNzXyC43EeM9WNqnzz +7Qa/lFkMYLpo3+EqSiF+hzWK1wq/ieHBfO3UChcYWoNQqTmJ70G23PbL8mzniSvNIO3HegOqAb 9K41IXiZIcCyTw6tgr3y0XNjVWp6qjmsGuqa6JhcUyzuDIhiwxJdNdQdpWuKZrjJhTWB+zaJqb2 DBIaPsc8/nXQqUmJz0Q302tWwB83x/qMpssrv0xLnNMT51WdT7W7oYxqqZBDWV4BMoz1Y8wLFwX 9Ha5zyT3HDDv7uQpKce4Q55Zt+2RHNLY6qPfAqw5/wxMmZMgVWUnVc7MIxtJEO7Aq08Ymw== X-Google-Smtp-Source: AGHT+IHnXoFN3+CuigfVCsPEzfixqqjt/O4I/avp1HokV2LFCaxzhP6Ne+91opvNtQp8QkJGE8/oiw== X-Received: by 2002:a05:6830:6102:b0:73a:96e5:19b9 with SMTP id 46e09a7af769-73afc43ba7dmr9346645a34.2.1751297358747; Mon, 30 Jun 2025 08:29:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 22/29] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Date: Mon, 30 Jun 2025 09:28:48 -0600 Message-ID: <20250630152855.148018-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297924355116600 Content-Type: text/plain; charset="utf-8" When lowering tst comparisons, completely fold the and opcode that we generate. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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 de= st, TCGArg *p1, TCGArg *p2, TCGArg *pcond) { @@ -834,6 +835,7 @@ static int do_constant_folding_cond1(OptContext *ctx, T= CGOp *op, TCGArg dest, op2->args[0] =3D tmp; op2->args[1] =3D *p1; op2->args[2] =3D *p2; + fold_and(ctx, op2); =20 *p1 =3D tmp; *p2 =3D arg_new_constant(ctx, 0); @@ -929,9 +931,12 @@ static int do_constant_folding_cond2(OptContext *ctx, = TCGOp *op, TCGArg *args) op1->args[0] =3D t1; op1->args[1] =3D al; op1->args[2] =3D bl; + fold_and(ctx, op1); + op2->args[0] =3D t2; op2->args[1] =3D ah; op2->args[2] =3D bh; + fold_and(ctx, op1); =20 args[0] =3D t1; args[1] =3D t2; --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297594; cv=none; d=zohomail.com; s=zohoarc; b=V1I76SvYYnPg4EcwBxTDGZ5z2khSyu8+7OwZbSNjtCLfuGi+vdIIprLNiLHvydKO7o0nN5YwbKjNGw5QDbdSyR2flpwgjmJ/HpuksTRW2FI4kuKHb4jAeK+MGngrlxZC4wWP0FjWQ4fqnenql5jqMiHI2qrAa8F9IS4B3KrCSYQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297594; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R4bDMTeja2drb8U76A8rTMhXOU4TxSudcFPnnrBZGgM=; b=KibzyvXeRnDJEPSs46Wv1N6RKoC93AhgMRmnQEoWzF1xCVfKwXAHuhz0LLhft7toJ2bPOkQrxxLC1K/buPPApdGpWPBH3Ocshbn79p+fPTxc4ksTHo17Smf2OnKCegYTPbZGjcpDpRV3+oUKSJuKeSxpEaZ4Xn09MOM6LC7zTto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297594121263.5164133189513; Mon, 30 Jun 2025 08:33:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSA-0000ci-CR; Mon, 30 Jun 2025 11:29:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRn-0000TI-O6 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:38 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0008Fy-06 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:30 -0400 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-735ae68cc78so2784107a34.1 for ; Mon, 30 Jun 2025 08:29:21 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297359; x=1751902159; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R4bDMTeja2drb8U76A8rTMhXOU4TxSudcFPnnrBZGgM=; b=kbvRePd29fKB+6dXU7TLG2CTChssK1uimUi5J47qeAhS+0nrsQO16ja77QsYVlGX9B MV+X5SAtC7QU16UozDa72HJEpaye+ZPZnzut/42PX7dmbCt3gfPu/TS2yXz/BHTOFrnw FDa3hgG1rA9s5mIf43ye2nQ40SFTweewr+m7Rx+sgvlUH3LkXsYTtLFzMJcDahBkww3S I+wXQFn4xgbvOzI3vKqNOkLzi2bOX2z5EMfCQlTKLGZZaSd87rOdjnpX6hdCHMDIhhnl UUBgcR7mjb+y2zeNou+5IL6Bsm1FVO1B2XtIEbSVr4q6pyGuv1H9KHZnB86x2CyIpRvV rKEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297359; x=1751902159; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R4bDMTeja2drb8U76A8rTMhXOU4TxSudcFPnnrBZGgM=; b=wq1wxYx+t3VwtL4TCM52Cdd2cKN//mmIakkLNDoa3jXibsiexyMnxnpYXR+TgA6Bvn fk7hT5502EezOWJb54rSqeMjt866jVynz0So5UGC+TusfH+CqkWO10hrVmCA49JRh4gP GtbO8qo1LgjnwLYaN9EUNFdiEHh0IBf/MyNO4AM8divD0RuYn7oNbTfkvpx8iQIKe4nT xV54afUU2OmZOUdU2vNsvQRsGtpxzL4/yN4SOeX08WKxJ4nROzsbAeVTO1QPzRoWkb8/ klRX1+v4k0/eZt7WQLKiYlhywB/b9kSOA8dNAaIvM41EAAMgR5t6Wdzh/N3BLaQPcfpB tAUQ== X-Gm-Message-State: AOJu0YwmszznUmAWa0l1yD6MKz3ecNL2Y8u+Sza+PVE+oqzr1UORspej r04qw84Pd5s54ZNcEeSkfhnzRw9fJQXQ1rxMESOqd2TsDAnqIX0EqBC83hL/et3OZJV8JBeRL3y bUX3I X-Gm-Gg: ASbGncvxwCqVL4s+GHVvWfeUnH6Gc8piIMMGYI4Do2mRuyAtE2kfdrRoW+JfPXH+XDr mgTebS2NbFZZTJwsrQ8+oWPiATPAT/YI0mRnU0SIn7mg8hLiFDaIypNmD9tPRzfqnf1m5U3vdQ1 GNTfFgsThMjnc7fh/GnuXY16Rpqsi2M6x38jOah/kjqUIhP+F4YqH5NXeNyRg9GAqk7/3z6Kjfu t2Pn+O9BRHJn9ZBW3eJreQhYggxT6PrISdKIc4oT8gfYytTLpyvpGGBOz0QhwZSMyVP/ybVIekT pqj7smiasgw8sdSTPzVesEicAbVpzjUQF8Z8swPTHwyvajNusZQafdyqfvDCKHhj9zM+Pw== X-Google-Smtp-Source: AGHT+IHTrL/ytEuoHfo1QLP2hJuBhPS0BZ/mBMXukqmfEEd2H2PnRgNeFjbVYdgt/kUTGqh2yUgsSw== X-Received: by 2002:a05:6830:720b:b0:72b:92aa:b69f with SMTP id 46e09a7af769-73b1b7f88e8mr3501534a34.16.1751297359449; Mon, 30 Jun 2025 08:29:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 23/29] tcg/optimize: Fold and to extract during optimize Date: Mon, 30 Jun 2025 09:28:49 -0600 Message-ID: <20250630152855.148018-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297595597116600 Content-Type: text/plain; charset="utf-8" Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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_ma= sk) +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 =3D &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 =3D MAX(rep - 1, 0); ti->s_mask =3D INT64_MIN >> rep; =20 + 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_ma= sk) +{ + fold_masks_zosa_int(ctx, op, z_mask, o_mask, s_mask, -1); return true; } =20 @@ -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 =3D t1->z_mask & ~t2->o_mask; =20 - 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 c= an + * trivially expand the extract to AND during code generation. + */ + uint64_t val =3D ti_const_val(t2); + if (!(val & (val + 1))) { + unsigned len =3D ctz64(~val); + if (TCG_TARGET_extract_valid(ctx->type, 0, len)) { + op->opc =3D INDEX_op_extract; + op->args[2] =3D 0; + op->args[3] =3D len; + } + } + } + } + return true; } =20 static bool fold_andc(OptContext *ctx, TCGOp *op) --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297590; cv=none; d=zohomail.com; s=zohoarc; b=NFVzXc4LVv7glMK8xUCxGUneIHm011DonMBxtNyqvWds5u3YOBooNkbVohhdTr+1dxOXGNWDMnRHSesKWkjAevStxIJUqokU9ABACsvm3XQlLwYo2/G8i7dOUTBhHBM0RYYCaSljBObZqLC9bu0LvxO3JJKbjpIFQTnu6eozf1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297590; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=N/2K77/QkthXYXM/f6m6RE27lMTOUzmm5oW44mp5NRw=; b=CUvAv2vidM8cbxf0dM1BoQTsA8VS3jH2T2I6HCucGfgWzBlJNYA7hBtWLL4NKJlf12J6yG8+kZLA4fTN8/S7NqcFSk+YShHO5SYA3FjxkMxkjEN0nlSkjeQ/Jl8ifxdbJUujUzDaoFqJzJiTdM0bDTA8zTLufhfewbJgX6mDSIg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297590722223.5943004159334; Mon, 30 Jun 2025 08:33:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSB-0000cj-2P; Mon, 30 Jun 2025 11:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRs-0000Tm-8f for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:42 -0400 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0008G5-1j for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:35 -0400 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-72c09f8369cso1287008a34.3 for ; Mon, 30 Jun 2025 08:29:21 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297360; x=1751902160; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N/2K77/QkthXYXM/f6m6RE27lMTOUzmm5oW44mp5NRw=; b=D+PXA9vUChuH6hvl/pRmbJncs3fvtOo0S9DMUZnWJ4Ss46apxAr//oFoAT17ZvlchG I28XGTtWvnJ/0hv69ITwuNtZHlvJWdYOKPzMDWiwOMQINOGKL7cZOYp7X2bcLEgQ8cmC lNezP5/l1W+5h2DjjcrDoDWWLHsQVt9QurwFLpsCDgTbfMoKmTBJfsVBg+L0O7nleMJf WMg929WwuheEaL0n74mvvfQVuFmk49cub31K7N0Ob4fcT3dDnssex0wzQ4IBo9lrzWhS JtJd0ZG+C5roN+WUnm0QoY0KyxCSiCPMnmdpc9++eWlFqCiAFTCwbw9c+nDeb0lUG4ZM g4Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297360; x=1751902160; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N/2K77/QkthXYXM/f6m6RE27lMTOUzmm5oW44mp5NRw=; b=CkxiSjYNZXCSKEcy6B512KizNZ0biHRo1yV9xeB5Tr8etCYrVJJm+CIvfigCq0BYLD rGGyrTrsbDpUcvKnwH9IcchwDm2fZeI2c2sxV1fS0hYOn8GR+6CNBEARmSSotLStBAfd 6GdYtgujWh1UC1rXMX5NfRNKIgzqMwlejMNLd/08fgIxNN51xHqmOJsDWjxNYfUNazKS cGJpQK/rFBjcXl+rTMVxKBzZD8p79S4vbRb6FZjcmHGNZQc5Wyq5Po4+nCJLrNX0Grjf yQt+XchNVYWoPD+QIypYzW8XimhvwEU5MliwgWBJ8HlbNWLgHnv3iuwzFupYCg069TVq LkSQ== X-Gm-Message-State: AOJu0YwKfLrxMdGVzkyMRgFlwrn+fOkfDw5Hb9NL6ZlI30YOteGkAz71 TUoB7B1N6TK15shAWbm36VqbjAlXN3ZzHrC4BXG3S2vzgwPlEteoWz1i5sqwM/3z9QOPXmhpa6H AKsoX X-Gm-Gg: ASbGncsHOfEM1vskD4N5lvu49rcZI9anlXzjqyj8Jp7eoOgOTTDQB0yJFL0poRyeR23 DO610T0det2xfpEuVYRGpCZLRyvgMlYslQkAjrLy40iLftm1gdJdSnWILpFuHyh94z9tB1KiTuf 6nyJdyScO3X3UbWug6jEZDskk4YHemrabVppvnLVrc95W9PeAuGklrafKwc4h2dewAfacCOcXxx WpK26hy6MFk+fPaQpKklb7b213cb0CZMF9vHQTUfCMPjAz8xPYheFhofWDjga+ZQeTPE9vvNli0 SiQTW5JIk8A8vVKthjj2j1P7+K2X0KnKfxDMcsG9iN7uu3El85j+YRKI996murbKPEbf3Q== X-Google-Smtp-Source: AGHT+IGOvBDxLH2eSlvhS+b5r4efj5B8SJRXBdcn0ZgMS9s3GejJUz7hir5lhwLltVNy4zKa42sYmw== X-Received: by 2002:a05:6830:3695:b0:727:3111:1416 with SMTP id 46e09a7af769-73afc64cf53mr10515391a34.24.1751297360173; Mon, 30 Jun 2025 08:29:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 24/29] tcg/optimize: Simplify fold_and constant checks Date: Mon, 30 Jun 2025 09:28:50 -0600 Message-ID: <20250630152855.148018-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297591215116600 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 - 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; } =20 @@ -1473,6 +1470,8 @@ static bool fold_and(OptContext *ctx, TCGOp *op) op->args[3] =3D len; } } + } else { + fold_xx_to_x(ctx, op); } } return true; --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297523; cv=none; d=zohomail.com; s=zohoarc; b=T1lO0QKOT9gySkTJx7Rme436PQTEvycxC/7H5amZYuiRiBPAukrDN4PxbKDjCTDXt+e05kz3yXymmW4nV8Asht+4UFCKrlXpjPa84f3GhCNDordrjoTeICxUC9rM8EjRjJR85NFakfnQYc26A+K24+y7Prtez873suZCYKGqwzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297523; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=788tqHhyAITG5SoOmv8flnFx3nYNFAFlF/1rpotTNJY=; b=AGArLtA8brG+WK1JdIDshCMdUSGb31hRzV3GcnqT1VMSV1UIqa5e1k94kL9/aCmorJQwLKxAyPtsPpawEXTKVuEj9eeXrANWzyxJ3ytQRgyBuTrctYrRGgINm/3hqWM4B8Nz1KW219VoMTAsJ1T+qcJX6hPqOfsP/67ODscdORk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297523459449.4594111165155; Mon, 30 Jun 2025 08:32:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSG-0000l8-0r; Mon, 30 Jun 2025 11:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRs-0000Tn-8f for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:42 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRi-0008GA-RH for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:35 -0400 Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-73a5c41a71aso2461650a34.0 for ; Mon, 30 Jun 2025 08:29:21 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297361; x=1751902161; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=788tqHhyAITG5SoOmv8flnFx3nYNFAFlF/1rpotTNJY=; b=P9RhtjTSKKubJunw+2YCpytnj8m4MkaOe8qZj4Klm8TEOA1lhwdkQIbuLb9q9quLV+ oVq1sCrtrHzGXKbodT0+zEKamK6VQXP5MVTnNndk+nqfct+Pjt7IwE/ia2pWPxRwX/1Y XvWXLmJXiGZtOKp/txj8l18JgeYjoMoieQBZlveFGmE/YiOm67zm6oeUU62OTxW+TmgN VYbDDNuXD4T8y5/fc8t0o5y2taKW5jpKBb6x8ANL6Kvx+OxSHWleycrAGrpggts2/V8/ U0vAklXHT80UM+uG3THL+L2hUSOKriYjslUNxf0h87t59QwEkDNPx7GAvscAU77G74u3 x1zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297361; x=1751902161; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=788tqHhyAITG5SoOmv8flnFx3nYNFAFlF/1rpotTNJY=; b=uaTDwHrri/hNhcwntm8hNdqT0f18ks8XR3rrGROBqRFEaL09zsaq+1zNGlUA+EDHRG sHTQCUfNBgBhibmyxo2zv1vTR9nO7C2XfhTpB06681/X7waNWltcYYI8ysqua2dTClL0 TweYOKAYsG1IJIrxqs0YGqypyDivxYBNZ3oe7lvrdFK+9KhlvVpL1XK4QpZcvBwEfdCt 8ImFk7dhd2zyW003bih+E8fMoZW/u80GTzB8cz/L/B9Ev3mU1hQ1jNVA/NGVYKYPPi+R OPoPoTZIwmR4d65poczB5CxTnKKbjvnROwB4jRYYVO0Jp1s2L/ma2DfFS+L5hyX3k0+1 w9Cg== X-Gm-Message-State: AOJu0Yy9x/ANqGfe1j+uHQiNNVQgLd47MDhwnYcbiucTHmP4x1NTMaXp yQmwKrAgK7DCvDhMcBRCHrJunUXHKZieYErT8OeM2wyB/pnByn1C5Se5lUinS+9erNyVJsrDpqm +1oPg X-Gm-Gg: ASbGncseebdTjDap0rIeYZ1IO6tKU+wniy+vkmbFhLf7TI0MgNUTRpc3IHVTa2AhKWa QENASTazsl1n+OjHIGTaTT8dw6ctDOzcaTF8jZt+g+GnXr9UEKB7+ZynA68Xdy7JijDPwDWKQqY ffv1oX4N2GCh3M3dw2YWODFFdWRfVAsZXNn/um/GFdHgXjeEKMpjF6UuXzEuqN4PUKDk0EFOeiJ qiN5JS3LMEJLuHCi6ERueIqArrFyOGRnBnEQGIaiAkRH6X53rehHN5vpSdtKlbdipD38L/Fgrs7 P7rlpwVWeJUxMuErvn0FCQEA6otxcxwbsxZeaQ6+K4gRAZbwxpxdaxd+Et5oSzgqfE6Vug== X-Google-Smtp-Source: AGHT+IHk+XU5Pe5e8bKcIyB6Uawsunh3RsQvYxRKTWMQ4hkVGjsf38ZB4Q7nArqHyxb/QHtKRZzwXQ== X-Received: by 2002:a05:6830:6f89:b0:72b:9506:8db1 with SMTP id 46e09a7af769-73afc53caf3mr8975605a34.4.1751297360953; Mon, 30 Jun 2025 08:29:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 25/29] tcg/optimize: Simplify fold_andc constant checks Date: Mon, 30 Jun 2025 09:28:51 -0600 Message-ID: <20250630152855.148018-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297524447116600 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 - 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; } =20 @@ -1510,6 +1507,10 @@ static bool fold_andc(OptContext *ctx, TCGOp *op) op->args[2] =3D 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; + } =20 z_mask =3D t1->z_mask & ~t2->o_mask; o_mask =3D t1->o_mask & ~t2->z_mask; --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297432; cv=none; d=zohomail.com; s=zohoarc; b=Smqi4yMzLAwbHlN80XEVjCmt+FDyqnojAYyK+54fGnD+AVN8dOEhEoNHSSXDWGFESn/AtJJgQbZp/vBSLj0717GKkfV6YOlMhZcFuzmsJJY8Sx3Fca0MdKN6hCMrZj9l6/vkQp7ZLirtidKavq2S57JqjbQ7KXGzn57xoyHshZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297432; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l6TK1JZn6ykgJiG7bAj/R0ENVbAOSCznU44jivvGbwA=; b=F0ZpL89lGSdWOxCAjWFgHcYsOjOsZ4Cmb0Cq7jWn2Wu5+9KLB/kSA6n9k/bUjnawwyUG2pBWzRBzHflWixEr/uMFPl7rrEnlyHARVRbq3reHcFbaSesX3ZiFFsvrEx1hR72Z/5q0yJ0eKOjWk2ZLkrcPuagmVFX0/ik5x6OU+Kg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297432450567.4353989744517; Mon, 30 Jun 2025 08:30:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSB-0000dy-UC; Mon, 30 Jun 2025 11:29:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRq-0000Th-BF for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:41 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRi-0008GK-H2 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:33 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-2efb0b03e40so748281fac.0 for ; Mon, 30 Jun 2025 08:29:23 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297362; x=1751902162; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l6TK1JZn6ykgJiG7bAj/R0ENVbAOSCznU44jivvGbwA=; b=xJjPmpnC2g1znZrukDeH/7geFkVxI67v7QNcB2JCLQa63+opCvjyLQdoqSoiYhJIiL 2O96kcFVSunMKxPdniG7bRYo5gG5tM4sAg8rLmHjjPKzrQND8Jn84f/OYoVoa/fsDJYL jTeA5x8+M2WDI0gyIWcGZgbCUu8dIunwinUpa65psyF46nEhFji8dMR2hyP0tz0zaASo 3dsD6R01n7pag8YHId364KwTdbZBalvUvsyQE+NwsPFbEQeXL59SPaeKGWPNpP5TGROj BjQNccuTRKYVKmtONUO7befmIL3OTxVxVkj1ZrMc2Uod3SUR+48PTeMaNV9/1zr1+WrS I4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297362; x=1751902162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l6TK1JZn6ykgJiG7bAj/R0ENVbAOSCznU44jivvGbwA=; b=Kdq7tqkJE3i3WZ6Hrqby9uifjBhBUijW7xksbzxLEo3Um1PHaKxpcGDASB6RWY+lhU 4v0tyA2IsR1wq6jZmVA1bnAFrR/OGMkKU5lmItpLLPd9Lq/SIqTGjJvUalby8RFE4QH8 Mvs6XmSDeFFSQ1lgp1o2Te1XuUGNGGJUkybY1HvkogXw/jVXnkUPdn398R10cjRRLUvZ dMp12a32tsFw85vZPl5B/JIaFIws9KMqC9qQfMrgSi1q8Risx9jx090SsDtSQQCAoOEZ qxONqdayb/7VZbnCaOdGkeynqCpILT6picwo6js2A5fqf/ymGimpR655vm2UWXmnP2fJ 1x1A== X-Gm-Message-State: AOJu0YzeJ7/pFfs4QhtAHFwpoUD9tMuA1Ex7NvzbX1bsuMnU9kSeCCZc tdvEqQafTg4w0AleM8mntMjU58azbDwjtaQVk/NER+h6GUHZ8oX9QXJqtftqbgeTZmWyyH3zIfW vBz++ X-Gm-Gg: ASbGncs7mpkIe11dvmZ6tmOsH8walCJS1UGJyNcpP3jo2Hh51gwxKFYuwJh0MZQbplR 0fRSei2294kNK5vM29yTfSseoq2rrLPqwhRv+EXAbNJkBYGiKZXJstw7OX6/Qcuoevmin3R8aVr p2UvN7u5DCB/3m5MDC7OBlUUpwFSFIeUT14r7l5c7NWgNp6Hl1SLULGK6nv4ryApdHqqrA0QCLM dQlIDqYJVlnEcji7cS/XppkNOMHUKg1/hDBTo1p+3LE4n7oRyOSOtkBkBUBg2imtraa4Fj+fKOv Lcy62wtE3z1FfjtTPQLEetewrRscdq4c7DAwrawxPOirBdf480W6KjlqZ6OJr8TigD1HmEy1wnk m8Z4r X-Google-Smtp-Source: AGHT+IEMnuATe4V0N7Z2H3W46yS6hHl5iUJJG6QyMdYHp9951mo1xqsVhQflPYoKy2F4LTXRoIQRAA== X-Received: by 2002:a05:6871:d08b:b0:2d4:d07c:7cc5 with SMTP id 586e51a60fabf-2efed497b0emr9044185fac.12.1751297361814; Mon, 30 Jun 2025 08:29:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 26/29] tcg/optimize: Simplify fold_orc constant checks Date: Mon, 30 Jun 2025 09:28:52 -0600 Message-ID: <20250630152855.148018-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x35.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297433267116600 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 - 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; } =20 @@ -2352,7 +2349,10 @@ static bool fold_orc(OptContext *ctx, TCGOp *op) op->args[2] =3D 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 =3D arg_info(op->args[1]); =20 z_mask =3D t1->z_mask | ~t2->o_mask; --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297738; cv=none; d=zohomail.com; s=zohoarc; b=WicDobjOZIiaJalGxJnCuaOJHstnuHOtjlZg+AR+sxvLEoZ5SSMlhNIex0wr2FIvMVjjT9fhsnn2yAiqX73Gk7bnhJ4+74ZnhhP+/5tio1JZj++W3yCj7n3/dQ+vVjcJMhduUbnZvu29rbSuzRRYkAudEfE2QAFslPwtP/f1HRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297738; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PkpB8g1xUtpDEpvXKq6mCBd8Xvirz1+gexv6+2S738c=; b=Q/AMsC0DvU+F9L/N4cM7pBBlKITWuV2uJJPfVkgEgy22Ffy0tf9viZBs/zJ7b2EbOB0nSFBm8t+hhGerou9ffkCJm8FAu14YayDNvWNhTRvR6slRNdCrQxICsMrMYf5Xf4JUxOqOLPVJmucHpnI+eN1n2Ge9t4HIB7Gt6fCeMdc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751297738937408.6825554345696; Mon, 30 Jun 2025 08:35:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSE-0000ix-VZ; Mon, 30 Jun 2025 11:29:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRy-0000WM-19 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:47 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRj-0008GM-0E for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:40 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-73a9c5ccfcdso1264956a34.0 for ; Mon, 30 Jun 2025 08:29:24 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297362; x=1751902162; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PkpB8g1xUtpDEpvXKq6mCBd8Xvirz1+gexv6+2S738c=; b=IaqIqH6SGOGkU7OMbk+alG0ydLghS/mdIv00smyG4sbZCTADf5nHfHHBXPxnnb6OXU CP8/bEiWWor50ZTye/TLxqf4r67TKMWUO0syWuSkGuquGqMj7uQYYvWaa0b7uR4+kbVX XCOQ8Wdbc1e++sQ0t03q/64hkX7ImYSkg8GHhJyuVBmNJDl5F7JmaQsa6aO2QCf4mL6H 8rYsByua68KHHb4/lQzGbpJKxQxBRgSjDWIBTnfaR51FkQPglpeFZ9pJYjoDcmLfXs3d ZT/21RaCZ4/ew6P9TosltH1IHxHS6T02TKqLVCoZAeCSR5HWJzXtgkmqJn8fA/UfR4GW WTVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297362; x=1751902162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PkpB8g1xUtpDEpvXKq6mCBd8Xvirz1+gexv6+2S738c=; b=wokJdjpJq/bvchi+ffUn87PD4dfkcssdA/Wu6IZQ/+XeQ/gEjFHKIov09C+ea4Nc0e G/1RBcBBKprb0WAE4NBaaFujBAbYdqvEVD2LSd3QmpBUuyohndVeFUwU01DPCGFrzTgs 9AL0m9aRfFte93Ya5g95x83mknfaxkks+6UwdGQxQf2avqE+1n0iUk47+gzNdnf3dvai QkmmpSuGvYBDjA3CA33KTxp+gBd/dcm1UcXLUuk9UFc0iyM3pKlShoeREN1TRfnZMvv/ dgz3oG6XqGCQchJEmTwFIKQD8+q4wYK2btGuG9wH6J1Rs6SQLyv6iy7nKFeKBYfVjx6d ibAw== X-Gm-Message-State: AOJu0YzxVguEn3FTpks8VHyaA6jxrRXXgHnnjo3WxrqGPaOVE1vjp/Ee R9zAut1yAXTPU6DBtj2tebQMQ6XTnCrdggOqQ/aA9OP4rjNuKbO1mfnmKWnUOucCzrvvlXtj+sT vaETu X-Gm-Gg: ASbGncuf1DGGdrEqNlY8PCz2qdPJ+8CmZToEMULK+aKt+eDnaIVij30DIwGkAWOCOLN LRRT9T8MlVywOi6GTg5pO7e1k9p3Xu0dn4JYEe2CbBC463e36OM3ioHYhNMs1EEMVHNs6LyJK5b pokjnXXA9Ukm3Kx/SPzAD64EZYEyKx1eoP/F3zb4uK1Jeq/L6bhfJtnrEKGcBmwKZ8kDpnnWI+z odiQMqgs4jrrhbFmEQCbp+3PBcSxJk/QZe4q/7fD8S9/7JRBhEU68uLONpK4nFKO3m8u+dXwM/7 mS+0mt86se083x6V3fdGmoUn0SwUa5ylrecR1Gl2CgZtyUPOd3/CV6MbMtk8bXXw/qwVg+K9vUo +zQwI X-Google-Smtp-Source: AGHT+IFf992+JX6FvGus7lfydaB/KyCMPOPWsubM4mxQkl45aD0eKw89F7LCkYOmqPTmpknwrO6C4g== X-Received: by 2002:a05:6830:8009:b0:735:b9db:5939 with SMTP id 46e09a7af769-73afc3e703emr7373626a34.10.1751297362612; Mon, 30 Jun 2025 08:29:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 27/29] tcg/optimize: Simplify fold_eqv constant checks Date: Mon, 30 Jun 2025 09:28:53 -0600 Message-ID: <20250630152855.148018-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297741323116600 Content-Type: text/plain; charset="utf-8" Both cases are handled by fold_xor after conversion. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- 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; =20 - 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; } =20 --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751298109; cv=none; d=zohomail.com; s=zohoarc; b=ZPNbulCWTWqgPMOVBrVnNM91i9V1ltXvw6vU6TzZnGGbSBxlUxdrY4SyDPvAXqsoluuhvCMJfPz5lpRMEreOEhhP4Fh1h0QneLiHpG85LtKhuog8u051buDfCItrFUk6McczAaT7oAJQaxWUwoqw8b+OqgNSDJHus8wI9yNkMF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751298109; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=32arHOqUz/2QYMB4koRoPWzjpJFn+P5kUiG3AP584V4=; b=WvLxXvGOJ5O1sbOlhZdH4ryw+lHqd3PXjvigE0lA86rlv5oeMj4ixSjmVArT154vhYLH7v8z9400Rgd35iPWswOKNBabGhQJQHbehCGlSuLrybVXbQEtHNzc+7I4km5KQz/KLkdLXJHWywn4aLz0s0U4CfhuCUyFp7/UfPdRVaI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751298108945695.4838459109257; Mon, 30 Jun 2025 08:41:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGSK-0000lU-Io; Mon, 30 Jun 2025 11:30:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRt-0000UJ-JZ for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:43 -0400 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRi-0008GP-R0 for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:37 -0400 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-736f9e352cbso1292672a34.2 for ; Mon, 30 Jun 2025 08:29:24 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297363; x=1751902163; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=32arHOqUz/2QYMB4koRoPWzjpJFn+P5kUiG3AP584V4=; b=ncf32nqTuBxS8pBNzgIsvvE8vWOlJiEWxNLpRxIJXk4YK/sENCTxtXF4RNrmrSoTJJ wYlwWT0Fsz6CxejJ1Qk70/eHZfjUtds4TMJp4GT1dEOXIFPAtiFnNDldrDDXi+QziGhr 29nURhW+v9qmbWENrUIFvq3roIN3+9mvTlnyIz3/XUISQfzVYNEM0LT6B1OaymJOXjsu P6CuijmhvOXtvz1tAwL6z/BE/OuG+FuqwwdEjef2KgIPM1Gj8cgvOe4Gb8CKvKZ8Rqqy kTbWYWNhWwTOP9FU+Pai6X6Gg65XSviJDIA+2Rgkqrh7E1OSHg6QGgjBeMus2FQ2l2zJ XTSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297363; x=1751902163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=32arHOqUz/2QYMB4koRoPWzjpJFn+P5kUiG3AP584V4=; b=amidcIud4fhQMKbd14OPgnX7m39s9KWyA6habE6ohYFZirL0bckHO3uQeCqAiIzBco eualokSWbvFQ7BnbPR6+z8XwqvLRT8bWapVM/QnkVTZDtJFwIWaPI4yNU0y1pBdUkJ9O +b/BMQGfIG5DN4dmTqZsDGBO4CvtYgDh1EVMZMlHXEJuZ66Dwz6kfk72ZtI/CrOlTQL0 wSNF4TgWU5xvzP+ucNCO9nBS9WWwB9sBuI2NprrkrBmsocEhkbLNerdG6qxuO4JAcNI2 zzCRK2srHB9xs0Q0tVhdO9MxzDe6KLAUuKKKpT+uzeRekTPWySRWqpkjYM/cVVuPkIGm 3Qdg== X-Gm-Message-State: AOJu0Yz/9WhHXenk0ca9y/g/9KQ+4PAVA/WXfXsLVgFa0nrEwuqJD/1/ QCPM6jOPXo2hHwY4BYNySSWF3ERugX10tQTrXDZPZI5qYnZuNHVlsFqP+byUVIGJCPdMxs+LAKO ztvCq X-Gm-Gg: ASbGncusAMqlJzwkG1SEN7T0XFWg7tu1WsUqC/S2H2jZdViIlJefTk79fHO4DkUR7gK +ntsyEKR8C5+uffStcqOJQcv/iM70e0qFxheg/JS2bBxa7XJsk77temgQn91KkhH5aSk4DLrCgk ReAKd/Qbzsouo/rrAogYXXfHqiC79IvUsBnSbJXVyIBQbvNoZtIQunihsbcm5xAADbBFIfu7hms wgU/ITVv7EWJr20xcLFU+hp7C5tAUAgf4VYVDcBjb+iXO1QKUHmMuBiF8o6AHKVHaOCKGJ8FhgI k4jcgIA8fCzIXC21arLeKxV+MNwRF6vnP+CcSqxJ+hEzBiTn6HzyVP6yqPcFyhWZ5+zNvw== X-Google-Smtp-Source: AGHT+IGqhZHyZ2gYk5zajR2um4+PxOjl3wsGDtofa6hnwr3FP65huF1dHuGNEaUFN6pICioXJ4MQDQ== X-Received: by 2002:a05:6830:6c0c:b0:72b:9f17:1da0 with SMTP id 46e09a7af769-73afc3b7b1cmr10808369a34.7.1751297363506; Mon, 30 Jun 2025 08:29:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Andrea Bolognani , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 28/29] tcg/riscv: Fix typo in tgen_extract Date: Mon, 30 Jun 2025 09:28:54 -0600 Message-ID: <20250630152855.148018-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32f; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751298110774116600 Fix the direction of the shift, introduced when converting the codebase to TCGOutOp* and small tgen_* helpers. Fixes: 5a4d034f3cb ("tcg: Convert extract to TCGOutOpExtract") Reported-by: Andrea Bolognani Signed-off-by: Richard Henderson Tested-by: Andrea Bolognani Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tcg/riscv/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 1800fd5077..31b9f7d87a 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -2502,7 +2502,7 @@ static void tgen_extract(TCGContext *s, TCGType type,= TCGReg a0, TCGReg a1, } } if (ofs + len =3D=3D 32) { - tgen_shli(s, TCG_TYPE_I32, a0, a1, ofs); + tgen_shri(s, TCG_TYPE_I32, a0, a1, ofs); return; } if (len =3D=3D 1) { --=20 2.43.0 From nobody Sat Nov 15 12:39:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751297812; cv=none; d=zohomail.com; s=zohoarc; b=SGbk7VMP16jonuBXXD8aDS7ihLAiMu43MirmsYoyTrjk+JBEvT+pjnhfG1g8OWS3r+UglafneFJ2oxt4wPztKviZGgeJEof69KBKt9YuzPpY5kA9elnaKWCcCB0N/M8VhlvBo/uDdYf5FRgVFpFUWUPeGK6DA6T0cg1q6PIESAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751297812; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kWraZuuqlsuFG0Ck4CFI6p/KBtOQl1Lpxhn3Lz1jgKs=; b=n5vNWeWzwxLqHAJTh2/07C7zvdI01qcyIq8KZM9bL+dDOqVUF9FVY66J6H802aLWuldYc1Hr34ddb45KBaYQfPMRnAafYcr08He98JdQsbTtKD9znOr4YWE3maC7JFDcwpB+TVyxplU/iLDFIWVvkQ39oZ55LpT9tisxtaU3ck4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175129781259531.419551904348168; Mon, 30 Jun 2025 08:36:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWGT0-0002Au-LC; Mon, 30 Jun 2025 11:30:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWGRn-0000TT-RT for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:39 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWGRh-0008Ge-RB for qemu-devel@nongnu.org; Mon, 30 Jun 2025 11:29:31 -0400 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-73afbe149afso1276516a34.1 for ; Mon, 30 Jun 2025 08:29:25 -0700 (PDT) Received: from stoup.. ([187.210.107.185]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73afb00c48asm1712478a34.27.2025.06.30.08.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jun 2025 08:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751297364; x=1751902164; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kWraZuuqlsuFG0Ck4CFI6p/KBtOQl1Lpxhn3Lz1jgKs=; b=eBEYXbR7HiA+HlWP4tcKfdSwSxRI9wkiA2fbxYTtIt2uKwBivQEAvVN0L6n4D0ycGz hry+RgLs3CCETmlA8/1p846LwGZ2Vh3v2/ov+7p9joq5cUMarDPs9OQwK5dmLm8KC6zE CcbEQkB6612vMpcH+rvX8/CjYFvSTRaZPdxkRhLx8XjEdEvVGghoLPJmGUqwF/ruGYS/ 5mV37WEXXEINphstcrHGBuUPMElyO0O8OgnrtJ9iKbkFsavaPeDKOCqsM4U1Y1rIeV/Z iau+E+k8lN1I1/Fnvn9KkyE51S4a7YdZnBRXI91jJsOwSbK/8FOj/P9tSNpjzrmbpWjU mmpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751297364; x=1751902164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kWraZuuqlsuFG0Ck4CFI6p/KBtOQl1Lpxhn3Lz1jgKs=; b=XaCstv4xB39s69LT1irX4MadWtxzXwJgur6jvHArJmX41ug6MyFot0pCpjeT33SCwP AtO0L3GYmWmxEtfgyjaBJJG0XAK2oE/IklR3lovcYvLtJQK6+onaZU6epIzrf0gZX19/ 5kMSk7ydZCb0g8VDqIEL2T0YULMmFy4xWZ1xr5ywAdPELUzpD2DweR18rAQHSkENmTsE 0ZRFyCfDMBwSG99MbB8aDp1oqNfWZ9uEXJByiLtt3mwzI9vi3KAATHM/3kfOtgprLTKq P7P+XUTW5jEAu7jMQsCNnkHvo4qFeR0jWiZROpW5tp7A11oJmuACjM+7wtPh6M90KrHQ xKwQ== X-Gm-Message-State: AOJu0Yycu0+CVoD+PPvK6C0IffrvXye7xRLQmMaIMyGK5v2CvMzR5j0t m/d8NNZ0iaKmSzZkIoTDyzfg0MtIsBwZL7j2LGF1NZl7E1cAw+l/dl6RI9AKUMfsPV34Gqe/BrQ pxJx4 X-Gm-Gg: ASbGncshDBi6xpgzp6n/5Lg1bEu8UqZXITFirzXwDZxC9KjBXKy7lsDZ+mfhIWVtG4x aDopK8KK3K7Okte8PbsCOYFQNd8W/dXExa4+VOlN9KVWh8CjWZTaYef9OCyCQOidxFwI+WeuH5D B1HcrRMUXXkw7ZBuMGeug1PlR18Z9ovnWBKoE4nBCyZETYYnM9JnHpMxUZAqSlsL75WtZwzYBHJ D0NbsN0u7ULAOLb7FopetHcmEsWJvRootpiXM4U7fC0dl/E4VSbHPAOwbdbYIuFiBPNsbcvyG54 KWqBz664ux/Cc1/O/vdYTb1oRI/SqjFCFOuXdxk5kVRXBfdRhP9biik9/0zmbFTRapyrvA== X-Google-Smtp-Source: AGHT+IG1HSfrIuEujng6HdYdx4uMNnI/WjU/PEnS35mYXpjDAQCQdODcMf5gwBzCzlLOxabdWAEzUA== X-Received: by 2002:a05:6830:8008:b0:72b:9bac:c044 with SMTP id 46e09a7af769-73afc291dd3mr9050399a34.0.1751297364444; Mon, 30 Jun 2025 08:29:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org Subject: [PULL 29/29] tcg: Fix constant propagation in tcg_reg_alloc_dup Date: Mon, 30 Jun 2025 09:28:55 -0600 Message-ID: <20250630152855.148018-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250630152855.148018-1-richard.henderson@linaro.org> References: <20250630152855.148018-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::329; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751297814252116600 Content-Type: text/plain; charset="utf-8" The scalar constant must be replicated for dup. Cc: qemu-stable@nongnu.org Fixes: bab1671f0fa ("tcg: Manually expand INDEX_op_dup_vec") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3002 Signed-off-by: Richard Henderson --- tcg/tcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index d714ae2889..50d40b9cbe 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -5154,7 +5154,7 @@ static void tcg_reg_alloc_dup(TCGContext *s, const TC= GOp *op) =20 if (its->val_type =3D=3D TEMP_VAL_CONST) { /* Propagate constant via movi -> dupi. */ - tcg_target_ulong val =3D its->val; + tcg_target_ulong val =3D dup_const(vece, its->val); if (IS_DEAD_ARG(1)) { temp_dead(s, its); } --=20 2.43.0