summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-07-06 10:49:59 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-07-06 10:49:59 +0000
commit4327b3e92f2bc57efd2c295de7c28c752f225234 (patch)
treebcc239f592fec66e8e862b6cae110c6e8b56d4e1 /clang/lib
parent17be9949428b8d4273d04398a6f21ccff5bb4ecc (diff)
downloadbcm5719-llvm-4327b3e92f2bc57efd2c295de7c28c752f225234.tar.gz
bcm5719-llvm-4327b3e92f2bc57efd2c295de7c28c752f225234.zip
[Driver,AArch64] Add support for -mcpu=native.
This patches adds support for passing -mcpu=native for AArch64. It will get turned into the host CPU name, before we get the target features. CPU = native is handled in a similar fashion in getAArch64MicroArchFetauresFromMtune and getAArch64TargetCPU already. Having a good test case for this is hard, as it depends on the host CPU of the machine running the test. But we can check that native has been replaced with something else. When cross-compiling, we will get a CPU name from the host architecture and get ` the clang compiler does not support '-mcpu=native'` as error message, which seems reasonable to me. Reviewers: rengolin, peter.smith, dlj, javed.absar, t.p.northover Reviewed By: peter.smith Tags: #clang Differential Revision: https://reviews.llvm.org/D48931 llvm-svn: 336429
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains/Arch/AArch64.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 7bac69687a9..5114279b4b4 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -69,6 +69,9 @@ static bool DecodeAArch64Mcpu(const Driver &D, StringRef Mcpu, StringRef &CPU,
std::pair<StringRef, StringRef> Split = Mcpu.split("+");
CPU = Split.first;
+ if (CPU == "native")
+ CPU = llvm::sys::getHostCPUName();
+
if (CPU == "generic") {
Features.push_back("+neon");
} else {
OpenPOWER on IntegriCloud