From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116064 invoked by alias); 27 May 2017 07:48:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115966 invoked by uid 89); 27 May 2017 07:48:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=56PM, 56pm X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 27 May 2017 07:48:39 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F31845AFED; Sat, 27 May 2017 07:48:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F31845AFED Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F31845AFED Received: from tucnak.zalov.cz (unknown [10.36.118.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 825D35DD71; Sat, 27 May 2017 07:48:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v4R7mMs4028765; Sat, 27 May 2017 09:48:22 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v4R7mLc9028764; Sat, 27 May 2017 09:48:21 +0200 Date: Sat, 27 May 2017 08:30:00 -0000 From: Jakub Jelinek To: Marc Glisse Cc: gcc-patches@gcc.gnu.org Subject: Re: Allow some NOP conversions in (X+CST1)+CST2 in match.pd Message-ID: <20170527074820.GA24023@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg02094.txt.bz2 On Sun, May 21, 2017 at 09:22:56PM +0200, Marc Glisse wrote: > generalizing a bit one transformation, to avoid a regression with another > patch I am working on. Handling conversions always gets messy :-( It would > have been easier to stick to scalars and wide_int, but since the existing > transformation handles vectors, I didn't want to regress. > > Bootstrap+testsuite on powerpc64le-unknown-linux-gnu. > > 2017-05-22 Marc Glisse > > gcc/ > * match.pd ((A +- CST1) +- CST2): Allow some conversions. > * tree.c (drop_tree_overflow): Handle COMPLEX_CST and VECTOR_CST. > > gcc/testsuite/ > * gcc.dg/tree-ssa/addadd.c: New file. After discussions in PR80887, I've reverted the match.pd part and xfailed the test, because it breaks bootstrap and will take a while to resolve properly. 2017-05-27 Jakub Jelinek PR bootstrap/80887 Revert: 2017-05-25 Marc Glisse * match.pd ((A +- CST1) +- CST2): Allow some conversions. * gcc.dg/tree-ssa/addadd.c: Xfail all scan-tree-dump*. --- gcc/match.pd (revision 248448) +++ gcc/match.pd (revision 248447) @@ -1299,39 +1299,15 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* (A +- CST1) +- CST2 -> A + CST3 */ (for outer_op (plus minus) (for inner_op (plus minus) - neg_inner_op (minus plus) (simplify - (outer_op (convert? (inner_op @0 CONSTANT_CLASS_P@1)) CONSTANT_CLASS_P@2) - (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) - /* If one of the types wraps, use that one. */ - (if (!ANY_INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_WRAPS (type)) - (if (outer_op == PLUS_EXPR) - (plus (convert @0) (inner_op @2 (convert @1))) - (minus (convert @0) (neg_inner_op @2 (convert @1)))) - (if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) - || TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) - (if (outer_op == PLUS_EXPR) - (convert (plus @0 (inner_op (convert @2) @1))) - (convert (minus @0 (neg_inner_op (convert @2) @1)))) - /* If the constant operation overflows we cannot do the transform - directly as we would introduce undefined overflow, for example - with (a - 1) + INT_MIN. */ - (if (types_match (type, @0)) - (with { tree cst = const_binop (outer_op == inner_op - ? PLUS_EXPR : MINUS_EXPR, - type, @1, @2); } - (if (cst && !TREE_OVERFLOW (cst)) - (inner_op @0 { cst; } ) - /* X+INT_MAX+1 is X-INT_MIN. */ - (if (INTEGRAL_TYPE_P (type) && cst - && wi::eq_p (cst, wi::min_value (type))) - (neg_inner_op @0 { wide_int_to_tree (type, cst); }) - /* Last resort, use some unsigned type. */ - (with { tree utype = unsigned_type_for (type); } - (convert (inner_op - (convert:utype @0) - (convert:utype - { drop_tree_overflow (cst); })))))))))))))) + (outer_op (inner_op @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2) + /* If the constant operation overflows we cannot do the transform + as we would introduce undefined overflow, for example + with (a - 1) + INT_MIN. */ + (with { tree cst = const_binop (outer_op == inner_op + ? PLUS_EXPR : MINUS_EXPR, type, @1, @2); } + (if (cst && !TREE_OVERFLOW (cst)) + (inner_op @0 { cst; } )))))) /* (CST1 - A) +- CST2 -> CST3 - A */ (for outer_op (plus minus) --- gcc/testsuite/gcc.dg/tree-ssa/addadd.c (revision 248532) +++ gcc/testsuite/gcc.dg/tree-ssa/addadd.c (working copy) @@ -29,6 +29,6 @@ void j(S*x){ *x += __INT_MAX__; } -/* { dg-final { scan-tree-dump-times " \\+ 24;" 2 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 2 "optimized" } } */ -/* { dg-final { scan-tree-dump-not "2147483647" "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\+ 24;" 2 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 2 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-not "2147483647" "optimized" { xfail *-*-* } } } */ Jakub