diff mbox

Recognize -Ofast like -ffast-math for crtfastmath.o

Message ID Pine.LNX.4.64.1105041526450.1989@wotan.suse.de
State New
Headers show

Commit Message

Michael Matz May 4, 2011, 1:58 p.m. UTC
Hi,

-Ofast is intended to be -O3 plus -ffast-math.  For the compiler proper 
this works, but under -ffast-math we add crtfastmath.o (or some 
equivalent) to the link command line on some targets.  As usual for our 
specs this uses matching on command line arguments, hence we'll 
explicitely have to add Ofast.

All these targets use the same idiom, so I hope it's okay if I'm testing 
only x86_64-linux (regstrapping in progress there).  CCed the respective 
target maintainers.  I wouldn't have anything against a global reviewer 
just acking the whole thing :)


Ciao,
Michael.

	* config/alpha/elf.h (ENDFILE_SPEC): Add Ofast.
	* config/alpha/osf5.h (ENDFILE_SPEC): Add Ofast.
	* config/alpha/netbsd.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/linux.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/sp64-elf.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/sp-elf.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/linux64.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/freebsd.h (ENDFILE_SPEC): Add Ofast.
	* config/sparc/sol2.h (ENDFILE_SPEC): Add Ofast.
	* config/i386/cygwin.h (ENDFILE_SPEC): Add Ofast.
	* config/i386/gnu-user.h (ENDFILE_SPEC): Add Ofast.
	* config/i386/gnu-user64.h (ENDFILE_SPEC): Add Ofast.
	* config/i386/darwin.h (ENDFILE_SPEC): Add Ofast.
	* config/i386/mingw32.h (ENDFILE_SPEC): Add Ofast.
	* config/ia64/linux.h (ENDFILE_SPEC): Add Ofast.
	* config/mips/linux.h (ENDFILE_SPEC): Add Ofast.

Comments

Rainer Orth May 4, 2011, 2:22 p.m. UTC | #1
Hi Michael,

> -Ofast is intended to be -O3 plus -ffast-math.  For the compiler proper 
> this works, but under -ffast-math we add crtfastmath.o (or some 
> equivalent) to the link command line on some targets.  As usual for our 
> specs this uses matching on command line arguments, hence we'll 
> explicitely have to add Ofast.
>
> All these targets use the same idiom, so I hope it's okay if I'm testing 
> only x86_64-linux (regstrapping in progress there).  CCed the respective 
> target maintainers.  I wouldn't have anything against a global reviewer 
> just acking the whole thing :)

I had noticed that duplication before.  Rather than continue down that
road, I'd rather have us introduce a new spec for this issue.

Thanks.
	Rainer
Richard Biener May 4, 2011, 4:10 p.m. UTC | #2
On Wed, May 4, 2011 at 4:22 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> Hi Michael,
>
>> -Ofast is intended to be -O3 plus -ffast-math.  For the compiler proper
>> this works, but under -ffast-math we add crtfastmath.o (or some
>> equivalent) to the link command line on some targets.  As usual for our
>> specs this uses matching on command line arguments, hence we'll
>> explicitely have to add Ofast.
>>
>> All these targets use the same idiom, so I hope it's okay if I'm testing
>> only x86_64-linux (regstrapping in progress there).  CCed the respective
>> target maintainers.  I wouldn't have anything against a global reviewer
>> just acking the whole thing :)
>
> I had noticed that duplication before.  Rather than continue down that
> road, I'd rather have us introduce a new spec for this issue.

This can be done separately.  Note the patch also applies to the 4.6
branch where -Ofast was introduced.

Thus, ok for trunk and the branch.

Thanks,
Richard.
diff mbox

Patch

