Fix SSE support on Core 2 processors

DRY it off a bit.
This commit is contained in:
Ben Alpert 2009-09-03 19:31:43 -06:00 committed by Max Howell
parent 0543bbcccc
commit c6d98678ac

View File

@ -45,31 +45,34 @@ cflags=%w[-O3]
# http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/i386-and-x86_002d64-Options.html # http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/i386-and-x86_002d64-Options.html
if MACOS_VERSION >= 10.6 if MACOS_VERSION >= 10.6
case Hardware.intel_family case Hardware.intel_family
when :penryn when :penryn, :core2
cflags<<'-march=core2'<<'-msse4.1' cflags<<"-march=core2"
when :core2 when :core
cflags<<"-march=core2"<<'-msse4' cflags<<"-march=prescott"
when :core1
cflags<<"-march=prescott"<<'-msse3'
end end
ENV['LDFLAGS']="-arch x86_64" ENV['LDFLAGS']="-arch x86_64"
cflags<<'-m64'<<'-mmmx' cflags<<"-m64"
else else
case Hardware.intel_family case Hardware.intel_family
when :penryn when :penryn, :core2
cflags<<"-march=nocona"<<'-msse4.1' cflags<<"-march=nocona"
when :core2 when :core
cflags<<"-march=nocona"<<'-msse4' cflags<<"-march=prescott"
when :core1
cflags<<"-march=prescott"<<'-msse3'
end end
# to be consistent with cflags, we ignore the existing environment # to be consistent with cflags, we ignore the existing environment
ENV['LDFLAGS']="" ENV['LDFLAGS']=""
cflags<<'-mmmx'<<"-mfpmath=sse" cflags<<"-mfpmath=sse"
# gcc 4.0 is the default on Leopard # gcc 4.0 is the default on Leopard
ENV['CC']='gcc-4.2' ENV['CC']="gcc-4.2"
ENV['CXX']='g++-4.2' ENV['CXX']="g++-4.2"
end
cflags<<"-mmmx"
case Hardware.intel_family
when :penryn
cflags<<"-msse4.1"
when :core2, :core
cflags<<"-msse3"
end end
# -w: keep signal to noise high # -w: keep signal to noise high