Re: [AD] Pentium Pro optimizations under *nix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> > The only pitfalls I see involve non-intel targets, where -mcpu=pentium
> > doesn't make much sense. I guess the solution would be to set a flag 
when
> > a --enable*-optimizations option is given and let the script pick the
> > default compiler switch if the flag is not set.
> 
> Too complicated.

Indeed!

> > The other pitfall is that -mcpu and -march don't appear to be
> > cross-platform switches. For instance, corresponding switches for Sparc
[snip]
> 
> Simply document that the options are valid on x86 targets only.

It turned out somewhat simpler than I had anticipated.
The attached patch adds a --enable-optimizations=processor flag, the value 
of which is passed to gcc.
I renamed the --enable-exclusiveopts the option as you suggested, but left 
the functionality the same as in my previous patch, since I find the 
configure script is slightly easier to follow this way (less redundant 
code/checking).
And as in my previous patch, the intel specific flags should only be seen 
on intel targets - thus allowing optimization flags for other platforms as 
well (provided the correct -m* flags are known).
--- configure.in.old	Tue Oct  1 20:22:45 2002
+++ configure.in	Sun Oct  6 21:19:58 2002
@@ -72,10 +72,15 @@
 [  --enable-staticprog[=x] link programs with static library [default=no]],
 test "X$enableval" != "Xno" && allegro_build_static_programs=yes)
 
-dnl Enable Pentium optimizations.
-AC_ARG_ENABLE(pentiumopts,
-[  --enable-pentiumopts[=x] enable Pentium optimizations [default=no]],
-test "X$enableval" != "Xno" && allegro_pentium_optimizations=yes)
+dnl Enable processor specific optimizations.
+AC_ARG_ENABLE(optimizations,
+[  --enable-optimizations[=x] enable processor specific code [default=pentium]],
+test "X$enableval" != "Xyes" && optimizations="$enableval")
+
+dnl Enable exclusive code generation.
+AC_ARG_ENABLE(exclusive-optimizations,
+[  --enable-exclusive-optimizations[=x] enable processor exclusive code [default=no]],
+test "X$enableval" != "Xno" && allegro_exclusive_optimizations=yes)
 
 dnl Sanity check on shared/static options
 if test "X$allegro_static_libraries" != "Xyes"; then
@@ -167,11 +172,25 @@
   else
     WFLAGS="-Wall"
   fi
-  if test "X$allegro_pentium_optimizations" = "Xyes"; then
-    TARGET_ARCH="-mcpu=pentium"
-  else
+
+  dnl Intel machine specific optimizations
+  if test "$allegro_cv_support_asm" = i386; then
+    TARGET_ARCH=
+    if test "X$allegro_exclusive_optimizations" = "Xyes"; then
+      OPT_SWITCH="-march="
+    else
+      OPT_SWITCH="-mcpu="
+    fi
+    
+    if test "X$optimizations" = "X"; then
+      TARGET_ARCH=$OPT_SWITCH"pentium"
+    else  
+      TARGET_ARCH=$OPT_SWITCH"$optimizations"
+    fi
+  else  
     TARGET_ARCH=
   fi
+  
   if test "X$allegro_cv_support_fomit_frame_pointer" = "Xyes"; then
     CFLAGS="$TARGET_ARCH -O2 -funroll-loops -ffast-math -fomit-frame-pointer $WFLAGS"
   else


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/