[cfe-commits] r65886 - /cfe/trunk/lib/Basic/Targets.cpp
Chris Lattner
sabre at nondot.org
Mon Mar 2 14:40:39 PST 2009
Author: lattner
Date: Mon Mar 2 16:40:39 2009
New Revision: 65886
URL: http://llvm.org/viewvc/llvm-project?rev=65886&view=rev
Log:
Add plumbing to support programatically defining __SSE2__ and friends,
even though we still hard code sse2 for now. No support for 3dnow or sse4a,
but someone could add that if they desired.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=65886&r1=65885&r2=65886&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Mar 2 16:40:39 2009
@@ -415,8 +415,12 @@
// X86 target abstract base class; x86-32 and x86-64 are very close, so
// most of the implementation can be shared.
class X86TargetInfo : public TargetInfo {
+ enum X86SSEEnum {
+ NoMMXSSE, MMX, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42
+ } SSELevel;
public:
- X86TargetInfo(const std::string& triple) : TargetInfo(triple) {
+ X86TargetInfo(const std::string& triple)
+ : TargetInfo(triple), SSELevel(SSE2) {
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
@@ -485,12 +489,29 @@
Define(Defs, "__nocona");
Define(Defs, "__nocona__");
Define(Defs, "__tune_nocona__");
- Define(Defs, "__SSE2_MATH__");
- Define(Defs, "__SSE2__");
- Define(Defs, "__SSE_MATH__");
- Define(Defs, "__SSE__");
- Define(Defs, "__MMX__");
Define(Defs, "__REGISTER_PREFIX__", "");
+
+ // Each case falls through to the previous one here.
+ switch (SSELevel) {
+ case SSE42:
+ Define(Defs, "__SSE4_2__");
+ case SSE41:
+ Define(Defs, "__SSE4_1__");
+ case SSSE3:
+ Define(Defs, "__SSSE3__");
+ case SSE3:
+ Define(Defs, "__SSE3__");
+ case SSE2:
+ Define(Defs, "__SSE2__");
+ Define(Defs, "__SSE2_MATH__"); // -mfp-math=sse always implied.
+ case SSE1:
+ Define(Defs, "__SSE__");
+ Define(Defs, "__SSE_MATH__"); // -mfp-math=sse always implied.
+ case MMX:
+ Define(Defs, "__MMX__");
+ case NoMMXSSE:
+ break;
+ }
}
More information about the cfe-commits
mailing list