From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1080 invoked by alias); 25 Nov 2009 00:49:24 -0000 Received: (qmail 1068 invoked by uid 22791); 25 Nov 2009 00:49:22 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_05 X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Nov 2009 00:49:19 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id C34034FA3; Tue, 24 Nov 2009 19:49:16 -0500 (EST) Subject: Re: [committed] Shorten non PIC PA 1.1 calls on hppa-hpux To: dave@hiauly1.hia.nrc.ca (John David Anglin) Date: Wed, 25 Nov 2009 03:28:00 -0000 From: "John David Anglin" Cc: gcc-patches@gcc.gnu.org In-Reply-To: from "John David Anglin" at Mar 11, 2008 07:47:45 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20091125004916.C34034FA3@hiauly1.hia.nrc.ca> 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: 2009-11/txt/msg01385.txt.bz2 > The enclosed change shortens long PA 1.x calls when not generating PIC > code. In this case, we can just use space register sr4 for the be and > bel branch instructions, avoiding two instructions to load the space > register of the call destination. This is always a stub in the current > space. Sigh, I was wrong about there always being a stub in the current space. With the above change, we get an ICE building the current trunk. The attached patch revises the change to only use the sr4 short form when the call target binds local. The problem affects 32-bit hppa*-*-hpux*. Current change was tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11, trunk and 4.4 branches with no regressions. Committed to trunk and 4.4. Dave -- J. David Anglin dave.anglin@nrc-cnrc.gc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6602) 2009-11-24 John David Anglin * pa.c (output_call): Only use sr4 for long interspace calls if call binds local and generating non PIC code. (attr_length_call): Adjust length calculation for above. Index: config/pa/pa.c =================================================================== --- config/pa/pa.c (revision 152888) +++ config/pa/pa.c (working copy) @@ -7437,7 +7437,7 @@ { length += 20; - if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS && flag_pic) + if (!TARGET_PA_20 && !TARGET_NO_SPACE_REGS && (!local_call || flag_pic)) length += 8; } @@ -7457,7 +7457,7 @@ if (!sibcall) length += 8; - if (!TARGET_NO_SPACE_REGS && flag_pic) + if (!TARGET_NO_SPACE_REGS && (!local_call || flag_pic)) length += 8; } } @@ -7654,7 +7654,7 @@ if (!sibcall && !TARGET_PA_20) { output_asm_insn ("{bl|b,l} .+8,%%r2", xoperands); - if (TARGET_NO_SPACE_REGS) + if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic)) output_asm_insn ("addi 8,%%r2,%%r2", xoperands); else output_asm_insn ("addi 16,%%r2,%%r2", xoperands); @@ -7679,20 +7679,20 @@ } else { - if (!TARGET_NO_SPACE_REGS && flag_pic) + if (!TARGET_NO_SPACE_REGS && (!local_call || flag_pic)) output_asm_insn ("ldsid (%%r1),%%r31\n\tmtsp %%r31,%%sr0", xoperands); if (sibcall) { - if (TARGET_NO_SPACE_REGS || !flag_pic) + if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic)) output_asm_insn ("be 0(%%sr4,%%r1)", xoperands); else output_asm_insn ("be 0(%%sr0,%%r1)", xoperands); } else { - if (TARGET_NO_SPACE_REGS || !flag_pic) + if (TARGET_NO_SPACE_REGS || (local_call && !flag_pic)) output_asm_insn ("ble 0(%%sr4,%%r1)", xoperands); else output_asm_insn ("ble 0(%%sr0,%%r1)", xoperands);