From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27041 invoked by alias); 11 Jun 2011 15:59:18 -0000 Received: (qmail 27032 invoked by uid 22791); 11 Jun 2011 15:59:17 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Jun 2011 15:59:03 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 11 Jun 2011 08:59:03 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2011 08:59:03 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id D1EC9C2266; Sat, 11 Jun 2011 08:58:59 -0700 (PDT) Date: Sat, 11 Jun 2011 16:06:00 -0000 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: PATCH [4/n]: Prepare x32: Permute the conversion and addition if one operand is a constant Message-ID: <20110611155859.GA20007@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00917.txt.bz2 Hi, convert_memory_address_addr_space has a special PLUS/MULT case for POINTERS_EXTEND_UNSIGNED < 0. It turns out that it is also needed for all Pmode != ptr_mode cases. OK for trunk? Thanks. H.J. --- 2011-06-11 H.J. Lu PR middle-end/47727 * explow.c (convert_memory_address_addr_space): Permute the conversion and addition if one operand is a constant. diff --git a/gcc/explow.c b/gcc/explow.c index 7387dad..b343bf8 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -383,18 +383,13 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED, case PLUS: case MULT: - /* For addition we can safely permute the conversion and addition - operation if one operand is a constant and converting the constant - does not change it or if one operand is a constant and we are - using a ptr_extend instruction (POINTERS_EXTEND_UNSIGNED < 0). - We can always safely permute them if we are making the address - narrower. */ + /* For addition we safely permute the conversion and addition + operation if one operand is a constant since we can't generate + new instructions. We can always safely permute them if we are + making the address narrower. */ if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode) || (GET_CODE (x) == PLUS - && CONST_INT_P (XEXP (x, 1)) - && (XEXP (x, 1) == convert_memory_address_addr_space - (to_mode, XEXP (x, 1), as) - || POINTERS_EXTEND_UNSIGNED < 0))) + && CONST_INT_P (XEXP (x, 1)))) return gen_rtx_fmt_ee (GET_CODE (x), to_mode, convert_memory_address_addr_space (to_mode, XEXP (x, 0), as),