This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Generate i486 code by default on FreeBSD/ia32
- From: Tijl Coosemans <tijl at coosemans dot org>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Gerald Pfeifer <gerald at pfeifer dot com>
- Date: Sun, 6 Feb 2011 15:07:54 +0100
- Subject: Generate i486 code by default on FreeBSD/ia32
When targeting FreeBSD/ia32 6.0 and newer, cc1 uses -march=i486
-mtune=generic by default, i.e. when not passed -march/-mtune on the
command line. These are correct defaults.
The gcc driver however always passes -march/-mtune to cc1 so that
default behaviour never kicks in. The driver's default values of
-march/-mtune are determined by ./configure (gcc/config.gcc).
The configure script derives them from the first field in the target
triplet (by default), e.g. i386-portbld-freebsd8.0 becomes -march=i386
-mtune=i386.
The problem now is that on FreeBSD the first field of the target tends
to mean an architecture rather than a specific cpu model. So i386 in
the example above is used to mean ia32 in general, not really the i386
cpu specifically. Deriving values for -march/-mtune from it is
therefore suboptimal.
There are basically two approaches to improve this. Either don't let
the configure script derive anything from the target at all, as done on
Darwin, or tell the configure script that i386-portbld-freebsd8.0 means
-march=i486.
The attached patch takes the latter approach. It has the advantage that
the behaviour is unchanged for targets like i686-portbld-freebsd8.0.
Test results by Gerald Pfeifer:
http://gcc.gnu.org/ml/gcc-testresults/2011-02/msg00216.html (before)
http://gcc.gnu.org/ml/gcc-testresults/2011-02/msg00273.html (after)
Tijl Coosemans
* config.gcc (FreeBSD/i386): Default arch is i486.
--- gcc/config.gcc.orig 2011-01-26 05:19:58.000000000 +0100
+++ gcc/config.gcc 2011-02-01 16:58:17.000000000 +0100
@@ -2766,6 +2766,16 @@
arch_without_sse2=no
arch_without_64bit=no
case ${target} in
+ i386-*-freebsd*)
+ if test $fbsd_major -ge 6; then
+ arch=i486
+ else
+ arch=i386
+ fi
+ cpu=generic
+ arch_without_sse2=yes
+ arch_without_64bit=yes
+ ;;
i386-*-*)
arch=i386
cpu=i386