config/arch.x86_64: updated TARGET_CPU & TARGET_FEATURES

This commit is contained in:
SupervisedThinking 2022-06-17 20:09:44 +02:00
parent 2366034f33
commit 35d4939701
2 changed files with 29 additions and 18 deletions

View File

@ -1,24 +1,30 @@
# determines TARGET_CPU, if not forced by user
if [ -z "$TARGET_CPU" ]; then
TARGET_CPU=core2
fi
# 64bit userland
if [ -z "${TARGET_FEATURES}" ]; then
TARGET_FEATURES="64bit"
else
TARGET_FEATURES+=" 64bit"
if [ -z "${TARGET_CPU}" ]; then
TARGET_CPU="x86-64"
fi
# determine architecture's family
TARGET_SUBARCH=x86_64
TARGET_SUBARCH="x86_64"
TARGET_GCC_ARCH="${TARGET_SUBARCH/-/}"
TARGET_KERNEL_ARCH=x86
TARGET_KERNEL_ARCH="x86"
# setup ARCH specific *FLAGS
TARGET_CFLAGS="-march=$TARGET_CPU"
TARGET_LDFLAGS="-march=$TARGET_CPU"
TARGET_CFLAGS="-march=${TARGET_CPU}"
TARGET_LDFLAGS="-march=${TARGET_CPU}"
# build with SIMD support ( yes / no )
TARGET_FEATURES+=" mmx sse sse2"
# build with microarchitecture feature support defined by the TARGET_CPU value
# see https://gitlab.com/x86-psABIs/x86-64-ABI/-/wikis/home for further details
TARGET_FEATURES="64bit cmov cx8 fpu fxsr mmx osfxsr sce sse sse2"
TARGET_FEATURES_X86_64_V2="cmpxchg16b lahf-sahf popcnt sse3 sse4_1 sse4_2 ssse3"
TARGET_FEATURES_X86_64_V3="avx avx2 bmi1 bmi2 f16c fma lzcnt movbe osxsave"
if [ "${TARGET_CPU}" = "x86-64" ]; then
TARGET_FEATURES+=" no_sahf"
elif [ "${TARGET_CPU}" = "x86-64-v2" ]; then
TARGET_FEATURES+=" ${TARGET_FEATURES_X86_64_V2}"
elif [ "${TARGET_CPU}" = "x86-64-v3" ]; then
TARGET_FEATURES+=" ${TARGET_FEATURES_X86_64_V2} ${TARGET_FEATURES_X86_64_V3}"
else
TARGET_FEATURES+=" UNKNOWN_ADDITIONAL_CPU_SPECIFIC_FEATURES"
fi
TARGET_FEATURES="$(echo ${TARGET_FEATURES} | xargs -n1 | sort -u | xargs)"

View File

@ -6,10 +6,15 @@
# generated code.
case $TARGET_ARCH in
x86_64)
# (AMD CPUs) k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3
# athlon-fx amdfam10 barcelona
# (Intel CPUs) atom core2 nocona
# Valid TARGET_CPU values as defined at:
# https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
# x86-64 A generic CPU with 64-bit extensions.
#
# x86-64-v2 e.g. AMD CPU - Bulldozer - (bdver1)
# Intel CPU - Nehalem - (nehalem)
#
# x86-64-v3 e.g. AMD CPU - Bulldozer GEN4 - (bdver4)
# Intel CPU - Haswell - (haswell)
TARGET_CPU="x86-64"
;;
esac