Adjust optimization flags if the CPU does not support SSE4
Tentatively fixes Homebrew/homebrew#21778, Homebrew/homebrew#24363.
This commit is contained in:
parent
8ba503ebb6
commit
14b19ba3c4
@ -344,8 +344,12 @@ module Stdenv
|
|||||||
if ARGV.build_bottle?
|
if ARGV.build_bottle?
|
||||||
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
||||||
append flags, Hardware::CPU.optimization_flags.fetch(arch)
|
append flags, Hardware::CPU.optimization_flags.fetch(arch)
|
||||||
|
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
||||||
|
# If the CPU doesn't support SSE4, we cannot trust -march=native or
|
||||||
|
# -march=<cpu family> to do the right thing because we might be running
|
||||||
|
# in a VM or on a Hackintosh.
|
||||||
|
append flags, Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
|
||||||
else
|
else
|
||||||
# Don't set -msse3 and older flags because -march does that for us
|
|
||||||
append flags, map.fetch(Hardware::CPU.family, default)
|
append flags, map.fetch(Hardware::CPU.family, default)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -206,8 +206,10 @@ module Superenv
|
|||||||
if ARGV.build_bottle?
|
if ARGV.build_bottle?
|
||||||
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
arch = ARGV.bottle_arch || Hardware.oldest_cpu
|
||||||
Hardware::CPU.optimization_flags.fetch(arch)
|
Hardware::CPU.optimization_flags.fetch(arch)
|
||||||
elsif compiler == :clang
|
elsif Hardware::CPU.intel? && !Hardware::CPU.sse4?
|
||||||
"-march=native"
|
Hardware::CPU.optimization_flags.fetch(Hardware.oldest_cpu)
|
||||||
|
else
|
||||||
|
"-march=native" if compiler == :clang
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user