]> granicus.if.org Git - clang/commitdiff
[ARM64] Default to the 'generic' CPU, unless -arch is present for backwards compatibi...
authorJames Molloy <james.molloy@arm.com>
Thu, 17 Apr 2014 12:51:17 +0000 (12:51 +0000)
committerJames Molloy <james.molloy@arm.com>
Thu, 17 Apr 2014 12:51:17 +0000 (12:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206461 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/aarch64-cpus.c

index 9f64c3fa461cb273d884f5c5486882d365f757be..a0ab03278da1043393a66c67ebe33797e29c7b2a 100644 (file)
@@ -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,
index 50f94b54c01646fd496b203f29fc4198080076ee..700e1b8511e63b861c846158d9e7a3052f0db2f9 100644 (file)
@@ -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