From patchwork Thu Feb 12 08:34:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 439113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AC19C140151 for ; Thu, 12 Feb 2015 19:35:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=ax60aw5gMdtJ2zEvK 2Bokq+jRaPk8QBWp13mRu0INjPhx0E1hJhbqt2+n8rem0N9zXK9lK2KnBReg9Tfc yzqrP8vdx3DvWVDaSBo4yc5OvKi7n/vgYyMycKf43IGEXXA+6NSaTgEWS2pT+rnU TCNt4ahHg2dzJr1WPp+pJD5llc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=b6ltRQUFC5nMemoh/EtOUcA 0upA=; b=iDFTngBPH6rmSswJY6iBLuOKJEs/gL8GiK/4cmvkTIpJxHWrpp1GuNH wuTn7HkS5lJdMr5jWVG2ebbsTdKs5dnkCuFKBzYprEeKc0hf3Eom2vrwsY2K27lX RH3BAdP/Wv2hPcPalAg6L2Lr2z5gSqnXDR8RoVmzPW9bl14+4a8g= Received: (qmail 8123 invoked by alias); 12 Feb 2015 08:35:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 8111 invoked by uid 89); 12 Feb 2015 08:35:00 -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, FREEMAIL_FROM, FREEMAIL_REPLY, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f171.google.com Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 12 Feb 2015 08:34:59 +0000 Received: by pdjy10 with SMTP id y10so10486998pdj.6 for ; Thu, 12 Feb 2015 00:34:57 -0800 (PST) X-Received: by 10.70.54.69 with SMTP id h5mr4386057pdp.37.1423730097613; Thu, 12 Feb 2015 00:34:57 -0800 (PST) Received: from bubble.grove.modra.org ([58.160.155.134]) by mx.google.com with ESMTPSA id dx6sm3060939pab.14.2015.02.12.00.34.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Feb 2015 00:34:56 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id EE6F4EA3759; Thu, 12 Feb 2015 19:04:50 +1030 (ACDT) Date: Thu, 12 Feb 2015 19:04:50 +1030 From: Alan Modra To: Jeff Law Cc: Thomas Preud'homme , 'Andrew Pinski' , Eric Botcazou , GCC Patches Subject: Re: [PATCH 1/2, combine] Try REG_EQUAL for nonzero_bits Message-ID: <20150212083449.GM4274@bubble.grove.modra.org> Mail-Followup-To: Jeff Law , Thomas Preud'homme , 'Andrew Pinski' , Eric Botcazou , GCC Patches References: <00f001d044d4$23f37e20$6bda7a60$@arm.com> <00f201d044d8$0131ccd0$03956670$@arm.com> <54DAF0CD.9030701@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <54DAF0CD.9030701@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Tue, Feb 10, 2015 at 11:03:57PM -0700, Jeff Law wrote: > On 02/09/15 19:19, Thomas Preud'homme wrote: > >>From: Andrew Pinski [mailto:pinskia@gmail.com] > >>Sent: Tuesday, February 10, 2015 9:57 AM > > > >>>+#ifdef SHORT_IMMEDIATES_SIGN_EXTEND > >>>+/* If MODE has a precision lower than PREC and SRC is a non-negative > >>constant > >>>+ that would appear negative in MODE, sign-extend SRC for use in > >>nonzero_bits > >>>+ because some machines (maybe most) will actually do the sign- > >>extension and > >>>+ this is the conservative approach. > >>>+ > >>>+ ??? For 2.5, try to tighten up the MD files in this regard instead of > >>this > >>>+ kludge. */ > >> > >>I don't know if this has been mentioned and even though you are just > >>copying a comment from below but would it make sense to look fixing > >>what the comment says we should look at after GCC 2.5 (which was over > >>20 years ago)? Or maybe just remove the comment if it no longer > >>applies. > > > >Actually this bit seems unnecessary as there is already some logic in > >nonzero_bits1 for the CONST_INT case. So I guess the code can be > >removed and the comment be moved there at the very least but > >I'd prefer people from one of the affected target to test it. I can tell you that the following doesn't trigger on an --enable-targets=all,go powerpc64-linux bootstrap. (Ada not built due to lack of gnat on the machine I used.) So for powerpc it looks like the combine SHORT_IMMEDIATES_SIGN_EXTEND code can disappear. The rtlanal.c occurrence *is* executed. Index: gcc/combine.c =================================================================== --- gcc/combine.c (revision 220611) +++ gcc/combine.c (working copy) @@ -1742,7 +1742,7 @@ set_nonzero_bits_and_sign_copies (rtx x, const_rtx && CONST_INT_P (src) && INTVAL (src) > 0 && val_signbit_known_set_p (GET_MODE (x), INTVAL (src))) - src = GEN_INT (INTVAL (src) | ~GET_MODE_MASK (GET_MODE (x))); + gcc_unreachable (); #endif /* Don't call nonzero_bits if it cannot change anything. */ @@ -9802,7 +9802,7 @@ reg_nonzero_bits_for_combine (const_rtx x, machine && CONST_INT_P (tem) && INTVAL (tem) > 0 && val_signbit_known_set_p (GET_MODE (x), INTVAL (tem))) - tem = GEN_INT (INTVAL (tem) | ~GET_MODE_MASK (GET_MODE (x))); + gcc_unreachable (); #endif return tem; }