diff options
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r-- | clang/lib/Basic/Targets.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index ae300214ecf..b78e2817f0e 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1070,14 +1070,25 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &Features, // TODO: Finish this list and add an assert that we've handled them // all. } - if (!HasVSX && (HasP8Vector || HasDirectMove)) { - if (HasP8Vector) - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" << - "-mno-vsx"; - else if (HasDirectMove) - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" << - "-mno-vsx"; - return false; + + // Handle explicit options being passed to the compiler here: if we've + // explicitly turned off vsx and turned on power8-vector or direct-move then + // go ahead and error since the customer has expressed a somewhat incompatible + // set of options. + if (std::find(Features.begin(), Features.end(), "-vsx") != Features.end()) { + if (std::find(Features.begin(), Features.end(), "+power8-vector") != + Features.end()) { + Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" + << "-mno-vsx"; + return false; + } + + if (std::find(Features.begin(), Features.end(), "+direct-move") != + Features.end()) { + Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" + << "-mno-vsx"; + return false; + } } return true; |