Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2722,6 +2722,7 @@ //@{ CK_Bonnell, CK_Silvermont, + CK_Goldmont, //@} /// \name Nehalem @@ -2863,6 +2864,8 @@ .Case("atom", CK_Bonnell) // Legacy name. .Case("silvermont", CK_Silvermont) .Case("slm", CK_Silvermont) // Legacy name. + .Case("goldmont", CK_Goldmont) + .Case("glm", CK_Goldmont) .Case("nehalem", CK_Nehalem) .Case("corei7", CK_Nehalem) // Legacy name. .Case("westmere", CK_Westmere) @@ -3078,6 +3081,7 @@ case CK_Penryn: case CK_Bonnell: case CK_Silvermont: + case CK_Goldmont: case CK_Nehalem: case CK_Westmere: case CK_SandyBridge: @@ -3270,6 +3274,22 @@ 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); + setFeatureEnabledImpl(Features, "fsgsbase", true); + break; case CK_KNL: setFeatureEnabledImpl(Features, "avx512f", true); setFeatureEnabledImpl(Features, "avx512cd", true); @@ -3878,6 +3898,10 @@ case CK_Silvermont: defineCPUMacros(Builder, "slm"); break; + case CK_Goldmont: + defineCPUMacros(Builder, "glm"); + defineCPUMacros(Builder, "goldmont"); + break; case CK_Nehalem: case CK_Westmere: case CK_SandyBridge: Index: test/Preprocessor/predefined-arch-macros.c =================================================================== --- test/Preprocessor/predefined-arch-macros.c +++ test/Preprocessor/predefined-arch-macros.c @@ -986,6 +986,53 @@ // 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 __FSGSBASE__ 1 +// CHECK_GLM_M32: #define __MMX__ 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__ 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 __goldmont 1 +// CHECK_GLM_M32: #define __goldmont__ 1 +// CHECK_GLM_M32: #define __i386 1 +// CHECK_GLM_M32: #define __i386__ 1 +// CHECK_GLM_M32: #define __tune_goldmont__ 1 +// CHECK_GLM_M32: #define i386 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 __FSGSBASE__ 1 +// CHECK_GLM_M64: #define __MMX__ 1 +// CHECK_GLM_M64: #define __RDSEED__ 1 +// CHECK_GLM_M64: #define __SHA__ 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 __goldmont 1 +// CHECK_GLM_M64: #define __goldmont__ 1 +// CHECK_GLM_M64: #define __tune_goldmont__ 1 +// CHECK_GLM_M64: #define __x86_64 1 +// CHECK_GLM_M64: #define __x86_64__ 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