From patchwork Tue Dec 24 20:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 853275 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp4084973wrq; Tue, 24 Dec 2024 12:18:44 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXi6qIEo4hGkpVjf9qmixCnZJMHFHOMGpyfXWs2owevUZiyEh1Xxydpl/CZxM6MgCnHe+Df4Q==@linaro.org X-Google-Smtp-Source: AGHT+IFI5hK+6ud8mBsAswp87rAwx6bEITfmCQOnaVcg4fpfB2rIFFD4C00xnOAZlSK7QdTxY8WP X-Received: by 2002:ad4:5bcc:0:b0:6d8:8109:a547 with SMTP id 6a1803df08f44-6dd2334d8aemr255351226d6.22.1735071524340; Tue, 24 Dec 2024 12:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735071524; cv=none; d=google.com; s=arc-20240605; b=YVx62jCuq7E1Osy1z5wtslHZszccDe4dyrZC9gO5s9xHp4YetIBDBjUI6ymZ18nx4+ hgqeVUNXDyXrAdd0XisTTsMua9w4i5WkXCCNbXxROCdcTDiU3EdexK6XzIhB3WlqB7gF VenhKSMDaGq68auwSDHTHhrPvolOGJsqm1XjtOGKUn2EfAQOXfd1GWcwVoIhRaNuNJVx fwmnTjNWM3AesQY/piUSFVAZ0+BNbbC3dn2BT29MTv9gElnxr5Qu0U2XSKVXnkgDGuvj WAgmIUXHVrDCASgerPFFR+f1iHTV19rPKlq9y+6+ZycFmDBqdiF7lhCtIIkHFrLd+91f mQ8w== 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=fWD89RQ9Sb2UhObXSAa3h+FC5JlParE8myCYhh3ZG/k=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=Ld861ngTAlOFYC3pLjVEILdXIm4oBBfJutRUdEcwuUpbvL5Fi3EmW68zS6pKv1W7du BNaTf4B3+QurPPr60/QjXJaDOFKoYjOHfP3A72JmXEJ488X0uQQbarzefbxghdr1BScf k2ymjPvYfR/pCrMPEEHDhqRNguaTc7VGb/hXy6c6qVkEzg2MZQWJEjH28dKO7M/h1Qlz ZCp4it0B1LiQkqTo+OUBUJKi82k5C/pfxAXk0xQ/glEgxbl6IhL8cpSq+rUo45Zf+fPA aiNI9V5b6T+UEVveiByrNhdAR26BdIRYVxD4oNlW1jhR8y0RpAM9tlMkCDcLjWfRvk3E vQuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bq1Tqnrf; 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-6dd182369ccsi145565646d6.244.2024.12.24.12.18.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Dec 2024 12:18:44 -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=Bq1Tqnrf; 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 1tQBDR-00068F-1v; Tue, 24 Dec 2024 15:09: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 1tQBDI-0005zH-Q2 for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:09:09 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQBDH-0002vV-90 for qemu-devel@nongnu.org; Tue, 24 Dec 2024 15:09:08 -0500 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2166022c5caso50556375ad.2 for ; Tue, 24 Dec 2024 12:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735070944; x=1735675744; 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=fWD89RQ9Sb2UhObXSAa3h+FC5JlParE8myCYhh3ZG/k=; b=Bq1TqnrfhldLnw+FKKsZKyIbN7U4gy5OzmmWatzQiW1CsPK8qltF1bx277PdTFEHEi o7mYtOPCi9ro3+MY88wHSb8W9ZoQIOow0k+if/YdNK9xgsBNNR8w2VlWlZY+4UuAmp8m MX/IzYv/NIpZlRjds9DxjZuLpiES5sbM58dFCYb5BNOElhpNyLytPZHVNRWyB+vYCtvX iDhDTrMYDnLIPNbdMkZLAvFKpfIhscGiiyQ2hNl5exul9QY/DgD3hTbSO98CGHss8ky2 D7SbRd3FJeydqrLe1BD+Nvvo/BPRKXeFEZgEtUSTjhxcQwLbVI8aHV+NGENOd7HyXMzq Ho/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735070944; x=1735675744; 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=fWD89RQ9Sb2UhObXSAa3h+FC5JlParE8myCYhh3ZG/k=; b=gt9M/mHhPwpDcv96kCS66V4XwMQiCNQnyzfksDOVlZdSe1CpgbcfxlSfZ0iNAHMW3S Kh1V/wD5wf4AUHHSE360LHJMUx/almn8bliPJ7Pf4j5/rAJEmlLXP9lqlhM3Qb20+wAe kZXRPeqUHQtaSWuDPE2tvmxdkPZPm3ANgw9N8qYBWjkXoZSSFdXXbMeXqGVTRUr4DQ91 0gda4kpZquIqEf3nbuOMmEMO5dHcVhWF49ep6oCpOCCIlz4DpDLVfrbHlQ8mgZbc+4eO Ty/OOt5qTCfOKauTiU6GtbRZusT82FcCEUcyBtdFA0m2dG0G2umOXq++w2+zPI+4glAB ZMfA== X-Gm-Message-State: AOJu0Yz/hyP/In8uSVzGcqqKaZ1VDBMv+1/pHrLLYeHyev91t9QKOf3+ yTJGPwtLYKANdJjveGr9j+5Fvrn0542ns/d1GK+qcXwT4aM4pMCY8qbNjeQN0zqxP87sT3X8+E9 zOUM= X-Gm-Gg: ASbGnctNiaq1UHfD6jbbGe/riazny9FW7Iy6tkipkORPbE6q0aapLIF9z0JvoHCiNt7 sPbaq6ggWI1hVGSgiCMl4AafL2ePDITx1SIeXiClbF6OfjsNtJehbYBRFO56u5UI8P3SEUzHmMO B607r0Jr7V74jukw53vmNuY3uIGhQeQ0OasXDvTDXegskeNSb3VPwjMeJOamY8Ts4J5agLcHNF9 VEYuq5tj95hHK0MLi6FfVUwapS2tKImzGzvgMaIpQaR/00rPiJX57lVEnb6NFXgVjgKt2rslL3Y /yH26JbXEGfWyTmThy61QYmIAA== X-Received: by 2002:a05:6a21:1693:b0:1e0:d89e:f5cc with SMTP id adf61e73a8af0-1e5e04605a0mr28516895637.11.1735070944442; Tue, 24 Dec 2024 12:09:04 -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-72aad8309acsm10033521b3a.45.2024.12.24.12.09.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Dec 2024 12:09:03 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 44/72] tcg/optimize: Simplify sign bit test in fold_shift Date: Tue, 24 Dec 2024 12:04:53 -0800 Message-ID: <20241224200521.310066-45-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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 Merge the two conditions, sign != 0 && !(z_mask & sign), by testing ~z_mask & sign. If sign == 0, the logical and will produce false. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- tcg/optimize.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index b70e9bdaf5..26790f7c27 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2530,7 +2530,7 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) static bool fold_shift(OptContext *ctx, TCGOp *op) { - uint64_t s_mask, z_mask, sign; + uint64_t s_mask, z_mask; TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || @@ -2565,8 +2565,7 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * If the sign bit is known zero, then logical right shift * will not reduce the number of input sign repetitions. */ - sign = -s_mask; - if (sign && !(z_mask & sign)) { + if (~z_mask & -s_mask) { return fold_masks_s(ctx, op, s_mask); } break;