[cfe-commits] r71123 - in /cfe/trunk: lib/Basic/Targets.cpp test/Preprocessor/x86_target_features.c
Daniel Dunbar
daniel at zuster.org
Wed May 6 14:56:33 PDT 2009
Author: ddunbar
Date: Wed May 6 16:56:32 2009
New Revision: 71123
URL: http://llvm.org/viewvc/llvm-project?rev=71123&view=rev
Log:
Handle -march for the LLVM recognized cpu names.
- x86 target feature handling should not be feature complete, even if
the code quality is lacking.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/x86_target_features.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=71123&r1=71122&r2=71123&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed May 6 16:56:32 2009
@@ -562,16 +562,41 @@
if (PointerWidth == 64)
Features["sse2"] = Features["sse"] = Features["mmx"] = true;
- // FIXME: LLVM says core2 has SSSE3, but gcc doesn't define
- // __SSSE3__ with it? What else is going on here?
- if (CPU == "core2")
- Features["ssse3"] = Features["sse3"] = Features["sse2"] = Features["sse"] =
- Features["mmx"] = true;
- else if (CPU == "yonah")
- Features["sse3"] = Features["sse2"] = Features["sse"] =
- Features["mmx"] = true;
- else if (CPU == "pentium4")
- Features["sse2"] = Features["sse"] = Features["mmx"] = true;
+ if (CPU == "generic" || CPU == "i386" || CPU == "i486" || CPU == "i586" ||
+ CPU == "pentium" || CPU == "i686" || CPU == "pentiumpro")
+ ;
+ else if (CPU == "pentium-mmx" || CPU == "pentium2")
+ setFeatureEnabled(Features, "mmx", true);
+ else if (CPU == "pentium3")
+ setFeatureEnabled(Features, "sse", true);
+ else if (CPU == "pentium-m" || CPU == "pentium4" || CPU == "x86-64")
+ setFeatureEnabled(Features, "sse2", true);
+ else if (CPU == "yonah" || CPU == "prescott" || CPU == "nocona")
+ setFeatureEnabled(Features, "sse3", true);
+ else if (CPU == "core2")
+ setFeatureEnabled(Features, "ssse3", true);
+ else if (CPU == "penryn") {
+ setFeatureEnabled(Features, "sse4", true);
+ Features["sse42"] = false;
+ } else if (CPU == "atom")
+ setFeatureEnabled(Features, "sse3", true);
+ else if (CPU == "corei7")
+ setFeatureEnabled(Features, "sse4", true);
+ else if (CPU == "k6" || CPU == "winchip-c6")
+ setFeatureEnabled(Features, "mmx", true);
+ else if (CPU == "k6-2" || CPU == "k6-3" || CPU == "athlon" ||
+ CPU == "athlon-tbird" || CPU == "winchip2" || CPU == "c3") {
+ setFeatureEnabled(Features, "mmx", true);
+ setFeatureEnabled(Features, "3dnow", true);
+ } else if (CPU == "athlon-4" || CPU == "athlon-xp" || CPU == "athlon-mp") {
+ setFeatureEnabled(Features, "sse", true);
+ setFeatureEnabled(Features, "3dnowa", true);
+ } else if (CPU == "k8" || CPU == "opteron" || CPU == "athlon64" ||
+ CPU == "athlon-fx") {
+ setFeatureEnabled(Features, "sse2", true);
+ setFeatureEnabled(Features, "3dnowa", true);
+ } else if (CPU == "c3-2")
+ setFeatureEnabled(Features, "sse", true);
}
bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
Modified: cfe/trunk/test/Preprocessor/x86_target_features.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/x86_target_features.c?rev=71123&r1=71122&r2=71123&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/x86_target_features.c (original)
+++ cfe/trunk/test/Preprocessor/x86_target_features.c Wed May 6 16:56:32 2009
@@ -20,6 +20,16 @@
// RUN: grep '#define __SSE__ 1' %t &&
// RUN: grep '#define __SSSE3__ 1' %t | count 0 &&
+// RUN: clang -ccc-host-triple i386-unknown-unknown -march=pentium-m -x c -E -dM -o %t %s &&
+// RUN: grep '#define __SSE2_MATH__ 1' %t &&
+// RUN: grep '#define __SSE2__ 1' %t &&
+// RUN: grep '#define __SSE3__ 1' %t | count 0 &&
+// RUN: grep '#define __SSE4_1__ 1' %t | count 0 &&
+// RUN: grep '#define __SSE4_2__ 1' %t | count 0 &&
+// RUN: grep '#define __SSE_MATH__ 1' %t &&
+// RUN: grep '#define __SSE__ 1' %t &&
+// RUN: grep '#define __SSSE3__ 1' %t | count 0 &&
+
// RUN: true
More information about the cfe-commits
mailing list