From: James Molloy Date: Thu, 17 Apr 2014 12:51:17 +0000 (+0000) Subject: [ARM64] Default to the 'generic' CPU, unless -arch is present for backwards compatibi... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=99c0a323fd2421e4416079580b5f7bf03f8d45b1;p=clang [ARM64] Default to the 'generic' CPU, unless -arch is present for backwards compatibility. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206461 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 9f64c3fa46..a0ab03278d 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -875,8 +875,12 @@ static std::string getARM64TargetCPU(const ArgList &Args) { // At some point, we may need to check -march here, but for now we only // one arm64 architecture. - // Default to "cyclone" CPU. - return "cyclone"; + // Make sure we pick "cyclone" if -arch is used. + // FIXME: Should this be picked by checking the target triple instead? + if (Args.getLastArg(options::OPT_arch)) + return "cyclone"; + + return "generic"; } void Clang::AddARM64TargetArgs(const ArgList &Args, diff --git a/test/Driver/aarch64-cpus.c b/test/Driver/aarch64-cpus.c index 50f94b54c0..700e1b8511 100644 --- a/test/Driver/aarch64-cpus.c +++ b/test/Driver/aarch64-cpus.c @@ -5,6 +5,13 @@ // RUN: %clang -target aarch64_be -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" +// RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s +// RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s +// ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic" + +// 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" + // RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s