public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org,  echristo@apple.com
Subject: Re: Use Enum for MIPS -march=, -mtune=, -mips options
Date: Mon, 23 May 2011 02:19:00 -0000	[thread overview]
Message-ID: <87pqna4eft.fsf@firetop.home> (raw)
In-Reply-To: <Pine.LNX.4.64.1105062030580.12332@digraph.polyomino.org.uk>	(Joseph S. Myers's message of "Fri, 6 May 2011 20:31:45 +0000 (UTC)")

"Joseph S. Myers" <joseph@codesourcery.com> writes:
> The processing of MIPS_CPU_STRING_DEFAULT is replaced by much simpler
> use of strcmp to find a matching entry; the "from-abi" default
> definition of that macro is replaced by code in mips_default_arch if
> that macro is not defined.  (Previously it would always have been
> defined, so the previous fallback for it being undefined was dead
> code.)

For the record, the fallback really was needed.  The "from-abi" default
came from:

> -/* 'from-abi' makes a good default: you get whatever the ABI requires.  */
> -#ifndef MIPS_ISA_DEFAULT
> -#ifndef MIPS_CPU_STRING_DEFAULT
> -#define MIPS_CPU_STRING_DEFAULT "from-abi"
> -#endif
> -#endif

so it was only used if both MIPS_CPU_STRING_DEFAULT and
MIPS_ISA_DEFAULT were undefined.  The default was tested here:

> -#ifdef MIPS_CPU_STRING_DEFAULT
> -      mips_set_architecture (mips_parse_cpu (MIPS_CPU_STRING_DEFAULT));
> -#else
> -      mips_set_architecture (mips_cpu_info_from_isa (MIPS_ISA_DEFAULT));
> -#endif

So the patch had the effect of ignoring MIPS_ISA_DEFAULT.  This showed
up on mipsisa64-elf, where crt0.S was assembled as MIPS I rather than
MIPS64.

I've applied the fix below.  Tested on mipsisa64-elf and mips-linux-gnu.

Richard


gcc/
	* config/mips/mips.c (mips_default_arch): Honor MIPS_ISA_DEFAULT.

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2011-05-22 22:19:08.000000000 +0100
+++ gcc/config/mips/mips.c	2011-05-22 22:20:47.000000000 +0100
@@ -15239,12 +15239,14 @@ mips_cpu_info_from_opt (int opt)
 static const struct mips_cpu_info *
 mips_default_arch (void)
 {
-#ifdef MIPS_CPU_STRING_DEFAULT
+#if defined (MIPS_CPU_STRING_DEFAULT)
   unsigned int i;
   for (i = 0; i < ARRAY_SIZE (mips_cpu_info_table); i++)
     if (strcmp (mips_cpu_info_table[i].name, MIPS_CPU_STRING_DEFAULT) == 0)
       return mips_cpu_info_table + i;
   gcc_unreachable ();
+#elif defined (MIPS_ISA_DEFAULT)
+  return mips_cpu_info_from_isa (MIPS_ISA_DEFAULT);
 #else
   /* 'from-abi' makes a good default: you get whatever the ABI
      requires.  */

      parent reply	other threads:[~2011-05-22 21:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 20:54 Joseph S. Myers
     [not found] ` <E2C18237-88ED-4F1C-8606-D876C7B92728@apple.com>
     [not found]   ` <g439kp19y1.fsf@googlemail.com>
2011-05-10 11:25     ` Richard Sandiford
2011-05-23  2:19 ` Richard Sandiford [this message]

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=87pqna4eft.fsf@firetop.home \
    --to=rdsandiford@googlemail.com \
    --cc=echristo@apple.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@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).