From patchwork Tue Dec 24 20:04:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853208 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4081144wrq; Tue, 24 Dec 2024 12:06:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVTFsuGIau9Rk8FZFP3HkpAcxbIiJS9ndbPHc+Vkf2sTuhZNzJWLVY5eHCJUFZF0zMcH4qsgg==@linaro.org X-Google-Smtp-Source: AGHT+IHmXNDWylyMrknfiQqnjSi14PtameE1W8DOMS3IAZ74Yl1XiGsFLehvm0EMycSPSeDXU0rn X-Received: by 2002:a05:620a:28c9:b0:7b6:d23a:be4e with SMTP id af79cd13be357-7b9ba79aaf2mr3150551985a.25.1735070782267; Tue, 24 Dec 2024 12:06:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735070782; cv=none; d=google.com; s=arc-20240605; b=BqEqM4ANumialNcEdoOwQOMy4Njn1gJcWD8Wrqio1X1KsmRLOOmgNna5lkAlzIrLSJ pRGsJpZrn76MrGT6ZkAoC1lj00UlC386wEAEfue9QXseLiJsyPVpBcOuiicj5NXzGcZQ 9FvBkaLS5gVPXgKYysiN5JrKq+8/0QzulqVkILSKaNJWT+eFQbCTUD4ltIt0mmoHO3el CaFKt2uTxKY7zR3TyKuqcycb011nkxdAYvy1lAql4aFMY8xaZqhdipEb2rFRZ9YPy3rZ wySL/e7YpeCdZV9cZkq4vh4/Oi31TTSP2CpXhnwi+fWSalXqeRLimOHFgAEPnSLPUnsp quNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6O0RsWWKqdEinIh2H96IW4WRMj9sIUVKDwhRVVNpMf0=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=R24OUKagYmV2LwcRrA2Z/AGLrsmyy5s7ac6n4tESLS135/fasnmsx9zsRJOIk5b14S wJpNyt8tqUS+1i8NTkW48HmNLSibCSFBDTMRstSljA5bPkpMN1Unoujs5yytgf4luxtJ /iXRjPB3Obg/G8bcfxB7kHrX4I8Rp90gU5+dKMdEAF1f1cmvTq6Mj6qrkJ4tj/S8dkot /RBnIQQvNMgBYoZQ8LbyxLbwm3nHtxApNyZnGEc09mPAi0iSJ1eQGaaef0F74o2j19Y1 IpSl/UrzJMZUU6W0GLs7Q8lCeXu5Uk+TW/JowCvQLszSv66DCxvCTwh+Xs69LbkPiQwh XEFw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0LncO7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46a3eb9969dsi136818631cf.306.2024.12.24.12.06.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:06:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0LncO7i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQB9w-0002mk-Tn; Tue, 24 Dec 2024 15:05:41 -0500 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 1tQB9m-0002je-JQ for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:30 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQB9l-0002XI-4g for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:30 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-216401de828so54800755ad.3 for ; Tue, 24 Dec 2024 12:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070728; x=1735675528; 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=6O0RsWWKqdEinIh2H96IW4WRMj9sIUVKDwhRVVNpMf0=; b=R0LncO7iqnfvdWdHnmBW90w4sao/4HqmR/WnRXAW4PGPLyQ1dr+W1Xnt5zF0/Nf0xX T0tOXsDl64IOo8Y8fyVrLpkHcjE9UjK8J29xgu0HMCsMxqYv3nrXDGkZ16U0Ef1Le//3 lL/ArsTBsG+s4ysdLWO7tet4ZzRtre+2Z69zkYUCjgtnSp29iWF3quriHY8B/XpZhefT Z7MicNU2x4sHBFRfjl1YZ2y/qxZVMvgJ3Var9E5oXld+uqO+a+SSNU7y284pc04HWKrY MGhf3b4sPwXr/MVj7uMwRRX3h7G80dagX4n0jfIu2AQbSY1AyFDmepVJOL0mL70LfYvC 7fVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070728; x=1735675528; 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=6O0RsWWKqdEinIh2H96IW4WRMj9sIUVKDwhRVVNpMf0=; b=gzbhG9apv8e/vk13WYpw/7NfuXwKsPNEVCLbgju14sS0BTSTe1Vc0iOKHk0aAOMMBZ uFqr3hEOaJtpMkHHKz6i55aNcOhVz/1qjsohwJQo7tIoMXPzoAOQdAe4kxzOx+lX1sSt nDGj0NM0yUjXd8b2z4io8LCIfI1hq9t3XaypDsk487+YqGmERktP04AbjoEuIpg13wv0 B6qoLiPWvjMfN6K9qlgs55NoC5vqTQzz3n3TYWtdRH+7jXHzVsRPbB4APBaPw5zupCrM 1l3ndRG4ezUBvvax2jSpF7f5eTYGj0WRuDC9wSBCQgGI0qqCu2k91yM2jAvKtqEyn72Y MugQ== X-Gm-Message-State: AOJu0YwNob8apu0bZuJdiKukUoHLngCF3YgOMLUQxXtJW+ddpuVKYZpT vC8wsGczQfdgbwap09L95M2rPjTivQEEHTSNg/B36lYOUIwuAW02mmoKOSZdHiPcn3kRr78G0rJ mMsA= X-Gm-Gg: ASbGncvBBrqqrNEGOw9cML0fR8LhyOC3td7d6YERT3MuNomY6zD4iNko29apWCzv2/X NZSj7QCI0J0+1jMlSWL+TYdasfURNnVD5GGATKjnsi/mnnITCxZL0xd/amo7CL2TmSPAmqhdaoa y4RL9qf9uGV+07ivGqThpx/LH5Os4bJM5c12CUr4yXVWNt0dO2X3Une4Batp4FVMW8W6Zm1uUcU C6X/u+FqEo2etk6o7xBWSf9HOgglwT3KUfRCgIKdTA84bDs1phhxYiLZI2CtWWYYFy4otsnkV+u SgAAoQ3tMMOBbgrsPbXkOxDOKw== X-Received: by 2002:a05:6a00:44c4:b0:725:e405:6df7 with SMTP id d2e1a72fcca58-72abdd7f683mr26519750b3a.10.1735070727737; Tue, 24 Dec 2024 12:05:27 -0800 (PST) Received: from stoup.. (syn-156-019-246-023.biz.spectrum.com. [156.19.246.23]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fb895sm10027159b3a.162.2024.12.24.12.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:05:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 06/72] tcg/optimize: Split out fold_masks_zs Date: Tue, 24 Dec 2024 12:04:15 -0800 Message-ID: <20241224200521.310066-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241224200521.310066-1-richard.henderson@linaro.org> References: <20241224200521.310066-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a routine to which masks can be passed directly, rather than storing them into OptContext. To be used in upcoming patches. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index 2aa57afd64..d70127b88d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1044,10 +1044,14 @@ static bool fold_const2_commutative(OptContext *ctx, TCGOp *op) return fold_const2(ctx, op); } -static bool fold_masks(OptContext *ctx, TCGOp *op) +/* + * Record "zero" and "sign" masks for the single output of @op. + * See TempOptInfo definition of z_mask and s_mask. + * If z_mask allows, fold the output to constant zero. + */ +static bool fold_masks_zs(OptContext *ctx, TCGOp *op, + uint64_t z_mask, uint64_t s_mask) { - uint64_t z_mask = ctx->z_mask; - uint64_t s_mask = ctx->s_mask; const TCGOpDef *def = &tcg_op_defs[op->opc]; TCGTemp *ts; TempOptInfo *ti; @@ -1080,6 +1084,11 @@ static bool fold_masks(OptContext *ctx, TCGOp *op) return true; } +static bool fold_masks(OptContext *ctx, TCGOp *op) +{ + return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); +} + /* * 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