r265405 - [X86] Introduction of -march=lakemont.
Andrey Turetskiy via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 5 08:04:27 PDT 2016
Author: aturetsk
Date: Tue Apr 5 10:04:26 2016
New Revision: 265405
URL: http://llvm.org/viewvc/llvm-project?rev=265405&view=rev
Log:
[X86] Introduction of -march=lakemont.
Differential Revision: http://reviews.llvm.org/D18651
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/attr-target-x86.c
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=265405&r1=265404&r2=265405&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Apr 5 10:04:26 2016
@@ -2239,6 +2239,10 @@ class X86TargetInfo : public TargetInfo
/// Knights Landing processor.
CK_KNL,
+ /// \name Lakemont
+ /// Lakemont microarchitecture based processors.
+ CK_Lakemont,
+
/// \name K6
/// K6 architecture processors.
//@{
@@ -2343,6 +2347,7 @@ class X86TargetInfo : public TargetInfo
.Case("skx", CK_SkylakeServer) // Legacy name.
.Case("cannonlake", CK_Cannonlake)
.Case("knl", CK_KNL)
+ .Case("lakemont", CK_Lakemont)
.Case("k6", CK_K6)
.Case("k6-2", CK_K6_2)
.Case("k6-3", CK_K6_3)
@@ -2490,6 +2495,7 @@ public:
case CK_C3_2:
case CK_Pentium4:
case CK_Pentium4M:
+ case CK_Lakemont:
case CK_Prescott:
case CK_K6:
case CK_K6_2:
@@ -2588,10 +2594,13 @@ bool X86TargetInfo::initFeatureMap(
if (getTriple().getArch() == llvm::Triple::x86_64)
setFeatureEnabledImpl(Features, "sse2", true);
- // Enable X87 for all X86 processors.
- setFeatureEnabledImpl(Features, "x87", true);
+ const CPUKind Kind = getCPUKind(CPU);
+
+ // Enable X87 for all X86 processors but Lakemont.
+ if (Kind != CK_Lakemont)
+ setFeatureEnabledImpl(Features, "x87", true);
- switch (getCPUKind(CPU)) {
+ switch (Kind) {
case CK_Generic:
case CK_i386:
case CK_i486:
@@ -2599,6 +2608,7 @@ bool X86TargetInfo::initFeatureMap(
case CK_Pentium:
case CK_i686:
case CK_PentiumPro:
+ case CK_Lakemont:
break;
case CK_PentiumMMX:
case CK_Pentium2:
@@ -3253,6 +3263,9 @@ void X86TargetInfo::getTargetDefines(con
case CK_KNL:
defineCPUMacros(Builder, "knl");
break;
+ case CK_Lakemont:
+ Builder.defineMacro("__tune_lakemont__");
+ break;
case CK_K6_2:
Builder.defineMacro("__k6_2__");
Builder.defineMacro("__tune_k6_2__");
Modified: cfe/trunk/test/CodeGen/attr-target-x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target-x86.c?rev=265405&r1=265404&r2=265405&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attr-target-x86.c (original)
+++ cfe/trunk/test/CodeGen/attr-target-x86.c Tue Apr 5 10:04:26 2016
@@ -18,6 +18,8 @@ int __attribute__((target("no-aes, arch=
int __attribute__((target("no-mmx"))) qq(int a) { return 40; }
+int __attribute__((target("arch=lakemont"))) lake(int a) { return 4; }
+
// Check that we emit the additional subtarget and cpu features for foo and not for baz or bar.
// CHECK: baz{{.*}} #0
// CHECK: foo{{.*}} #1
@@ -31,9 +33,11 @@ int __attribute__((target("no-mmx"))) qq
// CHECK: qux{{.*}} #1
// CHECK: qax{{.*}} #4
// CHECK: qq{{.*}} #5
+// CHECK: lake{{.*}} #6
// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87"
// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt"
// CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+x87,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop,-xsave,-xsaveopt"
// CHECK: #3 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87"
// CHECK: #4 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes"
// CHECK: #5 = {{.*}}"target-cpu"="x86-64" "target-features"="+fxsr,+sse,+sse2,+x87,-3dnow,-3dnowa,-mmx"
+// CHECK: #6 = {{.*}}"target-cpu"="lakemont" "target-features"="+mmx,+sse,+sse2"
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=265405&r1=265404&r2=265405&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c (original)
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c Tue Apr 5 10:04:26 2016
@@ -1004,6 +1004,18 @@
// CHECK_SLM_M64: #define __x86_64 1
// CHECK_SLM_M64: #define __x86_64__ 1
//
+// RUN: %clang -march=lakemont -m32 -E -dM %s -o - 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: | FileCheck %s -check-prefix=CHECK_LMT_M32
+// CHECK_LMT_M32: #define __i386 1
+// CHECK_LMT_M32: #define __i386__ 1
+// CHECK_LMT_M32: #define __tune_lakemont__ 1
+// CHECK_LMT_M32: #define i386 1
+// RUN: not %clang -march=lakemont -m64 -E -dM %s -o - 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: | FileCheck %s -check-prefix=CHECK_LMT_M64
+// CHECK_LMT_M64: error:
+//
// RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \
// RUN: -target i386-unknown-linux \
// RUN: | FileCheck -match-full-lines %s -check-prefix=CHECK_GEODE_M32
More information about the cfe-commits
mailing list