From 0a32c9f82392db7fe510c3c09ead69076aba2ae6 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Sun, 18 Oct 2009 04:34:20 -0700 Subject: git-opt-x86.pl: Detect some more arches Detect pentium, pentium-mmx, pentiumpro, athlon, and amdfam10. --- crawl-ref/source/util/gcc-opt-x86.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'crawl-ref/source/util') diff --git a/crawl-ref/source/util/gcc-opt-x86.pl b/crawl-ref/source/util/gcc-opt-x86.pl index 808eecac2d..7454df70ea 100755 --- a/crawl-ref/source/util/gcc-opt-x86.pl +++ b/crawl-ref/source/util/gcc-opt-x86.pl @@ -29,6 +29,8 @@ if ( ! $cpuinfo ) { my %features; my $family; +my $uname_M = `uname -m`; +my $uname_P = `uname -p`; my $uname_S = `uname -s`; # @@ -66,12 +68,27 @@ if ( $uname_S =~ /^Darwin/ ) { $features{"ssse3"} = `sysctl -n hw.optional.supplementalsse3`; } +# TODO architectures: +# * athlon-4, athlon-xp, athlon-mp +# * k8, opteron, athlon64, athlon-fx +# * k8-sse3, opteron-sse3, athlon64-sse3 +# * winchip-c6, winchip2 + # # Check the minimum march/mtune value # my $march = "i386"; my $fpmath; +if ($uname_M eq "i586" || $uname_M eq "i686") +{ + # Pentium and PentiumPro + $march = $uname_M; +} +if ( $uname_M eq "i586" && $features{"mmx"} ) +{ + $march = "pentium-mmx"; +} if ( $features{"cmov"} && $features{"mmx"} ) { $march = "pentium2"; } @@ -85,6 +102,15 @@ if ( $features{"sse2"} ) { if ( $features{"pni"} ) { $march = "prescott"; } +if ( $uname_P =~ /Athlon/ ) +{ + $march = "athlon"; + + if ( $features{"abm"} && $features{"sse4a"} ) + { + $march = "amdfam10"; + } +} # It's important to specify 'march=pentium4' for the # Pentium 4, because it has vastly different optimization -- cgit v1.2.3-54-g00ecf