From patchwork Sun Nov 12 20:25:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 164286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp853903vqg; Sun, 12 Nov 2023 12:27:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf/TUoFZiXP7GiFFkv8SGhz9A8bQ6OYKez4StoOHlvjmfSVjIlRxo7PuG7J4AbZJCEjhcM X-Received: by 2002:a05:6871:7282:b0:1f4:d43a:b349 with SMTP id mm2-20020a056871728200b001f4d43ab349mr5724946oac.59.1699820824927; Sun, 12 Nov 2023 12:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699820824; cv=pass; d=google.com; s=arc-20160816; b=ZStwpMaogE7qCCwhwwVap5cJLKMkQXzu+DSIFKgzuA6o9X75QefPoZjQG0lFEsVQA+ 6JBVewt50s+dXwz2pruNcDh3l/No+Zhj9OlGoX7TA/LWWScn5Qxc8RT0BacWLxKQ2et3 iD6xq6tijCDkQBXzQ+D6Z+fT0FJFfP4rBQcl7fSJpHYjfUzfDe7FRinx6IihvJ9fhmLG 5GnI7VQXGVwFHd9oK6xShkNzp24kbCC6TsUIEvWSXEZosoFS5m7TgzNb01ptrXrcrCFY UiUAiPPefFwh2y6wVfpLt2R/W9GkL3PX0FfanwuTVHx31xWpIpjDOHe/3g7skePANOON 3ehg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=VWKKy4h49iLUl0xw+6FcEiPAXhcqPYp/1xbZRBlt3ls=; fh=FeokIcqdWoZa/O0huI8voTL2MjElDP7Q+Msw2wH5YQM=; b=Q9ojlz/4n8UiXzPVhky2BJgvs3/6EB9ewFadijp++HvmhMrEIL91CmePUVLtL64WEl GfaiV6b2QnLZzlwQxrgSR4T+DbdA8KDe85fxCzk2MqnWoxuS1V3o4u9ZMFaWZ6gNjzYW Lh4HdTYMFfQ7C3Z5rAlCxBGnGarBNBpLOkVLJCqTwpPfk+c0Ihm/Q5/rkWbrwFPA54WO CYOiHtKNF9skjBitn6OebGPYaGwPC4OlhsP5H+Foex9q3LJXjbpHj5cCw8oPVL0LE0rP iWgL8clw5ii/Ew8tFEzPbD9GOATG2wGed/cQ1u/h+ORMeoFia4Dfnrjq/W52GqWc8g9d x9cA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b="DFa7uE/I"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dv6-20020a05620a1b8600b007788cced177si3472985qkb.524.2023.11.12.12.27.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 12:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b="DFa7uE/I"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B17573858D32 for ; Sun, 12 Nov 2023 20:27:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 135C03858D37; Sun, 12 Nov 2023 20:26:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 135C03858D37 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 135C03858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699820796; cv=none; b=anAC2OnxJ+/rE7iBbsdc+xQhqZQ9LtK9ZEx+PkziWoMmDfi25X9DMETYUYGoGHEok6FkH5KMy3sEVgbvVKtPOVJ3VMv22ljNEfTX64BXVpcywpl9VdOcJBsK3rc8bvw1i63/0Vrw+RpVzdFlNXTeMpXfAHKZzGHT8VLxDN7BSAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699820796; c=relaxed/simple; bh=6eqOhLnRT3oLwCdYGq6A/bd0jQPG9XWcKPbbOLBc170=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=npV7tKmAqlLYsXR7LcXMsF1h0LFT+qzS4Tb9p0qfEoKexWW0qDuexaPmPXjDZA99g6FIAIMlnYZS1p6ogCKsnLJA907pl58M7kJ/G1TEYC8VWoUZo+LXJmnt08BIKy1oo3qJw5xiz4or5mlY2SXueBxD+3lq7y9/FGYdliUxcBo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1699820791; bh=6eqOhLnRT3oLwCdYGq6A/bd0jQPG9XWcKPbbOLBc170=; h=From:To:Cc:Subject:Date:From; b=DFa7uE/Ib9OfJ+rOakMRysHpIiZARCmKfEuWExtVagw/QtG0vy2ED9FI3sEAaRxAl NvsrIoYKVx5gsoxojezNbydhT7yVKVwBMMqxlmN2aJNo+7D3tJRZgB4DzkGTlqgW/F k8W59yJ8ryg4L7fXmrILdENJxo/cPvYTwjSbrJYg= Received: from stargazer.. (unknown [IPv6:240e:358:11b3:9500:dc73:854d:832e:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id CCDAF66A03; Sun, 12 Nov 2023 15:26:27 -0500 (EST) From: Xi Ruoyao To: gcc-patches@gcc.gnu.org Cc: chenglulu , i@xen0n.name, xuchenghua@loongson.cn, Tamar Christina , tschwinge@gcc.gnu.org, Roger Sayle , Xi Ruoyao Subject: [PATCH] Fix (fcopysign x, NEGATIVE_CONST) -> (fneg (fabs x)) simplification [PR112483] Date: Mon, 13 Nov 2023 04:25:26 +0800 Message-ID: <20231112202603.228074-2-xry111@xry111.site> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782391321414083884 X-GMAIL-MSGID: 1782391321414083884 (fcopysign x, NEGATIVE_CONST) can be simplified to (fneg (fabs x)), but a logic error in the code caused it mistakenly simplified to (fneg x) instead. gcc/ChangeLog: PR rtl-optimization/112483 * simplify-rtx.cc (simplify_binary_operation_1) : Fix the simplification of (fcopysign x, NEGATIVE_CONST). --- Bootstrapped and regtested on loongarch64-linux-gnu and x86_64-linux-gnu. Ok for trunk? gcc/simplify-rtx.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 69d87579d9c..2d2e5a3c1ca 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -4392,7 +4392,7 @@ simplify_ashift: real_convert (&f1, mode, CONST_DOUBLE_REAL_VALUE (trueop1)); rtx tmp = simplify_gen_unary (ABS, mode, op0, mode); if (REAL_VALUE_NEGATIVE (f1)) - tmp = simplify_gen_unary (NEG, mode, op0, mode); + tmp = simplify_gen_unary (NEG, mode, tmp, mode); return tmp; } if (GET_CODE (op0) == NEG || GET_CODE (op0) == ABS)