Add support for 3dnow and 3dnowa, and define the target macros accordingly. (This is needed in order to build Qt).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2010-01-27 03:47:49 +00:00
Родитель 3a18917b52
Коммит 9b0fb629fd
1 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -637,9 +637,13 @@ class X86TargetInfo : public TargetInfo {
enum X86SSEEnum {
NoMMXSSE, MMX, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42
} SSELevel;
enum AMD3DNowEnum {
NoAMD3DNow, AMD3DNow, AMD3DNowAthlon
} AMD3DNowLevel;
public:
X86TargetInfo(const std::string& triple)
: TargetInfo(triple), SSELevel(NoMMXSSE) {
: TargetInfo(triple), SSELevel(NoMMXSSE), AMD3DNowLevel(NoAMD3DNow) {
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
@ -804,6 +808,14 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) {
.Case("mmx", MMX)
.Default(NoMMXSSE);
SSELevel = std::max(SSELevel, Level);
AMD3DNowEnum ThreeDNowLevel =
llvm::StringSwitch<AMD3DNowEnum>(Features[i].substr(1))
.Case("3dnowa", AMD3DNowAthlon)
.Case("3dnow", AMD3DNow)
.Default(NoAMD3DNow);
AMD3DNowLevel = std::max(AMD3DNowLevel, ThreeDNowLevel);
}
}
@ -858,6 +870,16 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
case NoMMXSSE:
break;
}
// Each case falls through to the previous one here.
switch (AMD3DNowLevel) {
case AMD3DNowAthlon:
Builder.defineMacro("__3dNOW_A__");
case AMD3DNow:
Builder.defineMacro("__3dNOW__");
case NoAMD3DNow:
break;
}
}