From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124735 invoked by alias); 14 Oct 2015 10:45:35 -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 124725 invoked by uid 89); 14 Oct 2015 10:45:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,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; Wed, 14 Oct 2015 10:45:33 +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; 14 Oct 2015 12:45:30 +0200 Date: Wed, 14 Oct 2015 10:45:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: Richard Biener cc: GCC Patches , "Hurugalawadi, Naveen" 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/msg01336.txt.bz2 On Wed, 14 Oct 2015, Richard Biener wrote: >> +/* 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 (@2))) >> + (lshift @0 (convert @2)))) >> >> You don't need/want to convert @2 (fold-const doesn't convert, does it?), >> and you don't need to check for tree_nop_conversion_p. > > I think for long x and x * (long)(1u << b) you need to do because the > result for b == 33 would be different. - that check should be with TREE_TYPE (@1) - 1u << 33 is undefined, isn't it? x * (int)(1ul << b), which for b=33 should yield 0, would give the undefined x << b so some check does seem needed indeed. -- Marc Glisse