From patchwork Fri Jun 25 10:43:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 56901 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]) by ozlabs.org (Postfix) with SMTP id 947F2B6F04 for ; Fri, 25 Jun 2010 20:43:21 +1000 (EST) Received: (qmail 8613 invoked by alias); 25 Jun 2010 10:43:20 -0000 Received: (qmail 8603 invoked by uid 22791); 25 Jun 2010 10:43:19 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Jun 2010 10:43:13 +0000 Received: by pwi10 with SMTP id 10so44012pwi.20 for ; Fri, 25 Jun 2010 03:43:08 -0700 (PDT) Received: by 10.114.249.2 with SMTP id w2mr518678wah.85.1277462588031; Fri, 25 Jun 2010 03:43:08 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id d39sm4582514wam.4.2010.06.25.03.43.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 03:43:07 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 86B11170C2A8; Fri, 25 Jun 2010 20:13:01 +0930 (CST) Date: Fri, 25 Jun 2010 20:13:01 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org, David Edelsohn Subject: Re: PowerPC64 large toc model Message-ID: <20100625104301.GI21855@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn References: <20100608125703.GI7312@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100608125703.GI7312@bubble.grove.modra.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes 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 On Tue, Jun 08, 2010 at 10:27:03PM +0930, Alan Modra wrote: > -mcmodel=medium > uses 32-bit toc offsets and addresses static data, string constants > etc. relative to the toc pointer. Limits data to around 2G. We now have the mcmodel=medium optimization in the linker, so there isn't much point in having this in gcc. Patch preapproved by David and committed after bootstrap and regression testing. * doc/invoke.texi: Delete mcmodel=medium from powerpc options. * config/rs6000/rs6000.h (enum rs6000_cmodel): Delete CMODEL_MEDIUM. * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Set CMODEL_LARGE as default. * config/rs6000/rs6000.c (rs6000_handle_option): Remove mcmodel=medium. (offsettable_ok_by_alignment): Delete. (rs6000_emit_move): Remove mcmodel=medium optimization. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 161360) +++ gcc/doc/invoke.texi (working copy) @@ -14987,11 +14987,6 @@ scheduling parameters set by @option{-mt Generate PowerPC64 code for the small model: The TOC is limited to 64k. -@item -mcmodel=medium -@opindex mcmodel=medium -Generate PowerPC64 code for the medium model: The TOC and other static -data may be up to a total of 4G in size. - @item -mcmodel=large @opindex mcmodel=large Generate PowerPC64 code for the large model: The TOC may be up to 4G Index: gcc/config/rs6000/linux64.h =================================================================== --- gcc/config/rs6000/linux64.h (revision 161360) +++ gcc/config/rs6000/linux64.h (working copy) @@ -134,7 +134,7 @@ extern enum rs6000_cmodel cmodel; else \ { \ if (!rs6000_explicit_options.cmodel) \ - SET_CMODEL (CMODEL_MEDIUM); \ + SET_CMODEL (CMODEL_LARGE); \ if (cmodel != CMODEL_SMALL) \ { \ TARGET_NO_FP_IN_TOC = 0; \ Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 161360) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -3653,8 +3653,6 @@ rs6000_handle_option (size_t code, const case OPT_mcmodel_: if (strcmp (arg, "small") == 0) cmodel = CMODEL_SMALL; - else if (strcmp (arg, "medium") == 0) - cmodel = CMODEL_MEDIUM; else if (strcmp (arg, "large") == 0) cmodel = CMODEL_LARGE; else @@ -6636,36 +6634,6 @@ rs6000_eliminate_indexed_memrefs (rtx op copy_addr_to_reg (XEXP (operands[1], 0))); } -/* Return true if memory accesses to DECL are known to never straddle - a 32k boundary. */ - -static bool -offsettable_ok_by_alignment (tree decl) -{ - unsigned HOST_WIDE_INT dsize; - - /* Presume any compiler generated symbol_ref is suitably aligned. */ - if (!decl) - return true; - - if (TREE_CODE (decl) != VAR_DECL - && TREE_CODE (decl) != PARM_DECL - && TREE_CODE (decl) != RESULT_DECL - && TREE_CODE (decl) != FIELD_DECL) - return true; - - if (!host_integerp (DECL_SIZE_UNIT (decl), 1)) - return false; - - dsize = tree_low_cst (DECL_SIZE_UNIT (decl), 1); - if (dsize <= 1) - return true; - if (dsize > 32768) - return false; - - return DECL_ALIGN_UNIT (decl) >= dsize; -} - /* Emit a move from SOURCE to DEST in mode MODE. */ void rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode) @@ -6979,16 +6947,11 @@ rs6000_emit_move (rtx dest, rtx source, /* If this is a SYMBOL_REF that refers to a constant pool entry, and we have put it in the TOC, we just need to make a TOC-relative reference to it. */ - if ((TARGET_TOC - && GET_CODE (operands[1]) == SYMBOL_REF - && constant_pool_expr_p (operands[1]) - && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (operands[1]), - get_pool_mode (operands[1]))) - || (TARGET_CMODEL == CMODEL_MEDIUM - && GET_CODE (operands[1]) == SYMBOL_REF - && !CONSTANT_POOL_ADDRESS_P (operands[1]) - && SYMBOL_REF_LOCAL_P (operands[1]) - && offsettable_ok_by_alignment (SYMBOL_REF_DECL (operands[1])))) + if (TARGET_TOC + && GET_CODE (operands[1]) == SYMBOL_REF + && constant_pool_expr_p (operands[1]) + && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (operands[1]), + get_pool_mode (operands[1]))) { rtx reg = NULL_RTX; if (TARGET_CMODEL != CMODEL_SMALL) Index: gcc/config/rs6000/rs6000.h =================================================================== --- gcc/config/rs6000/rs6000.h (revision 161360) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -295,11 +295,9 @@ extern const char *host_detect_local_cpu /* Code model for 64-bit linux. small: 16-bit toc offsets. - medium: 32-bit toc offsets, static data and code within 2G of TOC pointer. - large: 32-bit toc offsets, no limit on static data and code. */ + large: 32-bit toc offsets. */ enum rs6000_cmodel { CMODEL_SMALL, - CMODEL_MEDIUM, CMODEL_LARGE };