From patchwork Fri Dec 20 04:10:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 852346 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp1851611wrq; Thu, 19 Dec 2024 20:12:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVNUwQWYaVzYdO827pbGigKoe9Gu2u5CYMhtur/AlPiGIURatf9VmCvmf/2XCEiavQs3HtdKg==@linaro.org X-Google-Smtp-Source: AGHT+IGqzjKFOoQVlyDIKF/GhWw4f0L3l/MU86C6xbog+xTzexGEcn1JiqxpgUHBqvcuAHKf4n+l X-Received: by 2002:a05:6214:e83:b0:6d8:7d63:f424 with SMTP id 6a1803df08f44-6dd23331dffmr22533366d6.12.1734667920600; Thu, 19 Dec 2024 20:12:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734667920; cv=none; d=google.com; s=arc-20240605; b=dYMZaQeqVLknGidSkI/UJWiHTRg3UNoF4dJR9J5Turs3U36xFWX38M9dkT7vdWhBcM tKucxAbrxSPkIaI2JgupV1THLtMIz6c2D/J8F/jGscI0rT3ObH9YLmPU6VLKZQooYcLK GPB2fP3GLU4gyDfPb/sEFAlaLUvvZnlTE/Ke933C8O56Lpus0D2OB6+g0vq7L3IAKBof aO9uz1nF6a8bwGViN50JCwQ5JFeHP2sBeFb5+1kO8jKSJBYVJanSZ5qSrB/XbfENkOpE f/IJjWOuqq7b9qFJBeUKU9c+XHp+Xnz4H52BTmOORCwo/hBurEg8SBpWeVVyB/Oqtgf7 5+QA== 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=Wg8rqRAgWRCDilgaz5IPxRaaVO9cOj5AUka7Masx2ag=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=E6S3i+GwO68ao8GINpDGq5Dma89xXFFxLPruONlfSTYvbcGOXoXApaeI7GYA2wqFlQ zg8Q8WZ0VTW0Ef9U60ai/2uj5CZ8244QRmF60hiDCkY0IduDGFZ/aFx31uIQcbClr5Dj ijtBtNynA48SIEqkVAT47fUjPmDP/1UPOOhBo37ptdBuOlTXsNBOcZz0h8Ju/IBO2Ijn feUZxe3xFPV4U7aeMToJzi4n9kwXAfgBs32QSlFu/Ddj7CIFh52BBOUHWmIBF6GywwE8 rhQoop7t1argcyBEIpVp0+q0/v+2SiWwiygdHi+uhLIA8k6QMEAfptR/15dixZL7qLOE LmFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dzUQCSS0; 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 6a1803df08f44-6dd1823641csi34231446d6.218.2024.12.19.20.12.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Dec 2024 20:12:00 -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=dzUQCSS0; 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 1tOUM9-0008Nu-9c; Thu, 19 Dec 2024 23:11:18 -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 1tOUM7-0008Md-OH for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUM6-0006Id-9i for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:11:15 -0500 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2efe25558ddso1055759a91.2 for ; Thu, 19 Dec 2024 20:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734667873; x=1735272673; 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=Wg8rqRAgWRCDilgaz5IPxRaaVO9cOj5AUka7Masx2ag=; b=dzUQCSS01mB6O3F2CekUidvje6/ZkNftRophfv8T31HeWLqmx2muuH33XJ3gWgFGHb in1/oo/Q4o0/7Nq1HDhNx/IqHc1d/3iMaoV7/5Jhm5L1y4w7FfDVpZFbE39R5pPhpgfd LagNBuibreD5xbQokApJ8mf7TbDb9GQE65zWsQ28mm1V7O81LbOKdxCtPDphukYGMMa0 NBwN5K/tXtl1UxoG89HxuTV6xwMfKrAZDGOI6cBh4Y2jNBJTh8NjHL6gEkQx8uS0MALP Sc1r1C7vktSWqbd+hxwrmavrotNWdDu42W30enbOmmguwF67UHtUGXV3FO2XYm435GPC wYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734667873; x=1735272673; 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=Wg8rqRAgWRCDilgaz5IPxRaaVO9cOj5AUka7Masx2ag=; b=F/ZEQmzC7bI8aFLKjoBizB1Unflmti/kG/YS80RoZMMXaMbMT47Ud0OtlQm5kXdIHj X5fxvYl+1bBhVjV9yAzojHwk4JQSzk84Yi1786aafLRQI4RWn7oZl7b0kDxCdneLvUNR CE2Jkh2s/EYR7jHvfm00+fBprKqoR3I++TCIzjJP4tc4NjzHBFklFOLD4TxCdKTTpGJU AOUdylbuYHFrJZOrmPYnjZyoaktl5mil1SpTLNp5Xc8zSgjMzJM0scJbZpQJG/DSMZJb SRVhYZGwFCfRuO84aWnxHS8ze6Fg9MJMNtbVWC5HPB0R0JvgLSjjwmu+9xWyPmVU0ISv 08Eg== X-Gm-Message-State: AOJu0YwHe62WVufPuI3movs4nHkKSMLtphOtV2aTncVoKw6hPkQd7LMT 5zzVK5T4VnGf6A6fe427CAMnJXOuHtLA3m3iqzzdRL7dIrmszD/E8nngXPNWNq02HnhVQ6LfJ+x k X-Gm-Gg: ASbGnctidfklxkjY5TmGu+99rBMH+UWivMslEh19ttxjd0FxFCM1YrXJqNoKxRV8Fdj WHLU/sCi0POBi4ZoIHeBIg4m+7U7sRFmb+1JBlTth2yKwQCftnldaupuKJ7dQFz32P+1AuSNLdh SBBZQ7ntdoiqxKZTNKzxLmEGS/GpwwIq0uoPk5MZ37CQ5XMlVFKYbclZEUdYPgxRi2fPVn77VMO nf5zu+nTG+W1KjjFi83Alhw71vLUddd0gzzF9J8Wb3sN0Ip/hi2Ep8+r+KySl8= X-Received: by 2002:a17:90b:51c1:b0:2ee:8031:cdbc with SMTP id 98e67ed59e1d1-2f452ee634bmr2053664a91.23.1734667872955; Thu, 19 Dec 2024 20:11:12 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f2ee26fc22sm4165260a91.51.2024.12.19.20.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:11:12 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PATCH v2 11/51] tcg/optimize: Use fold_masks_z in fold_ctpop Date: Thu, 19 Dec 2024 20:10:23 -0800 Message-ID: <20241220041104.53105-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220041104.53105-1-richard.henderson@linaro.org> References: <20241220041104.53105-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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 270051acd1..af7111c98c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1086,6 +1086,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); @@ -1616,21 +1621,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)