From ad7323bd61b2c2ccd3a5c4ad1478f55fceb17576 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Mon, 1 Oct 2018 09:44:59 -0700 Subject: [PATCH 1/3] Hardware::CPU: Add Skylake [Linux] --- Library/Homebrew/extend/os/linux/hardware/cpu.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index 54127a4ff3..75d983ff00 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -11,8 +11,11 @@ module Hardware return :dunno unless intel? # See https://software.intel.com/en-us/articles/intel-architecture-and-processor-identification-with-cpuid-model-and-family-numbers + # and https://github.com/llvm-mirror/llvm/blob/master/lib/Support/Host.cpp + # and https://en.wikipedia.org/wiki/List_of_Intel_CPU_microarchitectures#Roadmap cpu_family = cpuinfo[/^cpu family\s*: ([0-9]+)/, 1].to_i cpu_model = cpuinfo[/^model\s*: ([0-9]+)/, 1].to_i + unknown = :"unknown_0x#{cpu_family.to_s(16)}_0x#{cpu_model.to_s(16)}" case cpu_family when 0x06 case cpu_model @@ -36,12 +39,10 @@ module Hardware :haswell when 0x3d, 0x47, 0x4f, 0x56 :broadwell - when 0x5e + when 0x4e, 0x55, 0x5e, 0x8e, 0x9e :skylake - when 0x8e - :kabylake else - :dunno + unknown end when 0x0f case cpu_model @@ -50,10 +51,10 @@ module Hardware when 0x03, 0x04 :prescott else - :dunno + unknown end else - :dunno + unknown end end From 4addff3b2be571a1c853875abb8f5e63e8cef18d Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Tue, 2 Oct 2018 09:33:28 -0700 Subject: [PATCH 2/3] determine_optflags: Default is -march=native --- Library/Homebrew/extend/ENV/std.rb | 6 +++--- Library/Homebrew/extend/ENV/super.rb | 2 +- Library/Homebrew/hardware.rb | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 1c03f4317b..acc41ad695 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -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 diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 8d7e44b44a..a47fbcbc71 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -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 diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index a90ec46a3d..f087161469 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -11,7 +11,6 @@ module Hardware core: "-march=prescott", armv6: "-march=armv6", armv8: "-march=armv8-a", - dunno: "-march=native", }.freeze def optimization_flags From 13816a56875225b65812817d548aec161d2395d9 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Wed, 3 Oct 2018 11:43:52 -0700 Subject: [PATCH 3/3] GNU_GCC_VERSIONS: Remove the compiler gcc-4.3 --- Library/Homebrew/compilers.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index 14746d1c0b..ae86a96fad 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -1,7 +1,7 @@ # @private module CompilerConstants - GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze - GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-8])$/ + GNU_GCC_VERSIONS = %w[4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze + GNU_GCC_REGEXP = /^gcc-(4\.[4-9]|[5-8])$/ COMPILER_SYMBOL_MAP = { "gcc" => :gcc, "gcc-4.0" => :gcc_4_0, @@ -71,7 +71,6 @@ class CompilerFailure create(:gcc_4_0), create(:gcc_4_2), create(:clang) { build 425 }, - create(gcc: "4.3"), create(gcc: "4.4"), create(gcc: "4.5"), create(gcc: "4.6"), @@ -80,7 +79,6 @@ class CompilerFailure create(:clang) { build 600 }, create(:gcc_4_0), create(:gcc_4_2), - create(gcc: "4.3"), create(gcc: "4.4"), create(gcc: "4.5"), create(gcc: "4.6"),