Index: lib/Basic/Targets/X86.h =================================================================== --- lib/Basic/Targets/X86.h +++ lib/Basic/Targets/X86.h @@ -203,6 +203,10 @@ /// 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 @@ case CK_SkylakeServer: case CK_Cannonlake: case CK_KNL: + case CK_KNM: case CK_K8: case CK_K8SSE3: case CK_AMDFAM10: Index: lib/Basic/Targets/X86.cpp =================================================================== --- lib/Basic/Targets/X86.cpp +++ lib/Basic/Targets/X86.cpp @@ -229,6 +229,7 @@ setFeatureEnabledImpl(Features, "cx16", true); break; + case CK_KNM: case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -853,6 +854,9 @@ case CK_KNL: defineCPUMacros(Builder, "knl"); break; + case CK_KNM: + defineCPUMacros(Builder, "knm"); + break; case CK_Lakemont: Builder.defineMacro("__tune_lakemont__"); break; @@ -1552,6 +1556,7 @@ .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) Index: test/Driver/x86-march.c =================================================================== --- test/Driver/x86-march.c +++ 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" Index: test/Preprocessor/predefined-arch-macros.c =================================================================== --- test/Preprocessor/predefined-arch-macros.c +++ 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 \