From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77145 invoked by alias); 14 Oct 2015 10:09:10 -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 77131 invoked by uid 89); 14 Oct 2015 10:09:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f195.google.com Received: from mail-yk0-f195.google.com (HELO mail-yk0-f195.google.com) (209.85.160.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 14 Oct 2015 10:09:08 +0000 Received: by ykcg132 with SMTP id g132so3681920ykc.2 for ; Wed, 14 Oct 2015 03:09:06 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.129.76.151 with SMTP id z145mr1269656ywa.263.1444817346438; Wed, 14 Oct 2015 03:09:06 -0700 (PDT) Received: by 10.37.117.136 with HTTP; Wed, 14 Oct 2015 03:09:06 -0700 (PDT) In-Reply-To: References: Date: Wed, 14 Oct 2015 10:09:00 -0000 Message-ID: Subject: Re: Move some bit and binary optimizations in simplify and match From: Richard Biener To: GCC Patches Cc: "Hurugalawadi, Naveen" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg01334.txt.bz2 On Wed, Oct 14, 2015 at 7:39 AM, Marc Glisse wrote: > > +(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)))) > > See PR 67953. Please drop xdivamulminusa. It was a bad idea of mine, just add two patterns. > +(match (abitandnotb @0 @1) > + (bit_and:c @0 (bit_not INTEGER_CST@1))) > > Does that work? No. Please drop these helpers and instead duplicate the patterns. > > +/* 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. Indeed you don't need the convert on @2. Richard. > > -- > Marc Glisse