From nobody Sat Nov 15 17:20:26 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=1748938323; cv=none; d=zohomail.com; s=zohoarc; b=f6ui0q8eGDrWBIikpI0/J91py2AcbJ0C/uWpCrxJckhqQzjXQgxnxOhyo5At7hv2ZZYUhUt+fIu1Z7odE/yVx060ZgLPPc0azc65X5+d9HbdgNERbZa80sW+iMqX223f8v2TsRVKK8KNFTXXnm81ItfC8QfHdRnhbTGuWnhWXkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748938323; 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=W7U4qvIdnSjKEmKjhZg9LPBWKFbOmg9j7tuwb6rQ0l4=; b=S8Y49ElcldvmTrq2FFn5Hnvvjanrbc7FjzLax4JTKn4VgkbtGfdqwWlCVf4Esuth2dRIfcKhp7sFsIlmpX0raNBFjneOTELsFADO5yKE0DxlB9TzKQeneYOwNdwxYQ2GfPPvfGZjAEC4HLd7DfqM9HFJ2wzbC/Lh2rqIt9VNdHs= 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 1748938323272819.2150445253413; Tue, 3 Jun 2025 01:12:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uMMkF-00061Y-4e; Tue, 03 Jun 2025 04:11:39 -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 1uMMkC-0005gJ-1P for qemu-devel@nongnu.org; Tue, 03 Jun 2025 04:11:36 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450: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 1uMMk8-0005sa-KV for qemu-devel@nongnu.org; Tue, 03 Jun 2025 04:11:35 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-451d54214adso19343705e9.3 for ; Tue, 03 Jun 2025 01:11:31 -0700 (PDT) Received: from stoup.lan (host-80-41-64-133.as13285.net. [80.41.64.133]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a4f009ff7asm17668852f8f.90.2025.06.03.01.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jun 2025 01:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748938290; x=1749543090; 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=W7U4qvIdnSjKEmKjhZg9LPBWKFbOmg9j7tuwb6rQ0l4=; b=PUud556+N2c+WWpWCyjH705xWj7NoEDpATX4ZNHrd0h0FAIdk6LA2BqSOs/B5AP8gw qJBShVK6NWhGkZG1gVL9BPVqG8VOWZiCdIV4fRRMrq6NPuXy+mnxPsH5KQMYrCeI2D1M 0G8nA5BL1VeYen/UrluMTiGVN15nW5payFF+bxLpjdeWUOJNmaHj8WWfGtC6t7jY0zd1 c0BO+UAL2I7z/++tBO7LTZT8Y6SaZABHvY541j0t9xDuhFDDK+Je0fH/64juTWlErG9z eYAmrWQVlt6EW/03U4gwg2mAvoCHeZOy+erjVN6ErcvdeXdIqFXfsIeiC5p8i37eMzDo CUlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748938290; x=1749543090; 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=W7U4qvIdnSjKEmKjhZg9LPBWKFbOmg9j7tuwb6rQ0l4=; b=WbqoD6Uw61ZAwX4bmMEWBr1bXBjiHnE3c3bpBJE0QhkyP2gkXn93BrJK765ON8XP3N dJut4Jc8nY3pVhnlaPaXI68d2a7RFJ5wqXqRDlpB18z3j4LlKGXwl/vpEDX4OTQS+5An tfXKmI6zgT7Wz4NUiho0hk/hMgK2oqvHGQGZEEY0PhKUBND2uWYMhigsqwBy0RGG0iOx h44vkcY5FVO+tArGx8z5agrY8aQFGLUVeEcJdfHCz1CHS3069CsfaoTPYq0THtOJQb5j Ehym6iI2ep8HSORUAkT5RbpDsELxWbPGSdfhgi5B2h4w6ryfTZvh5tuKmBQwgtzJxd0R e+1w== X-Gm-Message-State: AOJu0YwNjWx6Kt+xJBDOjv0jRlvqxOI/Z/Ns2z/hw33OuiuzqoHguz8C Wku+LYzUpcLRrcR7qC72NdP8b6Q88FSYtEUjg/DKHow2PUSuK/xjWCqmmg6QkyRnnTet2GK3LkD eYCwF/Zk= X-Gm-Gg: ASbGncua6Ul2Gdievr9yWD2G87OgfvqXg0oMniAbJsO/+vfhAx4LLWrh46Gm504xF8G lx0aoKBAXQR+vKEBdhWhI9048e9DJLn8v4aTUxk/WTkEsb1FWf6efRs2SRnam+BX1xHiBBxEY0q soJSfVuEbGygpoXD/mtFk9q/MSNV0ZSTZ2mW2OaEusWSPiG4hBJsR/J+U1rsrSZBFpIw9iahw/g cG8UpQN48NVdaaqqaya9aZP12OMK/eeewFTkRmtDOx+0UxQ3zDudbKPPF9wokh+0ireQpp83lbk ZTm/5IKqe8DMAYN4jQFePFtnsWgMLobnUDl1ftjwAmbep3Koa5+O3if3J2UOlpD8R+vB2ujvpKJ OyVFySlOu8LyBrJX3LVxPYSI= X-Google-Smtp-Source: AGHT+IGKaI5CX+3sCS3/nrqoUMgWiFtHDjg9DUi7Gt4OxBDFweEzvlVFkvHtplid0NCq99LrWMTWIQ== X-Received: by 2002:a05:600c:4387:b0:451:df39:f7c5 with SMTP id 5b1f17b1804b1-451df39fbe0mr26618885e9.20.1748938290604; Tue, 03 Jun 2025 01:11:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH v2 22/27] tcg/optimize: Use fold_and in do_constant_folding_cond[12] Date: Tue, 3 Jun 2025 09:09:03 +0100 Message-ID: <20250603080908.559594-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250603080908.559594-1-richard.henderson@linaro.org> References: <20250603080908.559594-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=2a00:1450:4864:20::335; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-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: 1748938324355116600 Content-Type: text/plain; charset="utf-8" When lowering tst comparisons, completely fold the and opcode that we generate. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- 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