From a046ef4c2610131fc840bcd383bdd760eab78bfc Mon Sep 17 00:00:00 2001 From: Michael Zuckerman Date: Thu, 29 Jun 2017 13:41:04 +0000 Subject: [PATCH] [Clang][X86][Goldmont]Adding new target-cpu: Goldmont [Clang-side] Connecting the GoldMont processor to his feature. Reviewers: 1. igorb 2. delena 3. zvi Differential Revision: https://reviews.llvm.org/D34807 llvm-svn: 306673 --- clang/lib/Basic/Targets.cpp | 21 ++++++ .../Preprocessor/predefined-arch-macros.c | 73 +++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 02ded70b2011..840cb1228b65 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -2737,6 +2737,7 @@ class X86TargetInfo : public TargetInfo { //@{ CK_Bonnell, CK_Silvermont, + CK_Goldmont, //@} /// \name Nehalem @@ -2878,6 +2879,7 @@ class X86TargetInfo : public TargetInfo { .Case("atom", CK_Bonnell) // Legacy name. .Case("silvermont", CK_Silvermont) .Case("slm", CK_Silvermont) // Legacy name. + .Case("goldmont", CK_Goldmont) .Case("nehalem", CK_Nehalem) .Case("corei7", CK_Nehalem) // Legacy name. .Case("westmere", CK_Westmere) @@ -3093,6 +3095,7 @@ public: case CK_Penryn: case CK_Bonnell: case CK_Silvermont: + case CK_Goldmont: case CK_Nehalem: case CK_Westmere: case CK_SandyBridge: @@ -3285,6 +3288,21 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "fxsr", true); setFeatureEnabledImpl(Features, "cx16", true); break; + case CK_Goldmont: + setFeatureEnabledImpl(Features, "sha", true); + setFeatureEnabledImpl(Features, "rdseed", true); + setFeatureEnabledImpl(Features, "xsave", true); + setFeatureEnabledImpl(Features, "xsaveopt", true); + setFeatureEnabledImpl(Features, "xsavec", true); + setFeatureEnabledImpl(Features, "xsaves", true); + setFeatureEnabledImpl(Features, "clflushopt", true); + setFeatureEnabledImpl(Features, "mpx", true); + setFeatureEnabledImpl(Features, "aes", true); + setFeatureEnabledImpl(Features, "pclmul", true); + setFeatureEnabledImpl(Features, "sse4.2", true); + setFeatureEnabledImpl(Features, "fxsr", true); + setFeatureEnabledImpl(Features, "cx16", true); + break; case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -3893,6 +3911,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, case CK_Silvermont: defineCPUMacros(Builder, "slm"); break; + case CK_Goldmont: + defineCPUMacros(Builder, "goldmont"); + break; case CK_Nehalem: case CK_Westmere: case CK_SandyBridge: diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index 08f4d2573f40..146d005f3f96 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -986,6 +986,79 @@ // CHECK_ATOM_M64: #define __x86_64 1 // CHECK_ATOM_M64: #define __x86_64__ 1 // +// RUN: %clang -march=goldmont -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_GLM_M32 +// CHECK_GLM_M32: #define __AES__ 1 +// CHECK_GLM_M32: #define __CLFLUSHOPT__ 1 +// CHECK_GLM_M32: #define __FXSR__ 1 +// CHECK_GLM_M32: #define __MMX__ 1 +// CHECK_GLM_M32: #define __MPX__ 1 +// CHECK_GLM_M32: #define __PCLMUL__ 1 +// CHECK_GLM_M32: #define __POPCNT__ 1 +// CHECK_GLM_M32: #define __RDSEED__ 1 +// CHECK_GLM_M32: #define __SHA__ 1 +// CHECK_GLM_M32: #define __SSE2__ 1 +// CHECK_GLM_M32: #define __SSE3__ 1 +// CHECK_GLM_M32: #define __SSE4_1__ 1 +// CHECK_GLM_M32: #define __SSE4_2__ 1 +// CHECK_GLM_M32: #define __SSE_MATH__ 1 +// CHECK_GLM_M32: #define __SSE__ 1 +// CHECK_GLM_M32: #define __SSSE3__ 1 +// CHECK_GLM_M32: #define __XSAVEC__ 1 +// CHECK_GLM_M32: #define __XSAVEOPT__ 1 +// CHECK_GLM_M32: #define __XSAVES__ 1 +// CHECK_GLM_M32: #define __XSAVE__ 1 +// CHECK_GLM_M32: #define __clang__ 1 +// CHECK_GLM_M32: #define __goldmont 1 +// CHECK_GLM_M32: #define __goldmont__ 1 +// CHECK_GLM_M32: #define __i386 1 +// CHECK_GLM_M32: #define __i386__ 1 +// CHECK_GLM_M32: #define __linux 1 +// CHECK_GLM_M32: #define __linux__ 1 +// CHECK_GLM_M32: #define __llvm__ 1 +// CHECK_GLM_M32: #define __tune_goldmont__ 1 +// CHECK_GLM_M32: #define __unix 1 +// CHECK_GLM_M32: #define __unix__ 1 +// CHECK_GLM_M32: #define i386 1 +// CHECK_GLM_M32: #define linux 1 +// CHECK_GLM_M32: #define unix 1 +// +// RUN: %clang -march=goldmont -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_GLM_M64 +// CHECK_GLM_M64: #define __AES__ 1 +// CHECK_GLM_M64: #define __CLFLUSHOPT__ 1 +// CHECK_GLM_M64: #define __FXSR__ 1 +// CHECK_GLM_M64: #define __MMX__ 1 +// CHECK_GLM_M64: #define __MPX__ 1 +// CHECK_GLM_M64: #define __PCLMUL__ 1 +// CHECK_GLM_M64: #define __POPCNT__ 1 +// CHECK_GLM_M64: #define __RDSEED__ 1 +// CHECK_GLM_M64: #define __SSE2__ 1 +// CHECK_GLM_M64: #define __SSE3__ 1 +// CHECK_GLM_M64: #define __SSE4_1__ 1 +// CHECK_GLM_M64: #define __SSE4_2__ 1 +// CHECK_GLM_M64: #define __SSE__ 1 +// CHECK_GLM_M64: #define __SSSE3__ 1 +// CHECK_GLM_M64: #define __XSAVEC__ 1 +// CHECK_GLM_M64: #define __XSAVEOPT__ 1 +// CHECK_GLM_M64: #define __XSAVES__ 1 +// CHECK_GLM_M64: #define __XSAVE__ 1 +// CHECK_GLM_M64: #define __gnu_linux__ 1 +// CHECK_GLM_M64: #define __goldmont 1 +// CHECK_GLM_M64: #define __goldmont__ 1 +// CHECK_GLM_M64: #define __linux 1 +// CHECK_GLM_M64: #define __linux__ 1 +// CHECK_GLM_M64: #define __llvm__ 1 +// CHECK_GLM_M64: #define __tune_goldmont__ 1 +// CHECK_GLM_M64: #define __unix 1 +// CHECK_GLM_M64: #define __unix__ 1 +// CHECK_GLM_M64: #define __x86_64 1 +// CHECK_GLM_M64: #define __x86_64__ 1 +// CHECK_GLM_M64: #define linux 1 +// CHECK_GLM_M64: #define unix 1 +// // RUN: %clang -march=slm -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_SLM_M32