From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103319 invoked by alias); 13 Oct 2015 11:38:02 -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 103305 invoked by uid 89); 13 Oct 2015 11:38:01 -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: mail2-relais-roc.national.inria.fr Received: from mail2-relais-roc.national.inria.fr (HELO mail2-relais-roc.national.inria.fr) (192.134.164.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 13 Oct 2015 11:38:00 +0000 Received: from nat-eduroam-138-gw-01-sif.saclay.inria.fr (HELO 201-16.eduroam.saclay.inria.fr) ([195.83.213.138]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2015 13:37:57 +0200 Date: Tue, 13 Oct 2015 11:38:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: "Hurugalawadi, Naveen" cc: Richard Biener , "gcc-patches@gcc.gnu.org" Subject: Re: Move some bit and binary optimizations in simplify and match In-Reply-To: Message-ID: References: , 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-10/txt/msg01221.txt.bz2 On Tue, 13 Oct 2015, Hurugalawadi, Naveen wrote: > Please find attached the patch as per your comments. (hmm, maybe you missed the email I sent with other comments?) +(simplify + (plus (convert? @0) (convert? (xdivamulminusa @0 @1))) + (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type)) + && tree_nop_conversion_p (type, TREE_TYPE (@0))) + (trunc_mod (convert @0) (convert @1)))) Is that true when the conversion changes from signed to unsigned? The existing transformation X - (X / Y) * Y appears to be broken as well. (the version in fold-const is hard to trigger because of canonicalization, but it was slightly more general in that it allowed for VECTOR_CST) +/* Fold (a * (1 << b)) into (a << b) */ +(simplify + (mult:c @0 (convert? (lshift integer_onep@1 @2))) + (if (! FLOAT_TYPE_P (type) + && tree_nop_conversion_p (type, TREE_TYPE (@0))) + (lshift @0 (convert @2)))) Wrong test, did you mean TREE_TYPE (@1) maybe? -- Marc Glisse