From patchwork Sun Dec 22 16:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 852953 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp3037081wrq; Sun, 22 Dec 2024 08:33:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV/od+Ayk639xVeX77ukTWajtzvPPkRYnnaaL/fBpKBRBe9UF+EG6eUaspEPR/69w4TF0cPuQ==@linaro.org X-Google-Smtp-Source: AGHT+IH+hebZSUw/t3HEoLopoFN3WIV7BIdkk7r3MJj7P84a3/9EKbBopRU1PlOBo/qiITu58++N X-Received: by 2002:ac8:5dc7:0:b0:467:77c0:1c9b with SMTP id d75a77b69052e-46a4a9a3390mr162812781cf.53.1734885230263; Sun, 22 Dec 2024 08:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734885230; cv=none; d=google.com; s=arc-20240605; b=K+jR3XKKou2IGNfeSnbxqqQpinlmlVU0NusTs2HK2SN1qfVpy0YZkRjcNAXpGVKb5e +wyNQuE9CROkghU/QjExUGhD45DMLCKB5xagnIwi73mFZ1VRk0amNQDodrfI9XBnLNcS O9MQaATOR/vEw1SbwGrzjjLN39SQxh44KZjwziJgJ+8xixck0bo4dQ4zosd2lAnQlFTo JPioxE6lO79k4z4JW/tIkGC3RqHgenybHZXEbWz9VqxxxHdmAQwWY4/GIZ2O5o87afiZ dQgH4fVjc0nRQX8+eXNf/1jeuA8OIW/nRA23yXSe5avJPDS/3ky2vxKD5nWmZi+owYmE Cvzw== 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=orGIi3JyNJ61WgKl0adLXiU5mTOG/lWk8OxYIjK5OkA=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=aMdb+ny9hXsLCUmYZ1MMwMPyix8S9N3D83Tv3IoOtfiEeTIb0EDryfxxZEIERgoMGv jHZxLOUPs6ooCIaodyc/wnPRzHYvFG97Kb1d9+rSgQP8XMejAjr0eeH6XbCPvHCsiL6a PS9FLlpPiRiEric8gz0FiSxMfKDP/gCj503X/F+Ihzznw/pLaj1QzWfapxHZHpzhPuHH us7Qkawq6vusMkTyPXJw65ODtth4ENpRLPaNv3nxdmGeCXpX4WtDmor8S/+/62ANSSg3 TzTWZcB7ZeoPr/XcdFEljA+F+wl2hE5yKZxIElPylKNF2vAOSdr9g0ATbKcX6CE5xKhR ekVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iBByO94E; 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-46a3ec00a67si94692641cf.640.2024.12.22.08.33.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Dec 2024 08:33:50 -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=iBByO94E; 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 1tPOlr-0002uo-VZ; Sun, 22 Dec 2024 11:25:35 -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 1tPOlG-0002ZW-Ee for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:24:59 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tPOlF-0002y6-2C for qemu-devel@nongnu.org; Sun, 22 Dec 2024 11:24:58 -0500 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-21628b3fe7dso29192525ad.3 for ; Sun, 22 Dec 2024 08:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734884695; x=1735489495; 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=orGIi3JyNJ61WgKl0adLXiU5mTOG/lWk8OxYIjK5OkA=; b=iBByO94ECgcN7fCiU2EGhtWYs8u6uhUjibaPwlOjIu0mpzmR22y7IWDL/ChUa2DcKv RueOO1InWF1x0enySQj9XFjXOE5xfTQRInTmobxwWQqvAPZpn8WHW3WjJdQttdXxgu7t 5D0nIgFoi7xC5uGfVTMu2r9x9uCJZ8EMcA2xUCGYBnJFAmtT6433n9kYp1r/yUpvNFB3 pscKOPL4AcX1ROv0xYm7rHZOhTbES8M4N1k8N1HcoSE3GYrquFIr+gJwZChnFw58kbfL NdboqiNF1Hpg+LwoIwDwNR/i9BNQFEYrOXgf0MpF9SM00WtNFKeljpL9ix42wSY2pOsV ACIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734884695; x=1735489495; 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=orGIi3JyNJ61WgKl0adLXiU5mTOG/lWk8OxYIjK5OkA=; b=U9Wc++mXIFHyNsMpXNYlrCf6hvRpvl5gWpDi+pSz1oMcu7HvMbuGhTrsk0zl/hzB1t JWFxyBAKXnmZSHpcNoDi3ICAZLB/WIA8tpN3sykRmzX/0ul2L3TaljQ1xeRpTnIBBRhj WvxZLLwYiJfAQTCVysWXbWmyfUk459E6H6wnuSUsiK2Qlacvp6ntRbjtKwkG3hQNuZ3w ODQQz19vUKQ47Kc5UsK+X1M1VROW4N2dAvJXu0gIkmfBOftWrVtLtQCaO1vYPkGxH4Xj GKJVwrWbrZWtJJu8hKWlFWg93ysmkB/x3ezpi0NoqjgzAyZTRupiuwAqsZaFYH8uvUQR G0Jw== X-Gm-Message-State: AOJu0Yyj8722Nw4JvcbP40IGUaK536I0u+clbCAdowBdw3o8SPhYa3kh AA0Rj+RNrG8Ep5uLekyC1nDkOApRmyplUeW4Nt/t31WmwQb8gLJWKw5GWcEP9CoBiz8wPSXQ6nr +TrM= X-Gm-Gg: ASbGncu1M78YI5j+A3Th8S9JaLJlT9h4gKnufdgMHjTzbZiU1ea4efZvRBCovl3EKux TvpYC49tjpajO5S41gkkXgIhXK2aaQydGELg2uAfzxNMTwi7o6emt3nhXRK5fxsLltAuE1Icg3l MfNFakgshvETr0/AJKgn8VV5g9/0k7Z009VNAuqs6iYED6Tx5Hs8qEnAePocvMrhLix5Dn4C03X vuIWOEYA1F9BrTKZnv/cEcFUEyLkmACOSa0lnKtAKWAGCaC2w9anmL0PX+CV74= X-Received: by 2002:a17:902:cf09:b0:216:7175:41bd with SMTP id d9443c01a7336-219e6f10aadmr152414445ad.39.1734884695510; Sun, 22 Dec 2024 08:24:55 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc971814sm58461385ad.79.2024.12.22.08.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2024 08:24:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v3 12/51] tcg/optimize: Use fold_masks_z in fold_ctpop Date: Sun, 22 Dec 2024 08:24:07 -0800 Message-ID: <20241222162446.2415717-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241222162446.2415717-1-richard.henderson@linaro.org> References: <20241222162446.2415717-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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 fold_masks_z as a trivial wrapper around fold_masks_zs. Avoid the use of the OptContext slots. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index b98597f500..eb982b73cf 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1053,6 +1053,11 @@ static bool fold_masks_zs(OptContext *ctx, TCGOp *op, return true; } +static bool fold_masks_z(OptContext *ctx, TCGOp *op, uint64_t z_mask) +{ + return fold_masks_zs(ctx, op, z_mask, 0); +} + static bool fold_masks(OptContext *ctx, TCGOp *op) { return fold_masks_zs(ctx, op, ctx->z_mask, ctx->s_mask); @@ -1583,21 +1588,23 @@ static bool fold_count_zeros(OptContext *ctx, TCGOp *op) static bool fold_ctpop(OptContext *ctx, TCGOp *op) { + uint64_t z_mask; + if (fold_const1(ctx, op)) { return true; } switch (ctx->type) { case TCG_TYPE_I32: - ctx->z_mask = 32 | 31; + z_mask = 32 | 31; break; case TCG_TYPE_I64: - ctx->z_mask = 64 | 63; + z_mask = 64 | 63; break; default: g_assert_not_reached(); } - return false; + return fold_masks_z(ctx, op, z_mask); } static bool fold_deposit(OptContext *ctx, TCGOp *op)