Index: config/alpha/elf.h
===================================================================
--- config/alpha/elf.h	(revision 173309)
+++ config/alpha/elf.h	(working copy)
@@ -397,7 +397,7 @@  do {									\
 
 #undef	ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
 /* Select a format to encode pointers in exception handling data.  CODE
Index: config/alpha/osf5.h
===================================================================
--- config/alpha/osf5.h	(revision 173309)
+++ config/alpha/osf5.h	(working copy)
@@ -102,7 +102,7 @@  along with GCC; see the file COPYING3.
   "%{!shared:%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}"
 
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
 
Index: config/alpha/netbsd.h
===================================================================
--- config/alpha/netbsd.h	(revision 173309)
+++ config/alpha/netbsd.h	(working copy)
@@ -70,7 +70,7 @@  along with GCC; see the file COPYING3.
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC		\
-  "%{ffast-math|funsafe-math-optimizations:crtfm%O%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfm%O%s} \
    %(netbsd_endfile_spec)"
 
 
Index: config/sparc/linux.h
===================================================================
--- config/sparc/linux.h	(revision 173309)
+++ config/sparc/linux.h	(working copy)
@@ -37,7 +37,7 @@  along with GCC; see the file COPYING3.
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
-   %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+   %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 /* This is for -profile to use -lc_p instead of -lc.  */
 #undef	CC1_SPEC
Index: config/sparc/sp64-elf.h
===================================================================
--- config/sparc/sp64-elf.h	(revision 173309)
+++ config/sparc/sp64-elf.h	(working copy)
@@ -60,7 +60,7 @@  crtbegin.o%s \
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    crtend.o%s"
 
 /* Use the default (for now).  */
Index: config/sparc/sp-elf.h
===================================================================
--- config/sparc/sp-elf.h	(revision 173309)
+++ config/sparc/sp-elf.h	(working copy)
@@ -35,7 +35,7 @@  along with GCC; see the file COPYING3.
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    crtend.o%s crtn.o%s"
 
 /* Don't set the target flags, this is done by the linker script */
Index: config/sparc/linux64.h
===================================================================
--- config/sparc/linux64.h	(revision 173309)
+++ config/sparc/linux64.h	(working copy)
@@ -59,7 +59,7 @@  along with GCC; see the file COPYING3.
 #undef	ENDFILE_SPEC
 #define ENDFILE_SPEC \
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
-   %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
+   %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
 
 /* The default code model.  */
 #undef SPARC_DEFAULT_CMODEL
Index: config/sparc/freebsd.h
===================================================================
--- config/sparc/freebsd.h	(revision 173309)
+++ config/sparc/freebsd.h	(working copy)
@@ -166,7 +166,7 @@  along with GCC; see the file COPYING3.
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC						\
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "	\
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} "	\
   FBSD_ENDFILE_SPEC
 
 /* We use GNU ld so undefine this so that attribute((init_priority)) works.  */
Index: config/sparc/sol2.h
===================================================================
--- config/sparc/sol2.h	(revision 173309)
+++ config/sparc/sol2.h	(working copy)
@@ -119,7 +119,7 @@  along with GCC; see the file COPYING3.
 
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    crtend.o%s crtn.o%s"
 
 /* Select a format to encode pointers in exception handling data.  CODE
Index: config/i386/cygwin.h
===================================================================
--- config/i386/cygwin.h	(revision 173309)
+++ config/i386/cygwin.h	(working copy)
@@ -36,7 +36,7 @@  along with GCC; see the file COPYING3.
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}\
    crtend.o%s"
 
 /* Normally, -lgcc is not needed since everything in it is in the DLL, but we
Index: config/i386/gnu-user.h
===================================================================
--- config/i386/gnu-user.h	(revision 173309)
+++ config/i386/gnu-user.h	(working copy)
@@ -108,7 +108,7 @@  along with GCC; see the file COPYING3.
 /* Similar to standard GNU userspace, but adding -ffast-math support.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{mpc32:crtprec32.o%s} \
    %{mpc64:crtprec64.o%s} \
    %{mpc80:crtprec80.o%s} \
Index: config/i386/gnu-user64.h
===================================================================
--- config/i386/gnu-user64.h	(revision 173309)
+++ config/i386/gnu-user64.h	(working copy)
@@ -81,7 +81,7 @@  see the files COPYING3 and COPYING.RUNTI
 /* Similar to standard GNU userspace, but adding -ffast-math support.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{mpc32:crtprec32.o%s} \
    %{mpc64:crtprec64.o%s} \
    %{mpc80:crtprec80.o%s} \
Index: config/i386/darwin.h
===================================================================
--- config/i386/darwin.h	(revision 173309)
+++ config/i386/darwin.h	(working copy)
@@ -129,7 +129,7 @@  extern int darwin_emit_branch_islands;
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{mpc32:crtprec32.o%s} \
    %{mpc64:crtprec64.o%s} \
    %{mpc80:crtprec80.o%s}"
Index: config/i386/mingw32.h
===================================================================
--- config/i386/mingw32.h	(revision 173309)
+++ config/i386/mingw32.h	(working copy)
@@ -143,7 +143,7 @@  along with GCC; see the file COPYING3.
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
   crtend.o%s"
 
 /* Override startfile prefix defaults.  */
Index: config/ia64/linux.h
===================================================================
--- config/ia64/linux.h	(revision 173309)
+++ config/ia64/linux.h	(working copy)
@@ -50,7 +50,7 @@  do {						\
 /* Similar to standard Linux, but adding -ffast-math support.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
 /* Define this for shared library support because it isn't in the main
Index: config/mips/linux.h
===================================================================
--- config/mips/linux.h	(revision 173309)
+++ config/mips/linux.h	(working copy)
@@ -140,5 +140,5 @@  extern const char *host_detect_local_cpu
 /* Similar to standard Linux, but adding -ffast-math support.  */
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+  "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"