From nobody Tue Dec 24 13:13:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1734668300; cv=none; d=zohomail.com; s=zohoarc; b=m++CMJHyyvILKG1Jajs459i6PKB3hnTsUIbu+bVVRyAkVwksfeUwIKIyvcaeJjJVWSmZZGCpFp3v67s/YhzCGPuK8VLWv2DdTFA89OWAbCKMRS0gRbzrfUF+AZdO2EJGXWLoAw1b2CbLDhcKgBlxQMo06PbbWxk7K3gfkiFJXlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734668300; h=Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=zHRYikYlUcGaNY1VZY67VXJBI/Xxa/TUZTqCG4A2qqU=; b=hwvRV4EBgnISAZNQCeMYNhchtORtxJ/A8XICvnbms3dM2hVzUgbW81q/+BZICUxJQ4EPVb/fRfRYZCPHTnoVLwEpNHGlIbQWgnUkqjaqYnJ5NlDQunbtTkPybCN0ffExWwh1V47OaguSHU3AlC5aH+OKInJdxm3D52QnDfJ3poU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734668300841283.48273956273044; Thu, 19 Dec 2024 20:18:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOUR5-0003vG-Dv; Thu, 19 Dec 2024 23:16:23 -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 1tOUPN-00010q-TD for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:39 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOUPM-0006pI-E1 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 23:14:37 -0500 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-725e71a11f7so2030682b3a.1 for ; Thu, 19 Dec 2024 20:14:35 -0800 (PST) Received: from stoup.. ([71.212.144.252]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-8529e78a55dsm506952a12.80.2024.12.19.20.14.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 20:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734668075; x=1735272875; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=zHRYikYlUcGaNY1VZY67VXJBI/Xxa/TUZTqCG4A2qqU=; b=FPJMWxhx6//IBm9AMSVJvU6TskweitBpOHpNYz1/anR4t3HL0t428iqBfdGcKYUcZZ XRmIiHGlBo+aXINUap1mUKHFVxd1fwkCRm23TINRpJOa8gQ62RDuhfQjp05pEmXhhny6 9WNJ9R5uLB647DRx0IVSj+qI/DBz4ykONa+xAPWdnXEncvZZvohA9GZKYi5MUO5B2Fmp T7ubLFk1jVi/hKEdRh17PCOwkqaktiojOX6JsGU0Ai/riTTe+oQB/FdHtqPtrZzZ29BR /MUmzOhbbEgBNMPSFyBXOMdJS4cZvaqnGbw+JWePQMLAtW5D+xJccpxPLY3bmrcFNp8V JVVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734668075; x=1735272875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zHRYikYlUcGaNY1VZY67VXJBI/Xxa/TUZTqCG4A2qqU=; b=IH6J+ml0Gyv97A+PurL99g+/FQdIlPuoDYjS1BCsKUG3Z0uLRudTQGLAv48/XypBzG O4p7YCe9zkJC3sSFVnA7kGLij6ydFw5CpMtzS0wEJYfmS+OL2/m+WLfe+jPobheKzb+L Fa+njOixcVdwMMj6FaTRSJLJTo8q7Mp/nJBCqWcm2Pn9cifjcVIL5r5pfpdWPxBaYxsu 1DnFpXwI2sR/CSUElAO4m1XUX5MmQMtlPSi3cVnfxt7/EFydpQvhOLSEQLGSVrwRpmMJ +lchRoeduT+o+hPIktVVIQ/cuSapzpBz6hyq/I7/SpNLDJm1MqyUMrVsH0KJq+a1p8tS E7ZQ== X-Gm-Message-State: AOJu0YwErfakSGA9SIP9oSh3iXthlVtQ+IrD3Lkv9Bxq3/yYRknjVS8l eXgi/p4FELeAFlqj8qRbNhjQrRiU4rXBWzPwBMgIBhd7l0fAIKQe7UwP2/kNQiNv7emW979woP5 b X-Gm-Gg: ASbGnctpDLG09OGJo5XKMe17/z01D/GAE+LDFmexSc9Hb/Aue1qZaL3g8WyMQbVAWEb RZKHjDSTLDS4L6T7ENnKYtWpXCllqojNBUAKHhJYJOxNDIEm9mspvDmcOLwICnllnpmnSUHGQSN mLIaL3uwMt1IEhZdHPd+q90B5A7l6FduSGxFSJFpzr0AtU1gQgCDnMBUFhQrV+QagIHyDqx9T6q seVyPtXDT73XIp5OBsUgoXETMR4F+/TP3R5/lF6sr477HzErUE9E2DDJaKtnjU= X-Google-Smtp-Source: AGHT+IEMM2Dio2c93q3uWmEsWyIMalPHfheUKiss0qaWryad2G+Uxhpappwlr3q+LmfrK6Q/j/vyJw== X-Received: by 2002:a05:6a20:7fa6:b0:1e3:c763:74d4 with SMTP id adf61e73a8af0-1e5c6d6b62dmr8829195637.0.1734668074876; Thu, 19 Dec 2024 20:14:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 40/51] tcg/optimize: Canonicalize s_mask in fold_exts, fold_sextract Date: Thu, 19 Dec 2024 20:10:52 -0800 Message-ID: <20241220041104.53105-41-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734668302314116600 Content-Type: text/plain; charset="utf-8" Simply or'ing the an input s_mask with the mask implied by the sign extension operation may leave disconnected bits to the right. Use smask_from_smask to canonicalize. Signed-off-by: Richard Henderson --- tcg/optimize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index d0a9ea1ee4..8735dc0c9c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1827,6 +1827,7 @@ static bool fold_exts(OptContext *ctx, TCGOp *op) g_assert_not_reached(); } s_mask |=3D sign << 1; + s_mask =3D smask_from_smask(s_mask); =20 if (!type_change && fold_affected_mask(ctx, op, s_mask & ~s_mask_old))= { return true; @@ -2534,8 +2535,13 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) } =20 s_mask_old =3D t1->s_mask; + /* + * Use the sign mask from the input, force the repetitons from + * the sign extension operation, and canonicalize the result. + */ s_mask =3D sextract64(s_mask_old, pos, len); s_mask |=3D MAKE_64BIT_MASK(len, 64 - len); + s_mask =3D smask_from_smask(s_mask); =20 if (pos =3D=3D 0 && fold_affected_mask(ctx, op, s_mask & ~s_mask_old))= { return true; --=20 2.43.0