]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RS6000] Make assembler command line cpu match default for gcc
authorAlan Modra <amodra@gmail.com>
Sun, 28 Jul 2019 09:26:13 +0000 (18:56 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Sun, 28 Jul 2019 09:26:13 +0000 (18:56 +0930)
When gcc is configured using --with-cpu=<cpu>, the specified cpu
effectively becomes a default -mcpu=<cpu> passed to gcc.  This then
affects the cpu passed to gas via ASM_CPU_SPEC.  If gcc is not
configured using --with-cpu then the cpu passed to gas is that given
by ASM_DEFAULT_SPEC, which currently does not match the default flags
selected in default64.h.  This patch makes ASM_DEFAULT_SPEC agree with
TARGET_DEFAULT flags.

rs6000/default64.h appears in three places in config.gcc, the first
one immediately followed by rs6000/freebsd64.h in $tm_file, and the
other two immediately followed by rs6000/linux64.h.  To be able to
define ASM_DEFAULT_SPEC in rs6000/default64.h we don't want to
redefine in the other two files.  rs6000/freebsd64.h is easy since
that file is always preceded by rs6000/default64.h, but
rs6000/linux64.h can appear without rs6000/default64.h (a
powerpc*-linux config where the default is -m32).  In that case we
will have TARGET_DEFAULT flags of 0 (from rs6000/sysv4.h) and want to
use -mppc without -m64 and -mppc64 with -m64.  This can be done by
using the rs6000/rtems.h ASM_DEFAULT_SPEC in rs6000/sysv4.h, a change
that won't affect sysv4 configurations where -m64 is invalid.

The patch also introduces ASM_DEFAULT_EXTRA for the altivec variant
targets so as to enable -maltivec by default.

PR target/91050
* config/rs6000/sysv4.h (ASM_DEFAULT_SPEC): Modify if -m64.
* config/rs6000/default64.h (ASM_DEFAULT_SPEC): Define.
* config/rs6000/freebsd64.h (ASM_DEFAULT_SPEC): Don't define.
* config/rs6000/linux64.h (ASM_DEFAULT_SPEC): Likewise.
* config/rs6000/rtems.h (ASM_DEFAULT_SPEC): Likewise.
* config/rs6000/rs6000.h (ASM_DEFAULT_EXTRA): Define and use
in asm_default spec.
* config/rs6000/eabialtivec.h (ASM_DEFAULT_EXTRA): Redefine.
* config/rs6000/linuxaltivec.h (ASM_DEFAULT_EXTRA): Redefine.

From-SVN: r273853

gcc/ChangeLog
gcc/config/rs6000/default64.h
gcc/config/rs6000/eabialtivec.h
gcc/config/rs6000/freebsd64.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/linuxaltivec.h
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/rtems.h
gcc/config/rs6000/sysv4.h

index 9239cad2504dee563212a04ecacdaaf2f7700992..d005cd965bac0153e374696109c208d5de43cc84 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-28  Alan Modra  <amodra@gmail.com>
+
+       PR target/91050
+       * config/rs6000/sysv4.h (ASM_DEFAULT_SPEC): Modify if -m64.
+       * config/rs6000/default64.h (ASM_DEFAULT_SPEC): Define.
+       * config/rs6000/freebsd64.h (ASM_DEFAULT_SPEC): Don't define.
+       * config/rs6000/linux64.h (ASM_DEFAULT_SPEC): Likewise.
+       * config/rs6000/rtems.h (ASM_DEFAULT_SPEC): Likewise.
+       * config/rs6000/rs6000.h (ASM_DEFAULT_EXTRA): Define and use
+       in asm_default spec.
+       * config/rs6000/eabialtivec.h (ASM_DEFAULT_EXTRA): Redefine.
+       * config/rs6000/linuxaltivec.h (ASM_DEFAULT_EXTRA): Redefine.
+
 2019-07-28  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/include/gpl_v3.texi (Copying): Use https for www.gnu.org.
index 0cceefefa7b71c1a35eb7bdc5f4f79e21695da2e..10743fee796bf425543fa1fecd444b236d4c8c60 100644 (file)
@@ -25,7 +25,11 @@ along with GCC; see the file COPYING3.  If not see
 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT (ISA_2_7_MASKS_SERVER | MASK_POWERPC64 | MASK_64BIT | MASK_LITTLE_ENDIAN)
+#undef ASM_DEFAULT_SPEC
+#define ASM_DEFAULT_SPEC "-mpower8"
 #else
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64 | MASK_64BIT)
+#undef ASM_DEFAULT_SPEC
+#define ASM_DEFAULT_SPEC "-mpower4"
 #endif
index 6a95f90bbc4e8594d088d28472839a22da89c772..6daa92264ea5c540a2b059137a15d8471f6018af 100644 (file)
@@ -23,5 +23,8 @@
 #undef  TARGET_DEFAULT
 #define TARGET_DEFAULT (MASK_EABI | MASK_ALTIVEC)
 
