From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 9365A3858426; Mon, 14 Nov 2022 13:35:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9365A3858426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668432917; bh=s7xOgWyBDVzoSmCIJhnesf1LDK2OBPBSMn2uugHyPxk=; h=From:To:Subject:Date:From; b=KoejN2USj4YM8oiaqYO80beOTPdw/Hfq3gvpxLhgiramCCURg7G2nh2zlsCn+OupY jCVQ9yn58py7R9YVAdpJCUhgT0ywHDESnFoAPigjQv2toH1614VqHA51l4SO2Tym9a z7S3Q7HvBgfCBBu02Vt9OQldbfbtM0mY4J86FKLI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4004] remove duplicate match.pd patterns X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 04e2fd20d3d5fce2c99c856361d5f3d3ce955906 X-Git-Newrev: cf716ab562c1e0549e0632b1c92059932f8b899a Message-Id: <20221114133517.9365A3858426@sourceware.org> Date: Mon, 14 Nov 2022 13:35:17 +0000 (GMT) List-Id: https://gcc.gnu.org/g:cf716ab562c1e0549e0632b1c92059932f8b899a commit r13-4004-gcf716ab562c1e0549e0632b1c92059932f8b899a Author: Richard Biener Date: Mon Nov 14 14:33:43 2022 +0100 remove duplicate match.pd patterns The following merges match.pd patterns that cause genmatch complaints about duplicates when in-order isn't enforced (you have to edit genmatch.cc to do a full duplicate check). * match.pd: Remove duplicates. Diff: --- gcc/match.pd | 63 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 194ba8f5188..4d0898ccdcb 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1285,8 +1285,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* ~x | x -> -1 */ /* ~x ^ x -> -1 */ -/* ~x + x -> -1 */ -(for op (bit_ior bit_xor plus) +(for op (bit_ior bit_xor) (simplify (op:c (convert? @0) (convert? (bit_not @0))) (convert { build_all_ones_cst (TREE_TYPE (@0)); }))) @@ -2939,9 +2938,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* ~A + A -> -1 */ (simplify - (plus:c (bit_not @0) @0) + (plus:c (convert? (bit_not @0)) (convert? @0)) (if (!TYPE_OVERFLOW_TRAPS (type)) - { build_all_ones_cst (type); })) + (convert { build_all_ones_cst (TREE_TYPE (@0)); }))) /* ~A + 1 -> -A */ (simplify @@ -5103,34 +5102,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (scmp @0 (bit_not @1))))) (for cmp (simple_comparison) - /* Fold (double)float1 CMP (double)float2 into float1 CMP float2. */ - (simplify - (cmp (convert@2 @0) (convert? @1)) - (if (FLOAT_TYPE_P (TREE_TYPE (@0)) - && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2)) - == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0))) - && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@2)) - == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@1)))) - (with - { - tree type1 = TREE_TYPE (@1); - if (TREE_CODE (@1) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1)) - { - REAL_VALUE_TYPE orig = TREE_REAL_CST (@1); - if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node) - && exact_real_truncate (TYPE_MODE (float_type_node), &orig)) - type1 = float_type_node; - if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node) - && exact_real_truncate (TYPE_MODE (double_type_node), &orig)) - type1 = double_type_node; - } - tree newtype - = (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type1) - ? TREE_TYPE (@0) : type1); - } - (if (TYPE_PRECISION (TREE_TYPE (@2)) > TYPE_PRECISION (newtype)) - (cmp (convert:newtype @0) (convert:newtype @1)))))) - (simplify (cmp @0 REAL_CST@1) /* IEEE doesn't distinguish +0 and -0 in comparisons. */ @@ -5683,7 +5654,33 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (cmp == LT_EXPR || cmp == LE_EXPR) { constant_boolean_node (above ? true : false, type); } (if (cmp == GT_EXPR || cmp == GE_EXPR) - { constant_boolean_node (above ? false : true, type); })))))))))))) + { constant_boolean_node (above ? false : true, type); }))))))))) + /* Fold (double)float1 CMP (double)float2 into float1 CMP float2. */ + (if (FLOAT_TYPE_P (TREE_TYPE (@00)) + && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0)) + == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@00))) + && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@0)) + == DECIMAL_FLOAT_TYPE_P (TREE_TYPE (@10)))) + (with + { + tree type1 = TREE_TYPE (@10); + if (TREE_CODE (@10) == REAL_CST && !DECIMAL_FLOAT_TYPE_P (type1)) + { + REAL_VALUE_TYPE orig = TREE_REAL_CST (@10); + if (TYPE_PRECISION (type1) > TYPE_PRECISION (float_type_node) + && exact_real_truncate (TYPE_MODE (float_type_node), &orig)) + type1 = float_type_node; + if (TYPE_PRECISION (type1) > TYPE_PRECISION (double_type_node) + && exact_real_truncate (TYPE_MODE (double_type_node), &orig)) + type1 = double_type_node; + } + tree newtype + = (TYPE_PRECISION (TREE_TYPE (@00)) > TYPE_PRECISION (type1) + ? TREE_TYPE (@00) : type1); + } + (if (TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (newtype)) + (cmp (convert:newtype @00) (convert:newtype @10)))))))) + (for cmp (eq ne) (simplify