diff options
author | Ryan Hill <dirtyepic@gentoo.org> | 2014-02-02 23:43:49 +0000 |
---|---|---|
committer | Ryan Hill <dirtyepic@gentoo.org> | 2014-02-02 23:43:49 +0000 |
commit | c197eb06141497aa1246b021244067ea3b692f7b (patch) | |
tree | c42f74f41e560694cd22fafa98661999151c1f22 /eclass/tests | |
parent | Version bump. Drop old version. (diff) | |
download | gentoo-2-c197eb06141497aa1246b021244067ea3b692f7b.tar.gz gentoo-2-c197eb06141497aa1246b021244067ea3b692f7b.tar.bz2 gentoo-2-c197eb06141497aa1246b021244067ea3b692f7b.zip |
Add downgrade_arch_flags() to automatically replace/strip unsupported -march
and instruction set flags. Add testsuite.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/toolchain.sh | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh new file mode 100755 index 000000000000..7040707310a9 --- /dev/null +++ b/eclass/tests/toolchain.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +source tests-common.sh + +inherit toolchain + +test_downgrade_arch_flags() { + local exp msg ret=0 ver + + ver=${1} + exp=${2} + shift 2 + CFLAGS=${@} + + tbegin "${ver} ${CFLAGS} => ${exp}" + + downgrade_arch_flags ${ver} + + if [[ ${CFLAGS} != ${exp} ]]; then + msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\"" + ret=1 + fi + tend ${ret} ${msg} +} + +# ver expected given +test_downgrade_arch_flags 4.9 "-march=haswell" "-march=haswell" +test_downgrade_arch_flags 4.8 "-march=core-avx2" "-march=haswell" +test_downgrade_arch_flags 4.7 "-march=core-avx2" "-march=haswell" +test_downgrade_arch_flags 4.6 "-march=core-avx-i" "-march=haswell" +test_downgrade_arch_flags 4.5 "-march=core2" "-march=haswell" +test_downgrade_arch_flags 4.4 "-march=core2" "-march=haswell" +test_downgrade_arch_flags 4.3 "-march=core2" "-march=haswell" +test_downgrade_arch_flags 4.2 "-march=nocona" "-march=haswell" +test_downgrade_arch_flags 4.1 "-march=nocona" "-march=haswell" +test_downgrade_arch_flags 4.0 "-march=nocona" "-march=haswell" +test_downgrade_arch_flags 3.4 "-march=nocona" "-march=haswell" +test_downgrade_arch_flags 3.3 "-march=nocona" "-march=haswell" + +test_downgrade_arch_flags 4.9 "-march=bdver4" "-march=bdver4" +test_downgrade_arch_flags 4.8 "-march=bdver3" "-march=bdver4" +test_downgrade_arch_flags 4.7 "-march=bdver2" "-march=bdver4" +test_downgrade_arch_flags 4.6 "-march=bdver1" "-march=bdver4" +test_downgrade_arch_flags 4.5 "-march=amdfam10" "-march=bdver4" +test_downgrade_arch_flags 4.4 "-march=amdfam10" "-march=bdver4" +test_downgrade_arch_flags 4.3 "-march=amdfam10" "-march=bdver4" +test_downgrade_arch_flags 4.2 "-march=k8" "-march=bdver4" +test_downgrade_arch_flags 4.1 "-march=k8" "-march=bdver4" +test_downgrade_arch_flags 4.0 "-march=k8" "-march=bdver4" +test_downgrade_arch_flags 3.4 "-march=k8" "-march=bdver4" +test_downgrade_arch_flags 3.3 "-march=x86-64" "-march=bdver4" + +test_downgrade_arch_flags 3.4 "-march=c3-2" "-march=c3-2" +test_downgrade_arch_flags 3.3 "-march=c3" "-march=c3-2" + +test_downgrade_arch_flags 4.5 "-march=garbage" "-march=garbage" + +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 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -mtune=generic" +test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona" +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.4 "-O2 -march=core2 -ffoo -fblah" "-O2 -march=atom -msha -ffoo -mrtm -mavx2 -fblah" +texit |