diff --git a/zsnes/src/Makefile.in b/zsnes/src/Makefile.in index e7d44d0b..5625031b 100644 --- a/zsnes/src/Makefile.in +++ b/zsnes/src/Makefile.in @@ -115,7 +115,10 @@ ${PSR}: parsegen.cpp ALL: rm -f version.o -tools: cutrtype extraext minwhite nreplace sec-test srccount +tools: archopt cutrtype extraext minwhite nreplace sec-test srccount + +archopt: + @CC@ @CFLAGS@ -m32 -o ${TOOLSDIR}/archopt ${TOOLSDIR}/archopt.c cutrtype: ${TOOLSOBJ} @CXX@ @CXXFLAGS@ -o ${TOOLSDIR}/cutrtype ${TOOLSDIR}/cutrtype.cpp ${TOOLSOBJ} diff --git a/zsnes/src/acinclude.m4 b/zsnes/src/acinclude.m4 index a7412abe..4cd73160 100644 --- a/zsnes/src/acinclude.m4 +++ b/zsnes/src/acinclude.m4 @@ -424,7 +424,7 @@ if test x$enable_cpucheck != xno; then #if __GNUC__ > 2 if (strstr(flags, " 3dnow ")) { - if (strstr(flags, " 3dnowext ") && (atoi(cpu_family) > 5)) + if (strstr(flags, " 3dnowext ") && (atoi(cpu_family) > 5)) { #if __GNUC__ > 3 || __GNUC_MINOR__ > 0 if (strstr(flags, " sse ")) @@ -512,28 +512,21 @@ if test x$enable_cpucheck != xno; then } } #if __GNUC__ > 2 - else if (strstr(model_name, "VIA")) + #if __GNUC__ > 3 || __GNUC_MINOR__ > 2 + else if (!strcmp(vendor_id, "CentaurHauls") && strstr(flags, " mmx ")) { - if (strstr(flags, " mmx ")) + if (strstr(flags, " 3dnow ")) { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 2 - if (strstr(flags, " 3dnow ")) { cpu = "c3"; } - #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 - else if (strstr(flags, " sse ")) { cpu = "c3-2"; } - #endif - #endif - } - } - else if (strstr(model_name, "WinChip")) - { - #if __GNUC__ > 3 || __GNUC_MINOR__ > 2 - if (strstr(flags, " mmx ")) - { - cpu = (strstr(flags, " 3dnow ")) ? "winchip2" : "winchip-c6"; + cpu = (atoi(cpu_family) > 5) ? "c3" : "winchip2"; } + #if __GNUC__ > 3 || __GNUC_MINOR__ > 3 + else if (strstr(flags, " sse ")) { cpu = "c3-2"; } #endif + + if (!cpu) { cpu = "winchip-c6"; } } #endif + #endif if (!cpu) { diff --git a/zsnes/src/configure.in b/zsnes/src/configure.in index 42c06efe..f120e72b 100644 --- a/zsnes/src/configure.in +++ b/zsnes/src/configure.in @@ -132,7 +132,10 @@ else NFLAGS="$NFLAGS -O1" fi + CFLAGSBAK="$CFLAGS" + CFLAGS="$CFLAGS -m32" dnl 64 bit cpus must use that for the arch detector AM_ARCH_DETECT() + CFLAGS="$CFLAGSBAK" AC_MSG_CHECKING(which cpu architecture to optimize for) if test x$ARCH_INFO = x ; then diff --git a/zsnes/src/tools/compile.txt b/zsnes/src/tools/compile.txt index 3eead28b..068c6282 100644 --- a/zsnes/src/tools/compile.txt +++ b/zsnes/src/tools/compile.txt @@ -6,6 +6,9 @@ g++ -Wall -O3 -o fileutil.o -c fileutil.cpp g++ -Wall -O3 -o strutil.o -c strutil.cpp +Architecture detector: +gcc -Wall -O3 -m32 -o archopt.exe archopt.c + Cut Redundant ASM Typecasts: g++ -Wall -O3 -o cutrtype.exe cutrtype.cpp fileutil.o strutil.o