Following the discussion here:

   http://gcc.gnu.org/ml/gcc/2011-05/msg00216.html

this patch makes -fno-delayed-branch imply -Wa,-O1.  It also makes
sure that we explicitly assemble with -O0 by default.  (Previously,
we'd assemble with -O0 if the user specified -O0, but assemble with
the default -O2 if the user specified no -O option at all.)

Tested on mipsisa64-elf and mips-linux-gnu.  Also tested by
examining the objects produced by -fno-delayed-branch, and by
various other option combinations.  Applied to trunk.

Richard


gcc/
        * config/mips/mips.h (SUBTARGET_ASM_OPTIMIZING_SPEC): Delete.
        (ASM_SPEC): Add a -O* option here.  Pass -O0 for -noasmopt,
        -O1 for -fno-delayed-branch, -O2 if optimization is enabled,
        and -O0 otherwise.
        (EXTRA_SPECS): Remove subtarget_asm_optimizing_spec.

Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h      2011-05-22 22:19:08.000000000 +0100
+++ gcc/config/mips/mips.h      2011-05-22 22:29:17.000000000 +0100
@@ -1079,14 +1079,6 @@ #define NM_FLAGS "-Bn"
 #endif
 
 
-/* SUBTARGET_ASM_OPTIMIZING_SPEC handles passing optimization options
-   to the assembler.  It may be overridden by subtargets.  */
-#ifndef SUBTARGET_ASM_OPTIMIZING_SPEC
-#define SUBTARGET_ASM_OPTIMIZING_SPEC "\
-%{noasmopt:-O0} \
-%{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}}"
-#endif
-
 /* SUBTARGET_ASM_DEBUGGING_SPEC handles passing debugging options to
    the assembler.  It may be overridden by subtargets.
 
@@ -1123,7 +1115,7 @@ #define ASM_SPEC "\
 %{mmt} %{mno-mt} \
 %{mfix-vr4120} %{mfix-vr4130} \
 %{mfix-24k} \
-%(subtarget_asm_optimizing_spec) \
+%{noasmopt:-O0; O0|fno-delayed-branch:-O1; O*:-O2; :-O1} \
 %(subtarget_asm_debugging_spec) \
 %{mabi=*} %{!mabi=*: %(asm_abi_default_spec)} \
 %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
@@ -1181,7 +1173,6 @@ #define CPP_SPEC "%(subtarget_cpp_spec)"
 #define EXTRA_SPECS                                                    \
   { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC },                                
\
   { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC },                                
\
-  { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC },  \
   { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC },    \
   { "subtarget_asm_spec", SUBTARGET_ASM_SPEC },                                
\
   { "asm_abi_default_spec", "-" MULTILIB_ABI_DEFAULT },                        
\

Reply via email to