From 35d4939701da2bd16becfb845842e04ba254ce5e Mon Sep 17 00:00:00 2001 From: SupervisedThinking Date: Fri, 17 Jun 2022 20:09:44 +0200 Subject: [PATCH] config/arch.x86_64: updated TARGET_CPU & TARGET_FEATURES --- config/arch.x86_64 | 36 +++++++++++++++++++++--------------- projects/Generic/options | 11 ++++++++--- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/config/arch.x86_64 b/config/arch.x86_64 index d4e246cead..531c4c25a0 100644 --- a/config/arch.x86_64 +++ b/config/arch.x86_64 @@ -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)" diff --git a/projects/Generic/options b/projects/Generic/options index 80b0cb29ef..841334559b 100644 --- a/projects/Generic/options +++ b/projects/Generic/options @@ -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