[cfe-commits] r157630 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/predefined-arch-macros.c
Benjamin Kramer
benny.kra at googlemail.com
Tue May 29 10:48:39 PDT 2012
Author: d0k
Date: Tue May 29 12:48:39 2012
New Revision: 157630
URL: http://llvm.org/viewvc/llvm-project?rev=157630&view=rev
Log:
Define __SSE4A__ when targeting new AMD CPUs.
This doesn't really fit the existing SSELevel so it gets an extra flag.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/predefined-arch-macros.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=157630&r1=157629&r2=157630&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue May 29 12:48:39 2012
@@ -1242,6 +1242,7 @@
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 @@
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 @@
continue;
}
+ if (Feature == "sse4a") {
+ HasSSE4a = true;
+ continue;
+ }
+
if (Feature == "fma4") {
HasFMA4 = true;
continue;
@@ -2042,6 +2048,9 @@
if (HasPOPCNT)
Builder.defineMacro("__POPCNT__");
+ if (HasSSE4a)
+ Builder.defineMacro("__SSE4A__");
+
if (HasFMA4)
Builder.defineMacro("__FMA4__");
@@ -2108,6 +2117,7 @@
.Case("avx2", SSELevel >= AVX2)
.Case("bmi", HasBMI)
.Case("bmi2", HasBMI2)
+ .Case("sse4a", HasSSE4a)
.Case("fma4", HasFMA4)
.Case("lzcnt", HasLZCNT)
.Case("mm3dnow", MMX3DNowLevel >= AMD3DNow)
Modified: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/predefined-arch-macros.c?rev=157630&r1=157629&r2=157630&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Tue May 29 12:48:39 2012
@@ -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 ------------------
More information about the cfe-commits
mailing list