From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10773 invoked by alias); 25 Aug 2012 05:46:25 -0000 Received: (qmail 10764 invoked by uid 22791); 25 Aug 2012 05:46:24 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_PD X-Spam-Check-By: sourceware.org Received: from mail-we0-f175.google.com (HELO mail-we0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 25 Aug 2012 05:46:10 +0000 Received: by weyr6 with SMTP id r6so1472082wey.20 for ; Fri, 24 Aug 2012 22:46:09 -0700 (PDT) Received: by 10.216.44.3 with SMTP id m3mr3968504web.129.1345873569278; Fri, 24 Aug 2012 22:46:09 -0700 (PDT) Received: from localhost ([2.26.188.227]) by mx.google.com with ESMTPS id cu1sm982104wib.6.2012.08.24.22.46.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Aug 2012 22:46:08 -0700 (PDT) From: Richard Sandiford To: Andrew Pinski Mail-Followup-To: Andrew Pinski ,Sandra Loosemore , gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Cc: Sandra Loosemore , gcc-patches@gcc.gnu.org Subject: Re: [PATCH, MIPS] fix MIPS16 jump table overflow References: <5032EAAA.2070703@codesourcery.com> <87boi456zv.fsf@talisman.home> <50359228.3070308@codesourcery.com> Date: Sat, 25 Aug 2012 05:46:00 -0000 In-Reply-To: (Andrew Pinski's message of "Fri, 24 Aug 2012 22:14:04 -0700") Message-ID: <8762874j8g.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2012-08/txt/msg01725.txt.bz2 Andrew Pinski writes: > On Fri, Aug 24, 2012 at 10:08 PM, Andrew Pinski wrote: >> On Wed, Aug 22, 2012 at 7:15 PM, Sandra Loosemore >> wrote: >>> On 08/21/2012 02:23 PM, Richard Sandiford wrote: >>>> >>>> >>>> Would be nice to add a compile test for -mabi=64 just to make sure >>>> that Pmode == DImode works. A copy of an existing test like >>>> code-readable-1.c would be fine. >>> >>> >>> I'm having problems with this part -- it seems like every combination of >>> options with -mabi=64 I've tried with code-readable-1.c complains about >>> something-or-another being incompatible. The closest I've come is "-mabi=64 >>> -march=mips64 -msoft-float", which is accepted by the mipsisa32r2-sde-elf >> >> Did you test this at all on a mips64-*-* target? After this change >> n64 jump tables are broken. >> Before CASE_VECTOR_MODE was DImode for n64 . >> >> See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54371 for why it fails. >> gpdword produces a double word for n64. >> >> For EABI64 it is ok to load 32bits because that the addresses are >> 32bits but for n64, it is not ok. The load addresses are normally >> above the 32bits boundary. > > I am testing a patch which changes CASE_VECTOR_MODE to be: > #define CASE_VECTOR_MODE ((mips_abi == ABI_64) ? DImode : SImode) I think it should be: #define CASE_VECTOR_MODE \ (TARGET_MIPS16_SHORT_JUMP_TABLES ? SImode : ptr_mode) #define CASE_VECTOR_SHORTEN_MODE(MIN, MAX, BODY) \ (!TARGET_MIPS16_SHORT_JUMP_TABLES ? ptr_mode \ : (MIN) >= -32768 && (MAX) < 32768 : HImode \ : SImode) The point being that the TARGET_MIPS16_SHORT_JUMP_TABLES entries are relative, so SImode would be correct there even for n64. I'd missed that CASE_VECTOR_MODE applied to tablejump as well as casesi, sorry. Richard