From patchwork Tue Dec 24 20:04:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853226 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4081692wrq; Tue, 24 Dec 2024 12:08:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXEeX3iDzn4b5V3g0MXu/PL1hqjWjqemOui8I2BuFZ0kA1P3CVgiu4Su8rnUVm7FBF+T6I4OA==@linaro.org X-Google-Smtp-Source: AGHT+IFhxdulr7JXz4n60TqISRriDcmA7ajWgP6jRfm0SPdl4SStJMjr8rBBWWyTlLx+AMFdfG8k X-Received: by 2002:a05:622a:5c90:b0:467:56f9:b9f1 with SMTP id d75a77b69052e-46a53e49d94mr237225361cf.22.1735070881865; Tue, 24 Dec 2024 12:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735070881; cv=none; d=google.com; s=arc-20240605; b=TMjpVM7/o3856nzc760ArqpLPtpvIdGqyvN7PQL3u2sORkidPS25VSyqQebwGrr7Q8 OlE2PiGSR7qRW4pdMICQgJ8oBbP0jh+LBLUiQN/zEkyLti8nzoDBjFkeK7jUuKQTq1ER YsAtSaK/gICArz7eC8q0Nnj8qGTt1mKwVqQ41HpjYiSmPrxnCcZmgLfrZ+KZcJd/0YOV Ti65HHkEYRhbtJLw3Rn1iJ9ZxO1XzKkWd/vh6m5p7gHapQhEjwk1y9vRdGFyGLj1V4BW 5RLbXCdGlbwLtkmUD+cPaWUnQ3mSXrILf325Bxg5mcHkXh2V8q2jC3XzIuB9bUp164Q2 4/7w== 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=LsfMpsMqMxq0FC0omwsdymCcUELXX5bANXU+yD+lCsQ=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=FJXEQvPI6ijnRlCUZ8WMQcESa+LpxdlcJ6kfvosrSdLuV8xrOe7hkz5CMxn4VFF7Ow B4NsjVi1Q20pKlbSxdGewoH0LG0iyn8Dk+JGnMTAPb1L/o4nDhGFYUCmskFw3mFYahmg xh4mrCXaZXhHoNyYWkznVouGa5gUPW6rilmCMQLC0c0ETUucc+f53usMgCtSixdw8vB9 +r+Vh+E+GaigetybSCp5NtOr8sPjrLfSOXPZUKHOvNizpmUUUMr20Yrc1dS6MlYfcHeM DozjG1+F5ld5oeChTxEfw4vPA+NUhgdEcyUCfuxln7xFwbKobVHSrhdIIIbAqErByquC ZYzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Djw7fbvC; 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-46a3eb98e2esi151864291cf.242.2024.12.24.12.08.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:08:01 -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=Djw7fbvC; 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 1tQBAS-0003Gr-G6; Tue, 24 Dec 2024 15:06:12 -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 1tQB9v-0002mD-Oi for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:40 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQB9t-0002Yq-W3 for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:05:39 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-219f8263ae0so23702555ad.0 for ; Tue, 24 Dec 2024 12:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070736; x=1735675536; 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=LsfMpsMqMxq0FC0omwsdymCcUELXX5bANXU+yD+lCsQ=; b=Djw7fbvCvS95UCcvWdkqoDt401bZcC08Sohu8lmFAL0o2NW0oNCrxLhyZ/eKEnQLLH HxGW2Z0wjVFbQep2dUcYc1RaUvPWEz6RsBoehleLdNj72pefL0Wt7SNi3yClFzY0r1oC wpn7pFDPRu3Mz94f2Q/sb+FpC2IVAy0xS3SEkHD/BBP/dOmV6K028ValZw+Oaeu7BMuP TF6qNbZoICc0my4iuIQl2WFO4oi1/TtHCJGPppreCtB57JpM5/zY0caiwe+93i+gHrsl x6jVYg6Zh6zhsApB9kPjbhBCsM++y6aY8yJ4ZKDH3na6pJxD+aQKoIUEUajpy4adYCDK hv7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070736; x=1735675536; 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=LsfMpsMqMxq0FC0omwsdymCcUELXX5bANXU+yD+lCsQ=; b=M90fbkuhAkClrXFczqSMMbdJi97Y99VEkWU42QXv7zqJKRV9skXA6RL0k52xvhikEb P0fBaTySftpwSSCkW+bQ4ROp4z9bpngevyRgr2/xy0vgtRyJn3v3VsmiKkWvgpgPo5s3 Vkx9ZYJCq2mu8drt0s7tgNNBpEdqaf7yIq46/3WAs2JFjfWWAOoTK+/QLhD5KOcK7icj RV7Wb96dvxA0Z6PIWp9JeLwOyrSLa0uvONozgOlYveOXnvmibEYxFBT/7SrgyBmh9EGK zgU3YDcfAISSVcPHFvGLaaPIjKPkA0urLHzKTuwtWpvxuFwmpfqAEWgZ2VSNFiJAhKW0 vo0g== X-Gm-Message-State: AOJu0Ywqa+kVM09TgIeEmRu8vAMAkY6ayV0qTElnKlBzIpQZARjXMq+g NbJ5jh1RwygBO10K2+BFSt7HtRJdWV551Dh0UMRUP1KxHfsI2YqmMO2LU4F0tIgI03A2MfPFgx9 k13w= X-Gm-Gg: ASbGncsA8XzLI+W002O+K5GGf755XaeiJM+yDO0UQVf+ewnY6wTAFq95WL+pDbwGfSj r/3Sfi3G+Oa1n8UyhB+xeJTdDtJxelVr4/3oyzAOhM76DGo8orlAy0SNrJXNLZ3d9QZovlt4kQ9 /t+wD+RBlDDdW8DQZiOc4n+ykctKtfELYhmn37eFrmnlClr5AVvXucZUj4NSI5Ko8EYtM+38ejy KaVbLC+BPvxX6yC4B0rDrTw0Iry9RYddLF/h0FyJHt562nR+fuuzzUHafakFYeLVucQn7zABmxa d4tcBD2Jy5BAyjLKPf+4UOavaA== X-Received: by 2002:a05:6a21:100f:b0:1e1:a693:d5fd with SMTP id adf61e73a8af0-1e5e04a3432mr29074598637.25.1735070736528; Tue, 24 Dec 2024 12:05:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:05:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 15/72] tcg/optimize: Use fold_masks_z in fold_ctpop Date: Tue, 24 Dec 2024 12:04:24 -0800 Message-ID: <20241224200521.310066-16-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::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 0766a452b5..2f5030c899 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1067,6 +1067,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); @@ -1599,21 +1604,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)