From: Craig Topper Date: Fri, 13 Oct 2017 18:14:24 +0000 (+0000) Subject: [X86] Add skeleton support for knm cpu X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53db9fb63312c1a4ddd118089ceb82ee88c62796;p=clang [X86] Add skeleton support for knm cpu This adds support Knights Mill CPU. Preprocessor defines match gcc's implementation. Differential Revision: https://reviews.llvm.org/D38813 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315723 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets/X86.cpp b/lib/Basic/Targets/X86.cpp index 8e2f5940bb..6eee2facda 100644 --- a/lib/Basic/Targets/X86.cpp +++ b/lib/Basic/Targets/X86.cpp @@ -229,6 +229,8 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "cx16", true); break; + case CK_KNM: + // TODO: Add avx5124fmaps/avx5124vnniw. case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -853,6 +855,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_KNL: defineCPUMacros(Builder, "knl"); break; + case CK_KNM: + break; case CK_Lakemont: Builder.defineMacro("__tune_lakemont__"); break; @@ -1553,6 +1557,7 @@ X86TargetInfo::CPUKind X86TargetInfo::getCPUKind(StringRef CPU) const { .Cases("skylake-avx512", "skx", CK_SkylakeServer) .Case("cannonlake", CK_Cannonlake) .Case("knl", CK_KNL) + .Case("knm", CK_KNM) .Case("lakemont", CK_Lakemont) .Case("k6", CK_K6) .Case("k6-2", CK_K6_2) diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h index 38fb0c66f6..3b405dc762 100644 --- a/lib/Basic/Targets/X86.h +++ b/lib/Basic/Targets/X86.h @@ -203,6 +203,10 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { /// Knights Landing processor. CK_KNL, + /// \name Knights Mill + /// Knights Mill processor. + CK_KNM, + /// \name Lakemont /// Lakemont microarchitecture based processors. CK_Lakemont, @@ -321,6 +325,7 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { case CK_SkylakeServer: case CK_Cannonlake: case CK_KNL: + case CK_KNM: case CK_K8: case CK_K8SSE3: case CK_AMDFAM10: diff --git a/test/Driver/x86-march.c b/test/Driver/x86-march.c index b12bf405b0..8236b2f1ef 100644 --- a/test/Driver/x86-march.c +++ b/test/Driver/x86-march.c @@ -52,6 +52,10 @@ // RUN: | FileCheck %s -check-prefix=knl // knl: "-target-cpu" "knl" // +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=knm 2>&1 \ +// RUN: | FileCheck %s -check-prefix=knm +// knm: "-target-cpu" "knm" +// // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=cannonlake 2>&1 \ // RUN: | FileCheck %s -check-prefix=cannonlake // cannonlake: "-target-cpu" "cannonlake" diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c index 55e5b4a222..cc2d29508f 100644 --- a/test/Preprocessor/predefined-arch-macros.c +++ b/test/Preprocessor/predefined-arch-macros.c @@ -783,6 +783,81 @@ // CHECK_KNL_M64: #define __tune_knl__ 1 // CHECK_KNL_M64: #define __x86_64 1 // CHECK_KNL_M64: #define __x86_64__ 1 + +// RUN: %clang -march=knm -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_KNM_M32 +// CHECK_KNM_M32: #define __AES__ 1 +// CHECK_KNM_M32: #define __AVX2__ 1 +// CHECK_KNM_M32: #define __AVX512CD__ 1 +// CHECK_KNM_M32: #define __AVX512ER__ 1 +// CHECK_KNM_M32: #define __AVX512F__ 1 +// CHECK_KNM_M32: #define __AVX512PF__ 1 +// CHECK_KNM_M32: #define __AVX__ 1 +// CHECK_KNM_M32: #define __BMI2__ 1 +// CHECK_KNM_M32: #define __BMI__ 1 +// CHECK_KNM_M32: #define __F16C__ 1 +// CHECK_KNM_M32: #define __FMA__ 1 +// CHECK_KNM_M32: #define __LZCNT__ 1 +// CHECK_KNM_M32: #define __MMX__ 1 +// CHECK_KNM_M32: #define __PCLMUL__ 1 +// CHECK_KNM_M32: #define __POPCNT__ 1 +// CHECK_KNM_M32: #define __PREFETCHWT1__ 1 +// CHECK_KNM_M32: #define __RDRND__ 1 +// CHECK_KNM_M32: #define __RTM__ 1 +// CHECK_KNM_M32: #define __SSE2__ 1 +// CHECK_KNM_M32: #define __SSE3__ 1 +// CHECK_KNM_M32: #define __SSE4_1__ 1 +// CHECK_KNM_M32: #define __SSE4_2__ 1 +// CHECK_KNM_M32: #define __SSE__ 1 +// CHECK_KNM_M32: #define __SSSE3__ 1 +// CHECK_KNM_M32: #define __XSAVEOPT__ 1 +// CHECK_KNM_M32: #define __XSAVE__ 1 +// CHECK_KNM_M32: #define __i386 1 +// CHECK_KNM_M32: #define __i386__ 1 +// CHECK_KNM_M32: #define __knm 1 +// CHECK_KNM_M32: #define __knm__ 1 +// CHECK_KNM_M32: #define __tune_knm__ 1 +// CHECK_KNM_M32: #define i386 1 + +// RUN: %clang -march=knm -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_KNM_M64 +// CHECK_KNM_M64: #define __AES__ 1 +// CHECK_KNM_M64: #define __AVX2__ 1 +// CHECK_KNM_M64: #define __AVX512CD__ 1 +// CHECK_KNM_M64: #define __AVX512ER__ 1 +// CHECK_KNM_M64: #define __AVX512F__ 1 +// CHECK_KNM_M64: #define __AVX512PF__ 1 +// CHECK_KNM_M64: #define __AVX__ 1 +// CHECK_KNM_M64: #define __BMI2__ 1 +// CHECK_KNM_M64: #define __BMI__ 1 +// CHECK_KNM_M64: #define __F16C__ 1 +// CHECK_KNM_M64: #define __FMA__ 1 +// CHECK_KNM_M64: #define __LZCNT__ 1 +// CHECK_KNM_M64: #define __MMX__ 1 +// CHECK_KNM_M64: #define __PCLMUL__ 1 +// CHECK_KNM_M64: #define __POPCNT__ 1 +// CHECK_KNM_M64: #define __PREFETCHWT1__ 1 +// CHECK_KNM_M64: #define __RDRND__ 1 +// CHECK_KNM_M64: #define __RTM__ 1 +// CHECK_KNM_M64: #define __SSE2_MATH__ 1 +// CHECK_KNM_M64: #define __SSE2__ 1 +// CHECK_KNM_M64: #define __SSE3__ 1 +// CHECK_KNM_M64: #define __SSE4_1__ 1 +// CHECK_KNM_M64: #define __SSE4_2__ 1 +// CHECK_KNM_M64: #define __SSE_MATH__ 1 +// CHECK_KNM_M64: #define __SSE__ 1 +// CHECK_KNM_M64: #define __SSSE3__ 1 +// CHECK_KNM_M64: #define __XSAVEOPT__ 1 +// CHECK_KNM_M64: #define __XSAVE__ 1 +// CHECK_KNM_M64: #define __amd64 1 +// CHECK_KNM_M64: #define __amd64__ 1 +// CHECK_KNM_M64: #define __knm 1 +// CHECK_KNM_M64: #define __knm__ 1 +// CHECK_KNM_M64: #define __tune_knm__ 1 +// CHECK_KNM_M64: #define __x86_64 1 +// CHECK_KNM_M64: #define __x86_64__ 1 // // RUN: %clang -march=skylake-avx512 -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \