From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id A19553858D3C for ; Tue, 12 Sep 2023 22:10:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A19553858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38CKfXOH024911 for ; Tue, 12 Sep 2023 15:10:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=CGDQ1wjjJO9XyRXArXBGBck8Sa11drDu95mFjXzsFrM=; b=TpI4XXAvohJhTefKp9nJGjvYwmRMqatoXCPTuxRuuUwDDmOh7Bdz80yQCFCrBhHkkOU5 c0/3nFNkmUxmnDOA1w6Z9/ecs1UfGylHIOUF2IBBb8jVkNcep7svsAarZvxQ8T6/lQSu K8GzpDY2Gr5ZnIMMKpIAZB4ckJ3KH6kKch15eMucyhClRYRrLsPvCWIwjid6GxFM423Y 7FnNt1XI8bX9H00U1bRU+fh/sXlDZlp3Xh/SlzLW29lgLIHSfy71/V2RQqT2gJGfmWGm 3TII1nTo6wJAlAjBW23IMOctbMyEBElfsjc52KRF5rtdpSY6a9Ip1d79X/WLqlLD+c/i ig== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t2y860a71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 12 Sep 2023 15:10:24 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 12 Sep 2023 15:10:22 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 12 Sep 2023 15:10:22 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id AE7173F70F2; Tue, 12 Sep 2023 15:10:21 -0700 (PDT) From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] MATCH: Simplify `(X % Y) < Y` pattern. Date: Tue, 12 Sep 2023 15:10:13 -0700 Message-ID: <20230912221013.1456582-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: -NWxRbBfxBnmuvrW-wiZ7Ix8gVRf3a3b X-Proofpoint-GUID: -NWxRbBfxBnmuvrW-wiZ7Ix8gVRf3a3b X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-12_21,2023-09-05_01,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This merges the two patterns to catch `(X % Y) < Y` and `Y > (X % Y)` into one by using :c on the comparison operator. It does not change any code generation nor anything else. It is more to allow for better maintainability of this pattern. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * match.pd (`Y > (X % Y)`): Merge into ... (`(X % Y) < Y`): Pattern by adding `:c` on the comparison. --- gcc/match.pd | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 39c7ea1088f..24fd29863fb 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1483,14 +1483,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* X % Y is smaller than Y. */ (for cmp (lt ge) (simplify - (cmp (trunc_mod @0 @1) @1) + (cmp:c (trunc_mod @0 @1) @1) (if (TYPE_UNSIGNED (TREE_TYPE (@0))) { constant_boolean_node (cmp == LT_EXPR, type); }))) -(for cmp (gt le) - (simplify - (cmp @1 (trunc_mod @0 @1)) - (if (TYPE_UNSIGNED (TREE_TYPE (@0))) - { constant_boolean_node (cmp == GT_EXPR, type); }))) /* x | ~0 -> ~0 */ (simplify -- 2.31.1