From 8981c15b8cbb3a7e129c7bcf85823eff3db9c6a7 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 11 Jun 2008 17:03:18 +0100 Subject: [PATCH] config.gcc (all_defaults): Add arch_32 arch_64 cpu_32 cpu_64 tune_32 tune_64. * config.gcc (all_defaults): Add arch_32 arch_64 cpu_32 cpu_64 tune_32 tune_64. (i[34567]86-*-* | x86_64-*-*): Add arch_32 arch_64 cpu_32 cpu_64 tune_32 tune_64 to supported_defaults. Allow values not supporting 64-bit mode for arch_32, cpu_32 and tune_32 for x86_64. Do not override cpu_32 or cpu_64 values from target name. (i[34567]86-*-linux*, i[34567]86-*-solaris2.1[0-9]*): Only default with_cpu_64 to generic for 64-bit-supporting configurations, not with_cpu. Remove FIXMEs. * doc/install.texi (--with-cpu-32, --with-cpu-64, --with-arch-32, --with-arch-64, --with-tune-32, --with-tune-64): Document. * config/i386/i386.h (OPT_ARCH32, OPT_ARCH64): Define. (OPTION_DEFAULT_SPECS): Add tune_32, tune_64, cpu_32, cpu_64, arch_32 and arch_64. From-SVN: r136674 --- gcc/ChangeLog | 17 ++++++++++++++++ gcc/config.gcc | 45 +++++++++++++++++++++++++++++++----------- gcc/config/i386/i386.h | 16 ++++++++++++++- gcc/doc/install.texi | 11 ++++++++++- 4 files changed, 76 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 78ee5bd6456..b5c210ccae5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2008-06-11 Joseph Myers + + * config.gcc (all_defaults): Add arch_32 arch_64 cpu_32 cpu_64 + tune_32 tune_64. + (i[34567]86-*-* | x86_64-*-*): Add arch_32 arch_64 cpu_32 cpu_64 + tune_32 tune_64 to supported_defaults. Allow values not + supporting 64-bit mode for arch_32, cpu_32 and tune_32 for + x86_64. Do not override cpu_32 or cpu_64 values from target name. + (i[34567]86-*-linux*, i[34567]86-*-solaris2.1[0-9]*): Only default + with_cpu_64 to generic for 64-bit-supporting configurations, not + with_cpu. Remove FIXMEs. + * doc/install.texi (--with-cpu-32, --with-cpu-64, --with-arch-32, + --with-arch-64, --with-tune-32, --with-tune-64): Document. + * config/i386/i386.h (OPT_ARCH32, OPT_ARCH64): Define. + (OPTION_DEFAULT_SPECS): Add tune_32, tune_64, cpu_32, cpu_64, + arch_32 and arch_64. + 2008-06-11 Eric Botcazou Olivier Hainque diff --git a/gcc/config.gcc b/gcc/config.gcc index 735013ee2ac..4e207d314b6 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1081,13 +1081,13 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu) tm_defines="${tm_defines} TARGET_BI_ARCH=1" tmake_file="${tmake_file} i386/t-linux64 i386/t-fprules-softfp64 soft-fp/t-softfp" need_64bit_hwint=yes - # FIXME: -m64 for i[34567]86-*-* should be allowed just - # like -m32 for x86_64-*-*. case X"${with_cpu}" in Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) ;; X) - with_cpu=generic + if test x$with_cpu_64 = x; then + with_cpu_64=generic + fi ;; *) echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 @@ -1192,13 +1192,13 @@ i[34567]86-*-solaris2*) tm_defines="${tm_defines} TARGET_BI_ARCH=1" tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10" need_64bit_hwint=yes - # FIXME: -m64 for i[34567]86-*-* should be allowed just - # like -m32 for x86_64-*-*. case X"${with_cpu}" in Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) ;; X) - with_cpu=generic + if test x$with_cpu_64 = x; then + with_cpu_64=generic + fi ;; *) echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 @@ -2537,6 +2537,23 @@ if test x$with_cpu = x ; then with_cpu="`echo ${target} | sed 's/-.*$//'`" ;; esac + + # Avoid overriding --with-cpu-32 and --with-cpu-64 values. + case ${target} in + i[34567]86-*-*|x86_64-*-*) + if test x$with_cpu != x; then + if test x$with_cpu_32 != x || test x$with_cpu_64 != x; then + if test x$with_cpu_32 = x; then + with_cpu_32=$with_cpu + fi + if test x$with_cpu_64 = x; then + with_cpu_64=$with_cpu + fi + with_cpu= + fi + fi + ;; + esac fi # Similarly for --with-schedule. @@ -2738,8 +2755,8 @@ case "${target}" in ;; i[34567]86-*-* | x86_64-*-*) - supported_defaults="arch cpu tune" - for which in arch cpu tune; do + supported_defaults="arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64" + for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do eval "val=\$with_$which" case ${val} in i386 | i486 \ @@ -2750,8 +2767,14 @@ case "${target}" in | prescott | pentium-m | pentium4m | pentium3m) case "${target}" in x86_64-*-*) - echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2 - exit 1 + case "x$which" in + *_32) + ;; + *) + echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2 + exit 1 + ;; + esac ;; esac # OK @@ -3059,7 +3082,7 @@ case ${target} in esac t= -all_defaults="abi cpu arch tune schedule float mode fpu divide llsc" +all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc" for option in $all_defaults do eval "val=\$with_$option" diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 68e67f9bb92..4c65b10d4f9 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -488,13 +488,27 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT #endif +#if TARGET_64BIT_DEFAULT +#define OPT_ARCH64 "!m32" +#define OPT_ARCH32 "m32" +#else +#define OPT_ARCH64 "m64" +#define OPT_ARCH32 "!m64" +#endif + /* Support for configure-time defaults of some command line options. The order here is important so that -march doesn't squash the tune or cpu values. */ #define OPTION_DEFAULT_SPECS \ {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ + {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ - {"arch", "%{!march=*:-march=%(VALUE)}"} + {"cpu_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"arch", "%{!march=*:-march=%(VALUE)}"}, \ + {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"}, \ + {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"}, /* Specs for the compiler proper */ diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index fdb8dc95957..5d32c2bca8e 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1014,14 +1014,23 @@ Specify that the target does not support TLS. This is an alias for @option{--enable-tls=no}. @item --with-cpu=@var{cpu} +@itemx --with-cpu-32=@var{cpu} +@itemx --with-cpu-64=@var{cpu} Specify which cpu variant the compiler should generate code for by default. @var{cpu} will be used as the default value of the @option{-mcpu=} switch. This option is only supported on some targets, including ARM, i386, M68k, -PowerPC, and SPARC@. +PowerPC, and SPARC@. The @option{--with-cpu-32} and +@option{--with-cpu-64} options specify separate default CPUs for +32-bit and 64-bit modes; these options are only supported for i386 and +x86-64. @item --with-schedule=@var{cpu} @itemx --with-arch=@var{cpu} +@itemx --with-arch-32=@var{cpu} +@itemx --with-arch-64=@var{cpu} @itemx --with-tune=@var{cpu} +@itemx --with-tune-32=@var{cpu} +@itemx --with-tune-64=@var{cpu} @itemx --with-abi=@var{abi} @itemx --with-fpu=@var{type} @itemx --with-float=@var{type} -- 2.30.2