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"
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"
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits