public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Andrew Pinski <pinskia@gmail.com>
Cc: Sandra Loosemore <sandra@codesourcery.com>,  gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, MIPS] fix MIPS16 jump table overflow
Date: Sat, 25 Aug 2012 05:46:00 -0000	[thread overview]
Message-ID: <8762874j8g.fsf@talisman.home> (raw)
In-Reply-To: <CA+=Sn1k5CECpNtgzuZjV29=tvoUyLzK+zsdMA68xRezbUH4yWQ@mail.gmail.com>	(Andrew Pinski's message of "Fri, 24 Aug 2012 22:14:04 -0700")

Andrew Pinski <pinskia@gmail.com> writes:
> On Fri, Aug 24, 2012 at 10:08 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>> On Wed, Aug 22, 2012 at 7:15 PM, Sandra Loosemore
>> <sandra@codesourcery.com> 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

  reply	other threads:[~2012-08-25  5:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  1:56 Sandra Loosemore
2012-08-21 20:24 ` Richard Sandiford
2012-08-23  2:15   ` Sandra Loosemore
2012-08-23  6:43     ` Richard Sandiford
2012-08-23 20:44     ` Richard Sandiford
2012-08-25  5:08     ` Andrew Pinski
2012-08-25  5:14       ` Andrew Pinski
2012-08-25  5:46         ` Richard Sandiford [this message]
2012-08-25  5:56           ` Andrew Pinski
2012-08-25 15:52           ` Sandra Loosemore
2012-08-25 21:31             ` Andrew Pinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8762874j8g.fsf@talisman.home \
    --to=rdsandiford@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=sandra@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).