From eef6e6146c301708d50cbadce3add4f17886f06f Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Fri, 10 May 2013 12:24:34 +0000 Subject: [PATCH] By default, when 32 bit x86 build is requested, i686 instruction set is chosen now. i386 instruction set removed since de facto it is not supported by some core libraries (Boost.Atomic and Boost.SmartPtr) and major operating systems. The minimum 32 bit x86 instruction set is i486 now. Also added a few more instruction sets that appeared in recent CPUs. [SVN r84221] --- src/tools/builtin.jam | 11 ++++++----- src/tools/builtin.py | 11 ++++++----- src/tools/gcc.jam | 35 ++++++++++++++++++++++++++++++++--- src/tools/gcc.py | 35 +++++++++++++++++++++++++++++++++-- src/tools/intel-darwin.jam | 13 ++++++++++--- src/tools/msvc.jam | 11 ++++++----- src/tools/msvc.py | 10 +++++----- 7 files changed, 98 insertions(+), 28 deletions(-) diff --git a/src/tools/builtin.jam b/src/tools/builtin.jam index ed3b06b92..176de13ff 100644 --- a/src/tools/builtin.jam +++ b/src/tools/builtin.jam @@ -272,11 +272,12 @@ feature.feature architecture : # The specific instruction set in an architecture to compile. feature.feature instruction-set : # x86 and x86-64 - native i386 i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 - pentium3m pentium-m pentium4 pentium4m prescott nocona core2 conroe conroe-xe - conroe-l allendale mermon mermon-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp - athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2 + native i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 + pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp + athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona + bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 atom # ia64 itanium itanium1 merced itanium2 mckinley diff --git a/src/tools/builtin.py b/src/tools/builtin.py index 5b28a0aa7..35c1a40d8 100644 --- a/src/tools/builtin.py +++ b/src/tools/builtin.py @@ -267,11 +267,12 @@ def register_globals (): # The specific instruction set in an architecture to compile. feature.feature('instruction-set', [ # x86 and x86-64 - 'i386', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3', - 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'conroe', 'conroe-xe', - 'conroe-l', 'allendale', 'mermon', 'mermon-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', - 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'winchip-c6', 'winchip2', 'c3', 'c3-2', + 'native', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3', + 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', + 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', + 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', + 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2', 'winchip-c6', 'winchip2', 'c3', 'c3-2', 'atom', # ia64 'itanium', 'itanium1', 'merced', 'itanium2', 'mckinley', diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index 167da17a3..ef90f05c7 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -1066,10 +1066,9 @@ local rule cpu-flags ( toolset variable : architecture : instruction-set + : # # x86 and compatible # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default. -# Use conservative i386 instead for 32-bit. -toolset.flags gcc OPTIONS x86/32/ : -march=i386 ; +# Use i686 instead for 32-bit. +toolset.flags gcc OPTIONS x86/32/ : -march=i686 ; cpu-flags gcc OPTIONS : x86 : native : -march=native ; -cpu-flags gcc OPTIONS : x86 : i386 : -march=i386 ; cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ; @@ -1085,6 +1084,24 @@ cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ; cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ; cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ; cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ; +cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ; +cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ; +cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ; +cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ; +cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ; +cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ; +cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ; cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ; cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; @@ -1098,10 +1115,22 @@ cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ; cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ; cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ; cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ; +cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ; +cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ; +cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ; +cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ; +cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ; +cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ; +cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ; +cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ; +cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ; +cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ; cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; +## +cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; # Sparc cpu-flags gcc OPTIONS : sparc : c3 : -mcpu=c3 : default ; cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ; diff --git a/src/tools/gcc.py b/src/tools/gcc.py index 70dd9ea72..c2f3b0206 100644 --- a/src/tools/gcc.py +++ b/src/tools/gcc.py @@ -711,10 +711,10 @@ def cpu_flags(toolset, variable, architecture, instruction_set, values, default= # x86 and compatible flags('gcc', 'OPTIONS', ['x86/32'], ['-m32']) flags('gcc', 'OPTIONS', ['x86/64'], ['-m64']) -cpu_flags('gcc', 'OPTIONS', 'x86', 'i386', ['-march=i386'], default=True) +cpu_flags('gcc', 'OPTIONS', 'x86', 'native', ['-march=native']) cpu_flags('gcc', 'OPTIONS', 'x86', 'i486', ['-march=i486']) cpu_flags('gcc', 'OPTIONS', 'x86', 'i586', ['-march=i586']) -cpu_flags('gcc', 'OPTIONS', 'x86', 'i686', ['-march=i686']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'i686', ['-march=i686'], default=True) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium', ['-march=pentium']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium-mmx', ['-march=pentium-mmx']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentiumpro', ['-march=pentiumpro']) @@ -726,6 +726,25 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium4', ['-march=pentium4']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium4m', ['-march=pentium4m']) cpu_flags('gcc', 'OPTIONS', 'x86', 'prescott', ['-march=prescott']) cpu_flags('gcc', 'OPTIONS', 'x86', 'nocona', ['-march=nocona']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'core2', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe-l', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'allendale', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'wolfdale', ['-march=core2', '-msse4.1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'merom', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'merom-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'kentsfield', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'kentsfield-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'yorksfield', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'penryn', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'corei7', ['-march=corei7']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'nehalem', ['-march=corei7']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'corei7-avx', ['-march=corei7-avx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'sandy-bridge', ['-march=corei7-avx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'core-avx-i', ['-march=core-avx-i']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'ivy-bridge', ['-march=core-avx-i']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'haswell', ['-march=core-avx-i', '-mavx2', '-mfma', '-mbmi', '-mbmi2', '-mlzcnt']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6', ['-march=k6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-2', ['-march=k6-2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-3', ['-march=k6-3']) @@ -739,10 +758,22 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'k8', ['-march=k8']) cpu_flags('gcc', 'OPTIONS', 'x86', 'opteron', ['-march=opteron']) cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon64', ['-march=athlon64']) cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon-fx', ['-march=athlon-fx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'k8-sse3', ['-march=k8-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'opteron-sse3', ['-march=opteron-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon64-sse3', ['-march=athlon64-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'amdfam10', ['-march=amdfam10']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'barcelona', ['-march=barcelona']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver1', ['-march=bdver1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver2', ['-march=bdver2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver3', ['-march=bdver3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'btver1', ['-march=btver1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'btver2', ['-march=btver2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip-c6', ['-march=winchip-c6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip2', ['-march=winchip2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3', ['-march=c3']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3-2', ['-march=c3-2']) +## +cpu_flags('gcc', 'OPTIONS', 'x86', 'atom', ['-march=atom']) # Sparc flags('gcc', 'OPTIONS', ['sparc/32'], ['-m32']) flags('gcc', 'OPTIONS', ['sparc/64'], ['-m64']) diff --git a/src/tools/intel-darwin.jam b/src/tools/intel-darwin.jam index aa0fd8fb6..c682a7f70 100644 --- a/src/tools/intel-darwin.jam +++ b/src/tools/intel-darwin.jam @@ -132,9 +132,16 @@ flags intel-darwin.compile OPTIONS ; flags intel-darwin.compile OPTIONS space : -O1 ; # no specific space optimization flag in icc # -cpu-type-em64t = prescott nocona ; -flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/32 : -m32 ; # -mcmodel=small ; -flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/64 : -m64 ; # -mcmodel=large ; +.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom + merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell ; +.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 + athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ; +.cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; + +flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/32 : -m32 ; # -mcmodel=small ; +flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/64 : -m64 ; # -mcmodel=large ; flags intel-darwin.compile.c OPTIONS off : -w0 ; flags intel-darwin.compile.c OPTIONS on : -w1 ; diff --git a/src/tools/msvc.jam b/src/tools/msvc.jam index 79626e8d6..435295c48 100644 --- a/src/tools/msvc.jam +++ b/src/tools/msvc.jam @@ -234,7 +234,6 @@ rule configure-version-specific ( toolset : version : conditions ) toolset.flags $(toolset).compile CFLAGS $(conditions)/space : /Os ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/ : /GB ; - toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/i386 : /G3 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/i486 : /G4 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g5) : /G5 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g6) : /G6 ; @@ -1373,10 +1372,12 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] .cpu-type-g5 = i586 pentium pentium-mmx ; .cpu-type-g6 = i686 pentiumpro pentium2 pentium3 pentium3m pentium-m k6 k6-2 k6-3 winchip-c6 winchip2 c3 c3-2 ; -.cpu-type-em64t = prescott nocona conroe conroe-xe conroe-l allendale mermon - mermon-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem ; -.cpu-type-amd64 = k8 opteron athlon64 athlon-fx ; +.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom + merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell ; +.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 + athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ; .cpu-type-g7 = pentium4 pentium4m athlon athlon-tbird athlon-4 athlon-xp athlon-mp $(.cpu-type-em64t) $(.cpu-type-amd64) ; .cpu-type-itanium = itanium itanium1 merced ; diff --git a/src/tools/msvc.py b/src/tools/msvc.py index f4448daab..1e737c8a0 100644 --- a/src/tools/msvc.py +++ b/src/tools/msvc.py @@ -176,7 +176,6 @@ def configure_version_specific(toolset_arg, version, conditions): cpu_arch_i386_cond = extend_conditions(conditions, __cpu_arch_i386) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['']),['/GB']) - toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['i386']),['/G3']) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['i486']),['/G4']) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['' + t for t in __cpu_type_g5]), ['/G5']) @@ -1145,10 +1144,11 @@ __cpu_arch_ia64 = [ __cpu_type_g5 = ['i586', 'pentium', 'pentium-mmx' ] __cpu_type_g6 = ['i686', 'pentiumpro', 'pentium2', 'pentium3', 'pentium3m', 'pentium-m', 'k6', 'k6-2', 'k6-3', 'winchip-c6', 'winchip2', 'c3', 'c3-2' ] -__cpu_type_em64t = ['prescott', 'nocona', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'mermon', - 'mermon-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem' ] -__cpu_type_amd64 = ['k8', 'opteron', 'athlon64', 'athlon-fx'] +__cpu_type_em64t = ['prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', + 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell' ] +__cpu_type_amd64 = ['k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', + 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2' ] __cpu_type_g7 = ['pentium4', 'pentium4m', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp' 'athlon-mp'] + __cpu_type_em64t + __cpu_type_amd64 __cpu_type_itanium = ['itanium', 'itanium1', 'merced']