hardware: move generic logic from linux. (#454)

This commit is contained in:
Mike McQuaid 2016-07-06 10:43:54 +01:00 committed by GitHub
parent 416e51bca9
commit 11624b9a7d
3 changed files with 22 additions and 26 deletions

View File

@ -1,25 +1,6 @@
module Hardware module Hardware
class CPU class CPU
class << self class << self
OPTIMIZATION_FLAGS = {
:penryn => "-march=core2 -msse4.1",
:core2 => "-march=core2",
:core => "-march=prescott"
}.freeze
def optimization_flags
OPTIMIZATION_FLAGS
end
# Linux supports x86 only, and universal archs do not apply
def arch_32_bit
:i386
end
def arch_64_bit
:x86_64
end
def universal_archs def universal_archs
[].extend ArchitectureListExtension [].extend ArchitectureListExtension
end end

View File

@ -3,19 +3,15 @@ require "os/mac/pathname"
module Hardware module Hardware
class CPU class CPU
class << self class << self
PPC_OPTIMIZATION_FLAGS = {
OPTIMIZATION_FLAGS = {
:penryn => "-march=core2 -msse4.1",
:core2 => "-march=core2",
:core => "-march=prescott",
:g3 => "-mcpu=750", :g3 => "-mcpu=750",
:g4 => "-mcpu=7400", :g4 => "-mcpu=7400",
:g4e => "-mcpu=7450", :g4e => "-mcpu=7450",
:g5 => "-mcpu=970", :g5 => "-mcpu=970",
:g5_64 => "-mcpu=970 -arch ppc64" :g5_64 => "-mcpu=970 -arch ppc64",
}.freeze }.freeze
def optimization_flags def optimization_flags
OPTIMIZATION_FLAGS OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS)
end end
# These methods use info spewed out by sysctl. # These methods use info spewed out by sysctl.

View File

@ -8,6 +8,25 @@ module Hardware
PPC_64BIT_ARCHS = [:ppc64].freeze PPC_64BIT_ARCHS = [:ppc64].freeze
class << self class << self
OPTIMIZATION_FLAGS = {
:penryn => "-march=core2 -msse4.1",
:core2 => "-march=core2",
:core => "-march=prescott",
:dunno => "",
}.freeze
def optimization_flags
OPTIMIZATION_FLAGS
end
def arch_32_bit
:i386
end
def arch_64_bit
:x86_64
end
def type def type
:dunno :dunno
end end