[PATCH] D48931: [Driver,AArch64] Add support for -mcpu=native.
Florian Hahn via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 6 03:54:56 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC336429: [Driver,AArch64] Add support for -mcpu=native. (authored by fhahn, committed by ).
Herald added a subscriber: cfe-commits.
Repository:
rC Clang
https://reviews.llvm.org/D48931
Files:
lib/Driver/ToolChains/Arch/AArch64.cpp
test/Driver/aarch64-cpus.c
Index: lib/Driver/ToolChains/Arch/AArch64.cpp
===================================================================
--- lib/Driver/ToolChains/Arch/AArch64.cpp
+++ lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -69,6 +69,9 @@
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 {
Index: test/Driver/aarch64-cpus.c
===================================================================
--- test/Driver/aarch64-cpus.c
+++ test/Driver/aarch64-cpus.c
@@ -15,6 +15,11 @@
// ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"
+// We cannot check much for -mcpu=native, but it should be replaced by either generic or a valid
+// Arm cpu string, depending on the host.
+// RUN: %clang -target arm64 -mcpu=native -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-NATIVE %s
+// ARM64-NATIVE-NOT: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "native"
+
// RUN: %clang -target arm64-apple-darwin -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-DARWIN %s
// ARM64-DARWIN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cyclone"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48931.154385.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180706/f27d8b52/attachment.bin>
More information about the cfe-commits
mailing list