config.gcc (all_defaults): Add arch_32 arch_64 cpu_32 cpu_64 tune_32 tune_64.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 11 Jun 2008 16:03:18 +0000 (17:03 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Wed, 11 Jun 2008 16:03:18 +0000 (17:03 +0100)
* 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
gcc/config.gcc
gcc/config/i386/i386.h
gcc/doc/install.texi

index 78ee5bd64567d39524627fc1dd183812ece80af6..b5c210ccae531a83d53c8360eda38ac97b1dd50b 100644 (file)
@@ -1,3 +1,20 @@
+2008-06-11  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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  <ebotcazou@adacore.com>
             Olivier Hainque  <hainque@adacore.com>
 
index 735013ee2ac7ab5ddc49bf65a61717a529a7a34a..4e207d314b6d6592d480ef4cee4a91db87b6f768 100644 (file)
@@ -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"
index 68e67f9bb92ea1de144a282f47b1deec01373101..4c65b10d4f99549f5e736ab6c172f05400e9ef3d 100644 (file)
@@ -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 */
 
index fdb8dc959577c67fe2d1141b051bb88e3312c516..5d32c2bca8e7ce63471113c1dd811a7c2c46e071 100644 (file)
@@ -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}