determine_optflags: Default is -march=native

This commit is contained in:
Shaun Jackman 2018-10-02 09:33:28 -07:00
parent ad7323bd61
commit 4addff3b2b
3 changed files with 4 additions and 5 deletions

View File

@ -7,7 +7,7 @@ module Stdenv
# @private
SAFE_CFLAGS_FLAGS = "-w -pipe".freeze
DEFAULT_FLAGS = "-march=core2 -msse4".freeze
DEFAULT_FLAGS = "-march=native".freeze
# @private
def setup_build_environment(formula = nil)
@ -108,7 +108,7 @@ module Stdenv
def gcc_4_2
super
set_cpu_cflags
set_cpu_cflags "-march=core2 -msse4"
end
GNU_GCC_VERSIONS.each do |n|
@ -124,7 +124,7 @@ module Stdenv
# Clang mistakenly enables AES-NI on plain Nehalem
map = Hardware::CPU.optimization_flags
map = map.merge(nehalem: "-march=native -Xclang -target-feature -Xclang -aes")
set_cpu_cflags "-march=native", map
set_cpu_cflags DEFAULT_FLAGS, map
end
def minimal_optimization

View File

@ -235,7 +235,7 @@ module Superenv
Hardware::CPU.optimization_flags.fetch(arch)
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
elsif compiler == :clang
elsif ![:gcc_4_0, :gcc_4_2].include?(compiler)
"-march=native"
# This is mutated elsewhere, so return an empty string in this case
else

View File

@ -11,7 +11,6 @@ module Hardware
core: "-march=prescott",
armv6: "-march=armv6",
armv8: "-march=armv8-a",
dunno: "-march=native",
}.freeze
def optimization_flags