This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Default x86-darwin to -mfpmath=sse, and update -arch settings


This patch does two things:

- It merges in a patch from Apple's tree to use 'i386' for -arch
  instead of 'i686'.  (The people responsible for the previous setting
  changed their mind.)

- It makes darwin use SSE fpmath by default.  I've made this a
  convenient macro because I expect that other platforms might want
  this in the future.

These have a common motivation, which is that Darwin only runs on a
pentium-m and higher, and earlier chips are not really supported.

Bootstrapped & tested on i386-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-x86darwincpus.patch===================
2005-04-11  Geoffrey Keating  <geoffk@apple.com>

	* config/i386/i386.h (TARGET_FPMATH_DEFAULT): New.
	* config/i386/darwin.h (TARGET_FPMATH_DEFAULT): New.
	* config/i386/i386.c (override_options): Use TARGET_FPMATH_DEFAULT.

	* config/i386/darwin.h (ASM_SPEC): Use -arch i386 not -arch i686.
	(SUBTARGET_EXTRA_SPECS): Always 'i386'.

Index: config/i386/darwin.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/darwin.h,v
retrieving revision 1.24
diff -u -p -u -p -r1.24 darwin.h
--- config/i386/darwin.h	24 Mar 2005 19:50:56 -0000	1.24
+++ config/i386/darwin.h	12 Apr 2005 01:38:01 -0000
@@ -1,5 +1,5 @@
 /* Target definitions for x86 running Darwin.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
 This file is part of GCC.
@@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA.  */
 
 #define TARGET_VERSION fprintf (stderr, " (i686 Darwin)");
 
+#undef TARGET_FPMATH_DEFAULT
+#define TARGET_FPMATH_DEFAULT (TARGET_SSE ? FPMATH_SSE : FPMATH_387)
+
 #define TARGET_OS_CPP_BUILTINS()                \
   do                                            \
     {                                           \
@@ -43,13 +46,12 @@ Boston, MA 02111-1307, USA.  */
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}"
 
 #undef ASM_SPEC
-#define ASM_SPEC "-arch i686 -force_cpusubtype_ALL"
+#define ASM_SPEC "-arch i386 -force_cpusubtype_ALL"
 
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS					\
-  { "darwin_arch", "i686" },					\
-  { "darwin_subarch", "%{march=pentium3:pentIIm3;:i686}" },
-   
+  { "darwin_arch", "i386" },					\
+  { "darwin_subarch", "i386" },
 
 /* Use the following macro for any Darwin/x86-specific command-line option
    translation.  */
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.807
diff -u -p -u -p -r1.807 i386.c
--- config/i386/i386.c	9 Apr 2005 17:19:48 -0000	1.807
+++ config/i386/i386.c	12 Apr 2005 01:38:01 -0000
@@ -1516,19 +1516,17 @@ override_options (void)
       target_flags
 	|= ((MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE)
 	    & ~target_flags_explicit);
-
-      if (TARGET_SSE)
-	ix86_fpmath = FPMATH_SSE;
      }
   else
     {
-      ix86_fpmath = FPMATH_387;
       /* i386 ABI does not specify red zone.  It still makes sense to use it
          when programmer takes care to stack from being destroyed.  */
       if (!(target_flags_explicit & MASK_NO_RED_ZONE))
         target_flags |= MASK_NO_RED_ZONE;
     }
 
+  ix86_fpmath = TARGET_FPMATH_DEFAULT;
+
   if (ix86_fpmath_string != 0)
     {
       if (! strcmp (ix86_fpmath_string, "387"))
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.426
diff -u -p -u -p -r1.426 i386.h
--- config/i386/i386.h	5 Apr 2005 22:52:57 -0000	1.426
+++ config/i386/i386.h	12 Apr 2005 01:38:02 -0000
@@ -104,6 +104,11 @@ extern int target_flags;
 #endif
 #endif
 
+#ifndef TARGET_FPMATH_DEFAULT
+#define TARGET_FPMATH_DEFAULT \
+  (TARGET_64BIT && TARGET_SSE ? FPMATH_SSE : FPMATH_387)
+#endif
+
 /* Masks for the -m switches */
 #define MASK_80387		0x00000001	/* Hardware floating point */
 #define MASK_RTD		0x00000002	/* Use ret that pops args */
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]