From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119964 invoked by alias); 13 Jun 2015 10:41:00 -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 119954 invoked by uid 89); 13 Jun 2015 10:40:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 13 Jun 2015 10:40:58 +0000 Received: from afontenayssb-151-1-16-171.w82-121.abo.wanadoo.fr (HELO laptop-mg.local) ([82.121.222.171]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Jun 2015 12:40:54 +0200 Date: Sat, 13 Jun 2015 10:46:00 -0000 From: Marc Glisse To: Marek Polacek cc: Richard Biener , Jakub Jelinek , GCC Patches Subject: Re: match.pd: Optimize (x & y) ^ (x | y) In-Reply-To: <20150612090204.GF2756@redhat.com> Message-ID: References: <20150611110432.GY2756@redhat.com> <20150611110905.GW10247@tucnak.redhat.com> <20150611120246.GZ2756@redhat.com> <20150612090204.GF2756@redhat.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-SW-Source: 2015-06/txt/msg00963.txt.bz2 On Fri, 12 Jun 2015, Marek Polacek wrote: >>>> fold-const.c traditionally avoided the combinatorial explosion by using >>>> strip_nops. >>> >>> Yeah. We can probably special case conditional conversions in code >>> generation instead of lowering it. And then go the full way and special >>> case nop conversions so you can avoid writing the predicate as well. >> >> Without special casing, I currently have: >> >> (match (nopcvt @0) >> (convert? @0) >> (if (tree_nop_conversion_p (type, TREE_TYPE (@0))))) >> (simplify >> (bit_xor:c (convert1? (bit_and@2 (nopcvt @0) (nopcvt @1))) >> (convert2? (bit_ior:c (nopcvt @0) (nopcvt @1)))) >> (if (tree_nop_conversion_p (type, TREE_TYPE (@2))) This could use @0 instead of @2 to save 2 characters. >> (bit_xor (convert @0) (convert @1)))) >> >> which simplifies Jakub's testcase without exploding the size of *-match.c, >> but it is still not very satisfying. > > Yeah, imagine if we'd have to change every pattern like that :-(. I am not sure that we will be able to completely avoid it. Nop conversions can be ignored in some places, but not everywhere, so we have to be explicit about it. We could make a nice short notation, say bit_and# to switch whether there is an implicit strip_nops or not, and pick the default that applies to most patterns. We would still need a way to access the unstripped version of @2 (@#2 maybe?). And we would still need the 'convert' in the output pattern, unless we teach genmatch to add nop conversions in many places, which sounds complicated. -- Marc Glisse