From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58429 invoked by alias); 1 May 2015 18:41:13 -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 58416 invoked by uid 89); 1 May 2015 18:41:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 01 May 2015 18:41:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t41IfAra027083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 1 May 2015 14:41:11 -0400 Received: from localhost.localdomain (ovpn-113-143.phx2.redhat.com [10.3.113.143]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t41IfAx6018314 for ; Fri, 1 May 2015 14:41:10 -0400 Message-ID: <5543C8C6.6000201@redhat.com> Date: Fri, 01 May 2015 18:41:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: Re: More type narrowing in match.pd References: <5541A704.3070502@redhat.com> <55426499.40901@redhat.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00092.txt.bz2 On 04/30/2015 03:38 PM, Marc Glisse wrote: > On Thu, 30 Apr 2015, Jeff Law wrote: > >> On 04/30/2015 01:17 AM, Marc Glisse wrote: >>> >>> +/* This is another case of narrowing, specifically when there's an >>> outer >>> + BIT_AND_EXPR which masks off bits outside the type of the innermost >>> + operands. Like the previous case we have to convert the operands >>> + to unsigned types to avoid introducing undefined behaviour for the >>> + arithmetic operation. */ >>> +(for op (minus plus) >>> >>> No mult? or widen_mult with a different pattern? (maybe that's already >>> done elsewhere) >> No mult. When I worked on the pattern for 47477, supporting mult >> clearly regressed the generated code -- presumably because we can >> often widen the operands for free. > > It would help with the testcase below, but I am willing to accept that > the cases where it hurts are more common (and guessing if it will help > or hurt may be hard), while with +- the cases that help are more common. > > void f(short*a) { > a = __builtin_assume_aligned(a,128); > for (int i = 0; i < (1<<22); ++i) { > #ifdef EASY > a[i] *= a[i]; > #else > int x = a[i]; > x *= x; > a[i] = x; > #endif > } > } Thanks. I've filed a bug and attached it the operand shortening/narrowing BZ (65964). I strongly suspect there's other bugs in BZ that need to be attached to 65964. jeff