aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-08-04 22:29:13 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-08-04 22:29:13 +0000
commit7377ed985bb2a529d1abb4ebea88586e5d195d1b (patch)
tree0b888e8e7651fcbdf166a2da438641fa5dd39a71 /lib/Basic/Targets.cpp
parenta68340fd55e177a5849cb3adbf66aedce1f6e91b (diff)
Add -mavx and -mno-avx command line support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r--lib/Basic/Targets.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index d7f3989a36..eb8358aab1 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -912,11 +912,12 @@ class X86TargetInfo : public TargetInfo {
} AMD3DNowLevel;
bool HasAES;
-
+ bool HasAVX;
+
public:
X86TargetInfo(const std::string& triple)
: TargetInfo(triple), SSELevel(NoMMXSSE), AMD3DNowLevel(NoAMD3DNow),
- HasAES(false) {
+ HasAES(false), HasAVX(false) {
LongDoubleFormat = &llvm::APFloat::x87DoubleExtended;
}
virtual void getTargetBuiltins(const Builtin::Info *&Records,
@@ -963,6 +964,7 @@ void X86TargetInfo::getDefaultFeatures(const std::string &CPU,
Features["sse41"] = false;
Features["sse42"] = false;
Features["aes"] = false;
+ Features["avx"] = false;
// LLVM does not currently recognize this.
// Features["sse4a"] = false;
@@ -1046,6 +1048,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
Features["3dnow"] = Features["3dnowa"] = true;
else if (Name == "aes")
Features["aes"] = true;
+ else if (Name == "avx")
+ Features["avx"] = true;
} else {
if (Name == "mmx")
Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
@@ -1073,6 +1077,8 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
Features["3dnowa"] = false;
else if (Name == "aes")
Features["aes"] = false;
+ else if (Name == "avx")
+ Features["avx"] = false;
}
return true;
@@ -1092,6 +1098,13 @@ void X86TargetInfo::HandleTargetFeatures(std::vector<std::string> &Features) {
continue;
}
+ // FIXME: Not sure yet how to treat AVX in regard to SSE levels.
+ // For now let it be enabled together with other SSE levels.
+ if (Features[i].substr(1) == "avx") {
+ HasAVX = true;
+ continue;
+ }
+
assert(Features[i][0] == '+' && "Invalid target feature!");
X86SSEEnum Level = llvm::StringSwitch<X86SSEEnum>(Features[i].substr(1))
.Case("sse42", SSE42)
@@ -1133,6 +1146,9 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts,
if (HasAES)
Builder.defineMacro("__AES__");
+ if (HasAVX)
+ Builder.defineMacro("__AVX__");
+
// Target properties.
Builder.defineMacro("__LITTLE_ENDIAN__");