public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Paolo Carlini <paolo.carlini@oracle.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>, Jason Merrill <jason@redhat.com>
Subject: Re: Why is __i686 undefined for x86_64 -m32 (in mainline)
Date: Tue, 16 Mar 2010 20:53:00 -0000	[thread overview]
Message-ID: <6dc9ffc81003161340o721cd497w5a63fb6ff9c24b0e@mail.gmail.com> (raw)
In-Reply-To: <4B9FE683.2080903@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

On Tue, Mar 16, 2010 at 1:13 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> On 03/16/2010 08:53 PM, H.J. Lu wrote:
>> The question is what processor macros should "-march=x86-64" define. There
>> is
>>
>>       {"x86-64", PROCESSOR_K8, CPU_K8,
>>         PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_NO_SAHF},
>>
>> For -march=x86-64, __k8 is defined.  However, real K8 supports:
>>
>>       {"k8", PROCESSOR_K8, CPU_K8,
>>         PTA_64BIT | PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE
>>         | PTA_SSE2 | PTA_NO_SAHF},
>>
>> It isn't an issue in i386.c since PROCESSOR_K8 isn't used to check
>> ISAs. But using __k8 to check ISAs is a problem.
>>
> I'm not sure to follow the gory details of your reply, but to me, it
> seems *really* strange that *now*, on x86_64, "-m32" is not the same as
> "-m32 -march=-i686" as far as __i686 is concerned...
>

We never defined __i686 for -m32 by default on x86_64. Here is
a patch to define __i686 for -m32 if the processor supports it.

-- 
H.J.

[-- Attachment #2: gcc-isa-1.patch --]
[-- Type: text/plain, Size: 1959 bytes --]

2010-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386-c.c (ix86_target_macros_internal): Define
	__i686/__i686__ for PROCESSOR_K8, PROCESSOR_AMDFAM10,
	PROCESSOR_PENTIUM4, PROCESSOR_NOCONA, PROCESSOR_CORE2 and
	PROCESSOR_ATOM.

diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index 35eab49..f6dad14 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -100,26 +100,53 @@ ix86_target_macros_internal (int isa_flag,
 	def_or_undef (parse_in, "__athlon_sse__");
       break;
     case PROCESSOR_K8:
+      if (!TARGET_64BIT)
+	{
+	  def_or_undef (parse_in, "__i686");
+	  def_or_undef (parse_in, "__i686__");
+	}
       def_or_undef (parse_in, "__k8");
       def_or_undef (parse_in, "__k8__");
       break;
     case PROCESSOR_AMDFAM10:
+      if (!TARGET_64BIT)
+	{
+	  def_or_undef (parse_in, "__i686");
+	  def_or_undef (parse_in, "__i686__");
+	}
       def_or_undef (parse_in, "__amdfam10");
       def_or_undef (parse_in, "__amdfam10__");
       break;
     case PROCESSOR_PENTIUM4:
+      def_or_undef (parse_in, "__i686");
+      def_or_undef (parse_in, "__i686__");
       def_or_undef (parse_in, "__pentium4");
       def_or_undef (parse_in, "__pentium4__");
       break;
     case PROCESSOR_NOCONA:
+      if (!TARGET_64BIT)
+	{
+	  def_or_undef (parse_in, "__i686");
+	  def_or_undef (parse_in, "__i686__");
+	}
       def_or_undef (parse_in, "__nocona");
       def_or_undef (parse_in, "__nocona__");
       break;
     case PROCESSOR_CORE2:
+      if (!TARGET_64BIT)
+	{
+	  def_or_undef (parse_in, "__i686");
+	  def_or_undef (parse_in, "__i686__");
+	}
       def_or_undef (parse_in, "__core2");
       def_or_undef (parse_in, "__core2__");
       break;
     case PROCESSOR_ATOM:
+      if (!TARGET_64BIT)
+	{
+	  def_or_undef (parse_in, "__i686");
+	  def_or_undef (parse_in, "__i686__");
+	}
       def_or_undef (parse_in, "__atom");
       def_or_undef (parse_in, "__atom__");
       break;

  reply	other threads:[~2010-03-16 20:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4B9FDCC1.2080201@oracle.com>
2010-03-16 20:00 ` H.J. Lu
2010-03-16 20:40   ` Paolo Carlini
2010-03-16 20:53     ` H.J. Lu [this message]
2010-03-16 20:58       ` Paolo Carlini
2010-03-16 21:03         ` Jakub Jelinek
2010-03-16 21:06           ` Paolo Carlini
2010-03-16 21:06             ` H.J. Lu
2010-03-16 21:08               ` H.J. Lu
2010-03-16 21:15           ` H.J. Lu
2010-03-16 21:21             ` Paolo Carlini
2010-03-16 21:31               ` H.J. Lu
2010-03-16 21:34                 ` Paolo Carlini
2010-03-16 21:36                   ` H.J. Lu
2010-03-16 22:27                     ` Paolo Carlini
2010-03-16 22:32                       ` H.J. Lu
2010-03-16 22:36                         ` Paolo Carlini
2010-03-16 22:39                           ` H.J. Lu
2010-03-16 22:57                             ` Paolo Carlini
2010-03-16 23:11                               ` H.J. Lu
2010-03-17  3:27                                 ` Paolo Carlini
2010-03-16 19:53 Paolo Carlini

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=6dc9ffc81003161340o721cd497w5a63fb6ff9c24b0e@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=paolo.carlini@oracle.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).