+#undef ASM_DEFAULT_EXTRA
+#define        ASM_DEFAULT_EXTRA " %{!mvsx:%{!maltivec:%{!no-maltivec:-maltivec}}}"
+
 #undef  SUBSUBTARGET_OVERRIDE_OPTIONS
 #define SUBSUBTARGET_OVERRIDE_OPTIONS  rs6000_altivec_abi = 1
index 7e819d102f982b4363cc1a6f07ed7635702a8c86..4951275c9635c2eecca83f02f6d484398c2c2b5b 100644 (file)
@@ -134,11 +134,9 @@ extern int dot_symbols;
     }                                                          \
   while (0)
 
-#undef ASM_DEFAULT_SPEC
 #undef ASM_SPEC
 #undef LINK_OS_FREEBSD_SPEC
 
-#define        ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
 #define        ASM_SPEC         "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
 #define        LINK_OS_FREEBSD_SPEC "%{m32:%(link_os_freebsd_spec32)}%{!m32:%(link_os_freebsd_spec64)}"
 
index bd197492cc2bc48570e807ef0be7150c0930827a..ba5f640efc84a81cdba9d4e4a219c106ed88441b 100644 (file)
@@ -181,24 +181,20 @@ extern int dot_symbols;
     }                                                          \
   while (0)
 
-#undef ASM_DEFAULT_SPEC
 #undef ASM_SPEC
 #undef LINK_OS_LINUX_SPEC
 #undef LINK_SECURE_PLT_SPEC
 
 #ifndef        RS6000_BI_ARCH
-#define        ASM_DEFAULT_SPEC "-mppc64"
 #define        ASM_SPEC         "%(asm_spec64) %(asm_spec_common)"
 #define        LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
 #define        LINK_SECURE_PLT_SPEC ""
 #else
 #if DEFAULT_ARCH64_P
-#define        ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
 #define        ASM_SPEC         "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
 #define        LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
 #define        LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
 #else
-#define        ASM_DEFAULT_SPEC "-mppc%{m64:64}"
 #define        ASM_SPEC         "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
 #define        LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
 #define        LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
index 0f3e24f1041bb36e8b35bfbe46c6d763b8d1e313..8578f42763a963f44a40d90095cc0302ebdb14a0 100644 (file)
@@ -28,5 +28,8 @@
 #define        TARGET_DEFAULT MASK_ALTIVEC
 #endif
 
+#undef ASM_DEFAULT_EXTRA
+#define        ASM_DEFAULT_EXTRA " %{!mvsx:%{!maltivec:%{!mno-altivec:-maltivec}}}"
+
 #undef  SUBSUBTARGET_OVERRIDE_OPTIONS
 #define SUBSUBTARGET_OVERRIDE_OPTIONS rs6000_altivec_abi = 1
index 70e0616ee85e7d4d0d22bead431af641ced466a2..6c24b48a9abeca4587702d43e4db207dce773657 100644 (file)
@@ -157,6 +157,7 @@ ASM_OPT_ANY
 #define CPP_DEFAULT_SPEC ""
 
 #define ASM_DEFAULT_SPEC ""
+#define ASM_DEFAULT_EXTRA ""
 
 /* This macro defines names of additional specifications to put in the specs
    that can be used in various specifications like CC1_SPEC.  Its definition
@@ -174,7 +175,7 @@ ASM_OPT_ANY
   { "cpp_default",             CPP_DEFAULT_SPEC },                     \
   { "asm_cpu",                 ASM_CPU_SPEC },                         \
   { "asm_cpu_native",          ASM_CPU_NATIVE_SPEC },                  \
-  { "asm_default",             ASM_DEFAULT_SPEC },                     \
+  { "asm_default",             ASM_DEFAULT_SPEC ASM_DEFAULT_EXTRA },   \
   { "cc1_cpu",                 CC1_CPU_SPEC },                         \
   SUBTARGET_EXTRA_SPECS
 
index 401077d8057f7c00fff0ef8052ae23c296239b5b..0c198020a421640b3dd1b3bd5f4af299a4de09cc 100644 (file)
 %{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540}  } } \
 %{mcpu=e6500: -D__PPC_CPU_E6500__}"
 
-#undef ASM_DEFAULT_SPEC
-#define        ASM_DEFAULT_SPEC "-mppc%{m64:64}"
-
 #undef ASM_SPEC
 #define        ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
 
index 17fea80a0a53d90782ce500a38172d8e40d58164..4645ef3b21ee68c22fc5a5c57b936c70797c854b 100644 (file)
@@ -39,7 +39,7 @@
 
 /* Override rs6000.h definition.  */
 #undef ASM_DEFAULT_SPEC
-#define        ASM_DEFAULT_SPEC "-mppc"
+#define        ASM_DEFAULT_SPEC "-mppc%{m64:64}"
 
 #define        TARGET_HAS_TOC          (TARGET_64BIT                           \
                                 || (TARGET_MINIMAL_TOC                 \