Define __SSE4A__ when targeting new AMD CPUs.
This doesn't really fit the existing SSELevel so it gets an extra flag. llvm-svn: 157630
This commit is contained in:
parent
64fe1c559e
commit
8ac9c22391
|
@ -1242,6 +1242,7 @@ class X86TargetInfo : public TargetInfo {
|
|||
bool HasBMI;
|
||||
bool HasBMI2;
|
||||
bool HasPOPCNT;
|
||||
bool HasSSE4a;
|
||||
bool HasFMA4;
|
||||
|
||||
/// \brief Enumeration of all of the X86 CPUs supported by Clang.
|
||||
|
@ -1388,7 +1389,7 @@ public:
|
|||
X86TargetInfo(const std::string& triple)
|
||||
: TargetInfo(triple), SSELevel(NoSSE), MMX3DNowLevel(NoMMX3DNow),
|
||||
HasAES(false), HasLZCNT(false), HasBMI(false), HasBMI2(false),
|
||||
HasPOPCNT(false), HasFMA4(false), CPU(CK_Generic) {
|
||||
HasPOPCNT(false), HasSSE4a(false), HasFMA4(false), CPU(CK_Generic) {
|
||||
BigEndian = false;
|
||||
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
|
||||
}
|
||||
|
@ -1843,6 +1844,11 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Feature == "sse4a") {
|
||||
HasSSE4a = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Feature == "fma4") {
|
||||
HasFMA4 = true;
|
||||
continue;
|
||||
|
@ -2042,6 +2048,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
|
|||
if (HasPOPCNT)
|
||||
Builder.defineMacro("__POPCNT__");
|
||||
|
||||
if (HasSSE4a)
|
||||
Builder.defineMacro("__SSE4A__");
|
||||
|
||||
if (HasFMA4)
|
||||
Builder.defineMacro("__FMA4__");
|
||||
|
||||
|
@ -2108,6 +2117,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const {
|
|||
.Case("avx2", SSELevel >= AVX2)
|
||||
.Case("bmi", HasBMI)
|
||||
.Case("bmi2", HasBMI2)
|
||||
.Case("sse4a", HasSSE4a)
|
||||
.Case("fma4", HasFMA4)
|
||||
.Case("lzcnt", HasLZCNT)
|
||||
.Case("mm3dnow", MMX3DNowLevel >= AMD3DNow)
|
||||
|
|
|
@ -940,5 +940,47 @@
|
|||
// CHECK_ATHLON_FX_M64: #define __tune_k8__ 1
|
||||
// CHECK_ATHLON_FX_M64: #define __x86_64 1
|
||||
// CHECK_ATHLON_FX_M64: #define __x86_64__ 1
|
||||
// RUN: %clang -march=amdfam10 -m64 -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target i386-unknown-linux \
|
||||
// RUN: | FileCheck %s -check-prefix=CHECK_AMDFAM10_M64
|
||||
// CHECK_AMDFAM10_M64: #define __3dNOW_A__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __3dNOW__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __MMX__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE2_MATH__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE2__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE3__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE4A__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE_MATH__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __SSE__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __amd64 1
|
||||
// CHECK_AMDFAM10_M64: #define __amd64__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __amdfam10 1
|
||||
// CHECK_AMDFAM10_M64: #define __amdfam10__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __tune_amdfam10__ 1
|
||||
// CHECK_AMDFAM10_M64: #define __x86_64 1
|
||||
// CHECK_AMDFAM10_M64: #define __x86_64__ 1
|
||||
// RUN: %clang -march=bdver1 -m64 -E -dM %s -o - 2>&1 \
|
||||
// RUN: -target i386-unknown-linux \
|
||||
// RUN: | FileCheck %s -check-prefix=CHECK_BDVER1_M64
|
||||
// CHECK_BDVER1_M64: #define __AVX__ 1
|
||||
// CHECK_BDVER1_M64-NOT: #define __3dNOW_A__ 1
|
||||
// CHECK_BDVER1_M64-NOT: #define __3dNOW__ 1
|
||||
// CHECK_BDVER1_M64: #define __MMX__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE2_MATH__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE2__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE3__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE4A__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE4_1__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE4_2__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE_MATH__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSE__ 1
|
||||
// CHECK_BDVER1_M64: #define __SSSE3__ 1
|
||||
// CHECK_BDVER1_M64: #define __amd64 1
|
||||
// CHECK_BDVER1_M64: #define __amd64__ 1
|
||||
// CHECK_BDVER1_M64: #define __bdver1 1
|
||||
// CHECK_BDVER1_M64: #define __bdver1__ 1
|
||||
// CHECK_BDVER1_M64: #define __tune_bdver1__ 1
|
||||
// CHECK_BDVER1_M64: #define __x86_64 1
|
||||
// CHECK_BDVER1_M64: #define __x86_64__ 1
|
||||
//
|
||||
// End X86/GCC/Linux tests ------------------
|
||||
|
|
Loading…
Reference in New Issue