From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24338 invoked by alias); 11 Nov 2008 15:31:12 -0000 Received: (qmail 24309 invoked by uid 22791); 11 Nov 2008 15:31:10 -0000 X-Spam-Check-By: sourceware.org Received: from gv-out-0910.google.com (HELO gv-out-0910.google.com) (216.239.58.190) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Nov 2008 15:30:34 +0000 Received: by gv-out-0910.google.com with SMTP id i36so272541gve.10 for ; Tue, 11 Nov 2008 07:30:30 -0800 (PST) Received: by 10.103.178.17 with SMTP id f17mr4595066mup.45.1226417430710; Tue, 11 Nov 2008 07:30:30 -0800 (PST) Received: by 10.103.131.14 with HTTP; Tue, 11 Nov 2008 07:30:30 -0800 (PST) Message-ID: <84fc9c000811110730n2b5a29b7o7198c41f0c70d66d@mail.gmail.com> Date: Tue, 11 Nov 2008 15:32:00 -0000 From: "Richard Guenther" To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: Re: PR 37363 follow-on 1: avoid gen_rtx_CONST call in cse.c:fold_rtx In-Reply-To: <87fxlzma7t.fsf@firetop.home> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <87fxlzma7t.fsf@firetop.home> X-IsSubscribed: yes 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 X-SW-Source: 2008-11/txt/msg00428.txt.bz2 On Mon, Nov 10, 2008 at 5:29 PM, Richard Sandiford wrote: > Although this patch isn't strictly necessary to fix PR 37363, the > comment suggests that we might in future create (const (minus ...))s > in fold_rtx. Since we don't want to do that, I'd like to apply this > patch at the same time as the main one. > > The code I'm removing should be dead: simplify_unary_operation should > already know when the result can be treated as a CONST. > > Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested > by comparing the before and after assembly output for: > > gcc.c-torture gcc.dg g++.dg > > on these targets: > > powerpc-darwin powerpc64-darwin i386-darwin x86_64-darwin > powerpc-linux-gnu powerpc64-linux-gnu powerpc-ibm-aix5.3.0 > > using the options "-O2 -fpic". The output was the same. > OK to install? Ok. Thanks, Richard. > Richard > > > gcc/ > * cse.c (fold_rtx): Remove redundant gen_rtx_CONST. > > Index: gcc/cse.c > =================================================================== > --- gcc/cse.c 2008-11-10 23:00:17.000000000 +0000 > +++ gcc/cse.c 2008-11-10 23:11:30.000000000 +0000 > @@ -3171,33 +3171,15 @@ fold_rtx (rtx x, rtx insn) > { > case RTX_UNARY: > { > - int is_const = 0; > - > /* We can't simplify extension ops unless we know the > original mode. */ > if ((code == ZERO_EXTEND || code == SIGN_EXTEND) > && mode_arg0 == VOIDmode) > break; > > - /* If we had a CONST, strip it off and put it back later if we > - fold. */ > - if (const_arg0 != 0 && GET_CODE (const_arg0) == CONST) > - is_const = 1, const_arg0 = XEXP (const_arg0, 0); > - > new_rtx = simplify_unary_operation (code, mode, > const_arg0 ? const_arg0 : folded_arg0, > mode_arg0); > - /* NEG of PLUS could be converted into MINUS, but that causes > - expressions of the form > - (CONST (MINUS (CONST_INT) (SYMBOL_REF))) > - which many ports mistakenly treat as LEGITIMATE_CONSTANT_P. > - FIXME: those ports should be fixed. */ > - if (new_rtx != 0 && is_const > - && GET_CODE (new_rtx) == PLUS > - && (GET_CODE (XEXP (new_rtx, 0)) == SYMBOL_REF > - || GET_CODE (XEXP (new_rtx, 0)) == LABEL_REF) > - && GET_CODE (XEXP (new_rtx, 1)) == CONST_INT) > - new_rtx = gen_rtx_CONST (mode, new_rtx); > } > break; > >