From ebf9ea59c9613529a05e9e8a1b74a5d2d388195b Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sun, 18 Oct 2009 04:54:23 -0700 Subject: gcc-opt-x86.pl: add Core 2 and Atom Signed-off-by: Steven Noonan --- crawl-ref/source/util/gcc-opt-x86.pl | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (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 7454df70ea..d44528ef76 100755 --- a/crawl-ref/source/util/gcc-opt-x86.pl +++ b/crawl-ref/source/util/gcc-opt-x86.pl @@ -28,7 +28,7 @@ if ( ! $cpuinfo ) { } my %features; -my $family; +my ($family, $model); my $uname_M = `uname -m`; my $uname_P = `uname -p`; my $uname_S = `uname -s`; @@ -43,9 +43,13 @@ if ( -e $cpuinfo ) { my @cpuinfo = ; close FH; - my @familyline = grep(/^cpu family/, @cpuinfo); - $familyline[0] =~ s/^cpu[ ]family[ \t]*[:][ ]*//; - $family = $familyline[0]; + my @line = grep(/^cpu family/, @cpuinfo); + $line[0] =~ /([0-9]*)$/; + $family = $1; + + @line = grep(/^model/, @cpuinfo); + $line[0] =~ /([0-9]*)$/; + $model = $1; my @flags = grep(/^flags/, @cpuinfo); $flags[0] =~ s/^flags[ \t]*[:][ \t]*//; @@ -74,6 +78,10 @@ if ( $uname_S =~ /^Darwin/ ) { # * k8-sse3, opteron-sse3, athlon64-sse3 # * winchip-c6, winchip2 +my $gcc_gte_4_2_0 = `util/gcc-gte.pl $gcc 4.2.0`; +my $gcc_gte_4_3_0 = `util/gcc-gte.pl $gcc 4.2.0`; +my $gcc_gte_4_5_0 = `util/gcc-gte.pl $gcc 4.5.0`; + # # Check the minimum march/mtune value # @@ -99,9 +107,19 @@ if ( $features{"sse"} ) { if ( $features{"sse2"} ) { $march = "pentium-m"; } -if ( $features{"pni"} ) { +if ( $features{"pni"} ) { # a.k.a. SSE3 $march = "prescott"; } +if ( $features{"ssse3"} ) { + if ( $gcc_gte_4_3_0 ) { + $march = "core2"; + } else { + $march = "nocona"; + } +} +if ( $gcc_gte_4_5_0 && $features{"movbe"} ) { + $march = "atom"; +} if ( $uname_P =~ /Athlon/ ) { $march = "athlon"; -- cgit v1.2.3-54-g00ecf