diff options
author | Ryan Hill <rhill@gentoo.org> | 2014-02-05 06:18:29 +0000 |
---|---|---|
committer | Ryan Hill <rhill@gentoo.org> | 2014-02-05 06:18:29 +0000 |
commit | a0f0b4b9c4d6cbc6316c02dfc2c479e3d5b8f645 (patch) | |
tree | 78df47b2d68a68a45c762d727ab79730efa54309 /eclass | |
parent | sci-physics/lammps: Trying to add blocker, ottxor beat me to it :) (diff) | |
download | historical-a0f0b4b9c4d6cbc6316c02dfc2c479e3d5b8f645.tar.gz historical-a0f0b4b9c4d6cbc6316c02dfc2c479e3d5b8f645.tar.bz2 historical-a0f0b4b9c4d6cbc6316c02dfc2c479e3d5b8f645.zip |
Limit downgrading flags to amd64 and x86. Strip -mtune for < 3.4. Only
worry about -mno* flags, -m* are removed by strip-flags. Add -mno-movbe.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rwxr-xr-x | eclass/tests/toolchain.sh | 21 | ||||
-rw-r--r-- | eclass/toolchain.eclass | 78 |
3 files changed, 57 insertions, 49 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index a4a96edb256e..872bb320f7d9 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1136 2014/02/02 23:43:48 dirtyepic Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1137 2014/02/05 06:18:29 dirtyepic Exp $ + + 05 Feb 2014; Ryan Hill <dirtyepic@gentoo.org> tests/toolchain.sh, + toolchain.eclass: + Limit downgrading flags to amd64 and x86. Strip -mtune for < 3.4. Only + worry about -mno* flags, -m* are removed by strip-flags. Add -mno-movbe. 02 Feb 2014; Ryan Hill <dirtyepic@gentoo.org> +tests/toolchain.sh, toolchain.eclass: diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 7040707310a9..d1255a37488e 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -14,8 +14,9 @@ test_downgrade_arch_flags() { tbegin "${ver} ${CFLAGS} => ${exp}" + CHOST=x86_64 # needed for tc-arch downgrade_arch_flags ${ver} - + if [[ ${CFLAGS} != ${exp} ]]; then msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\"" ret=1 @@ -59,7 +60,7 @@ test_downgrade_arch_flags 4.9 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.8 "-mtune=generic" "-mtune=intel" test_downgrade_arch_flags 3.4 "" "-mtune=generic" test_downgrade_arch_flags 3.4 "" "-mtune=x86-64" -test_downgrade_arch_flags 3.3 "-mtune=nocona" "-mtune=haswell" +test_downgrade_arch_flags 3.3 "" "-mtune=anything" test_downgrade_arch_flags 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -mtune=generic" test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona" @@ -68,14 +69,12 @@ test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic" test_downgrade_arch_flags 4.2 "-march=native" "-march=native" test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native" -test_downgrade_arch_flags 4.9 "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.8 "-march=foo -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.7 "-march=foo -mavx2 -mbmi -mno-xop -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.6 "-march=foo -mbmi -mno-xop -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.5 "-march=foo -mno-xop -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.4 "-march=foo -maes -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.3 "-march=foo -mno-sse4" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" -test_downgrade_arch_flags 4.2 "-march=foo" "-march=foo -msha -mrtm -mavx2 -mbmi -mno-xop -maes -mno-sse4" +test_downgrade_arch_flags 4.9 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" +test_downgrade_arch_flags 4.8 "-march=foo -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" +test_downgrade_arch_flags 4.7 "-march=foo -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" +test_downgrade_arch_flags 4.6 "-march=foo -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" +test_downgrade_arch_flags 4.3 "-march=foo -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" +test_downgrade_arch_flags 4.2 "-march=foo" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" -test_downgrade_arch_flags 4.4 "-O2 -march=core2 -ffoo -fblah" "-O2 -march=atom -msha -ffoo -mrtm -mavx2 -fblah" +test_downgrade_arch_flags 4.4 "-O2 -march=core2 -ffoo -fblah" "-O2 -march=atom -mno-sha -ffoo -mno-rtm -fblah" texit diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 540e8377e167..d60078fb87d4 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.622 2014/02/02 23:43:48 dirtyepic Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.623 2014/02/05 06:18:29 dirtyepic Exp $ # Maintainer: Toolchain Ninjas <toolchain@gentoo.org> @@ -1214,13 +1214,14 @@ downgrade_arch_flags() { bver=${1:-${GCC_BRANCH_VER}} [[ $(gcc-version) < ${bver} ]] && return 0 + [[ $(tc-arch) != amd64 && $(tc-arch) != x86 ]] && return 0 myarch=$(get-flag march) mytune=$(get-flag mtune) # If -march=native isn't supported we have to tease out the actual arch if [[ ${myarch} == native || ${mytune} == native ]] ; then - if [[ ${bver} < "4.2" ]] ; then + if [[ ${bver} < 4.2 ]] ; then arch=$(echo "" | $(tc-getCC) -march=native -v -E - 2>&1 \ | grep cc1 | sed -e 's:.*-march=\([^ ]*\).*:\1:') replace-cpu-flags native ${arch} @@ -1228,9 +1229,10 @@ downgrade_arch_flags() { fi # Handle special -mtune flags - [[ ${mytune} == intel && ${bver} < "4.9" ]] && replace-cpu-flags intel generic - [[ ${mytune} == generic && ${bver} < "4.2" ]] && filter-flags '-mtune=*' + [[ ${mytune} == intel && ${bver} < 4.9 ]] && replace-cpu-flags intel generic + [[ ${mytune} == generic && ${bver} < 4.2 ]] && filter-flags '-mtune=*' [[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*' + [[ ${bver} < 3.4 ]] && filter-flags '-mtune=*' declare -a archlist # "arch" "added" "replacement" @@ -1277,7 +1279,7 @@ downgrade_arch_flags() { ver=${archlist[i]#* } ver=${ver% *} rep=${archlist[i]##* } - [[ ${myarch} != ${arch} ]] && [[ ${mytune} != ${arch} ]] && continue + [[ ${myarch} != ${arch} && ${mytune} != ${arch} ]] && continue if [[ ${ver} > ${bver} ]] ; then einfo "Replacing ${myarch} (added in ${ver}) with ${rep}..." @@ -1291,42 +1293,44 @@ downgrade_arch_flags() { done declare -a isalist - isalist=("-msha 4.9") - isalist+=("-mavx512pf 4.9") - isalist+=("-mavx512f 4.9") - isalist+=("-mavx512er 4.9") - isalist+=("-mavx512cd 4.9") - isalist+=("-mxsaveopt 4.8") - isalist+=("-mxsave 4.8") - isalist+=("-mrtm 4.8") - isalist+=("-mfxsr 4.8") - isalist+=("-mlzcnt 4.7") - isalist+=("-mbmi2 4.7") - isalist+=("-mavx2 4.7") - isalist+=("-mtbm 4.6") - isalist+=("-mrdrnd 4.6") - isalist+=("-mfsgsbase 4.6") - isalist+=("-mf16c 4.6") - isalist+=("-mbmi 4.6") - isalist+=("-mxop 4.5") - isalist+=("-mlwp 4.5") - isalist+=("-mfma4 4.5") - isalist+=("-mpclmul 4.4") - isalist+=("-mfma 4.4") - isalist+=("-mavx 4.4") - isalist+=("-maes 4.4") - isalist+=("-mssse3 4.3") - isalist+=("-msse4a 4.3") - isalist+=("-msse4 4.3") - isalist+=("-msse4.2 4.3") - isalist+=("-msse4.1 4.3") - isalist+=("-mpopcnt 4.3") - isalist+=("-mabm 4.3") + # we only check -mno* here since -m* get removed by strip-flags later on + isalist=("-mno-sha 4.9") + isalist+=("-mno-avx512pf 4.9") + isalist+=("-mno-avx512f 4.9") + isalist+=("-mno-avx512er 4.9") + isalist+=("-mno-avx512cd 4.9") + isalist+=("-mno-xsaveopt 4.8") + isalist+=("-mno-xsave 4.8") + isalist+=("-mno-rtm 4.8") + isalist+=("-mno-fxsr 4.8") + isalist+=("-mno-lzcnt 4.7") + isalist+=("-mno-bmi2 4.7") + isalist+=("-mno-avx2 4.7") + isalist+=("-mno-tbm 4.6") + isalist+=("-mno-rdrnd 4.6") + isalist+=("-mno-fsgsbase 4.6") + isalist+=("-mno-f16c 4.6") + isalist+=("-mno-bmi 4.6") + isalist+=("-mno-xop 4.5") + isalist+=("-mno-movbe 4.5") + isalist+=("-mno-lwp 4.5") + isalist+=("-mno-fma4 4.5") + isalist+=("-mno-pclmul 4.4") + isalist+=("-mno-fma 4.4") + isalist+=("-mno-avx 4.4") + isalist+=("-mno-aes 4.4") + isalist+=("-mno-ssse3 4.3") + isalist+=("-mno-sse4a 4.3") + isalist+=("-mno-sse4 4.3") + isalist+=("-mno-sse4.2 4.3") + isalist+=("-mno-sse4.1 4.3") + isalist+=("-mno-popcnt 4.3") + isalist+=("-mno-abm 4.3") for ((i=0; i < ${#isalist[@]}; i++)) ; do isa=${isalist[i]%% *} ver=${isalist[i]##* } - [[ ${ver} > ${bver} ]] && filter-flags ${isa} ${isa/-m/-mno-} + [[ ${ver} > ${bver} ]] && filter-flags ${isa} done } |