From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26107 invoked by alias); 24 Jun 2011 14:18:00 -0000 Received: (qmail 26095 invoked by uid 22791); 24 Jun 2011 14:18:00 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KAM_ADVERT2,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qw0-f47.google.com (HELO mail-qw0-f47.google.com) (209.85.216.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 24 Jun 2011 14:17:45 +0000 Received: by qwh5 with SMTP id 5so1576626qwh.20 for ; Fri, 24 Jun 2011 07:17:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.79.196 with SMTP id q4mr2067912qck.132.1308925062791; Fri, 24 Jun 2011 07:17:42 -0700 (PDT) Received: by 10.229.238.19 with HTTP; Fri, 24 Jun 2011 07:17:42 -0700 (PDT) In-Reply-To: <201106241607.51611.ebotcazou@adacore.com> References: <20110622193657.GA8942@intel.com> <201106241058.42211.ebotcazou@adacore.com> <201106241607.51611.ebotcazou@adacore.com> Date: Fri, 24 Jun 2011 14:38:00 -0000 Message-ID: Subject: Re: PATCH: PR rtl-optimization/49504: Invalid optimization for Pmode != ptr_mode From: "H.J. Lu" To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2011-06/txt/msg01877.txt.bz2 On Fri, Jun 24, 2011 at 7:07 AM, Eric Botcazou wrot= e: >> I compared x32 glibc built with the old x32 gcc against x32 glibc built >> with this patch and >> >> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00913.html >> >> reverted, the new glibc is little smaller: >> >> New: >> >> [hjl@gnu-33 build-x86_64-linux]$ size libc.so >> =A0 =A0text =A0 =A0 =A0 =A0 =A0data =A0 =A0 bss =A0 =A0 dec =A0 =A0 hex = filename >> 1537648 =A0 =A0 =A0 =A0 10076 =A0 12944 1560668 =A017d05c libc.so >> [hjl@gnu-33 build-x86_64-linux]$ >> >> Old: >> >> [hjl@gnu-33 build-x86_64-linux.old]$ size libc.so >> =A0 =A0text =A0 =A0 =A0 =A0 =A0data =A0 =A0 bss =A0 =A0 dec =A0 =A0 hex = filename >> 1538968 =A0 =A0 =A0 =A0 10076 =A0 12944 1561988 =A017d584 libc.so >> [hjl@gnu-33 build-x86_64-linux.old]$ >> >> I looked at assembly codes. =A0The new one is better. >> I will check it in. > > OK, but remove the equivalent code in num_sign_bit_copies1 then, otherwise > someone in a couple of years from now will adapt it to nonzero_bits1 and = we > will be back to square one. > I am testing this patch on x32 branch. I will compare glibc binaries befor= e and after. Thanks. --=20 H.J. --- diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index e5c045d..0be6504 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -4605,21 +4605,6 @@ num_sign_bit_copies1 (const_rtx x, enum machine_mode mode, const_rtx known_x, known_x, known_mode, known_ret); result =3D MAX (1, MIN (num0, num1) - 1); -#ifdef POINTERS_EXTEND_UNSIGNED - /* If pointers extend signed and this is an addition or subtraction - to a pointer in Pmode, all the bits above ptr_mode are known to be - sign bit copies. */ - /* As we do not know which address space the pointer is refering to, - we can do this only if the target does not support different pointer - or address modes depending on the address space. */ - if (target_default_pointer_address_modes_p () - && ! POINTERS_EXTEND_UNSIGNED && GET_MODE (x) =3D=3D Pmode - && (code =3D=3D PLUS || code =3D=3D MINUS) - && REG_P (XEXP (x, 0)) && REG_POINTER (XEXP (x, 0))) - result =3D MAX ((int) (GET_MODE_BITSIZE (Pmode) - - GET_MODE_BITSIZE (ptr_mode) + 1), - result); -#endif return result; case MULT: