Hi t.p.northover,

This patch is to cover below changes for AArch64 target.

1. Revert "Add default feature for CPUs on AArch64 target in Clang" at r210625. 
Because it gets conflict with the rule that architecture feature should only be 
decided by "-march". 

2. Get "-mfpu" deprecated.

3. Implement support of "-march". Usage is: "-march=armv8-a+[no]feature". For 
instance, "-march=armv8-a+neon+crc+nocrypto".  Here "armv8-a" is necessary, and 
CPU names are not acceptable.  Candidate features are fp, neon,  crc and crypto.

4. Implement support of "-mtune". Usage is: "-march=CPU_NAME". For instance, 
"-march=cortex-a57". This option will ONLY get micro-architecture level feature 
enabled specifying to target CPU, like "zcm" and "zcz" for cyclone. Any 
architecture features WON'T be modified.

5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is an alias 
to "-march={feature of CPU_NAME}+[no]feature" and "-mtune=CPU_NAME" together. 
An warning is added to discourage use of this option.


Here are some summary may concern.

1. Neon is enabled by default, and "generic" will be used if no CPU type is 
specified.

2. For most scenario, Using "-mtune=CPU" only is recommended as neon is enabled 
by default and all micro-architecture optimizations are selected, and it would 
provide great compatibility to run on most of AArch64 devices.

3. "-march" is designed to be used only if user wants to use crc and crypto 
instructions, or disable fp/neon. So "-march" will not be frequently used and 
won't bring too much finger burden. 

Regards,
Kevin

http://reviews.llvm.org/D4346

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  test/CodeGen/arm_acle.c
  test/Driver/aarch64-cpus.c
  test/Driver/aarch64-mfpu.c
  test/Driver/clang_f_opts.c
  test/Preprocessor/aarch64-target-features.c
Index: include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -159,6 +159,9 @@
   InGroup<DiagGroup<"missing-sysroot">>;
 def warn_debug_compression_unavailable : Warning<"cannot compress debug sections (zlib not installed)">,
   InGroup<DiagGroup<"debug-compression-unavailable">>;
+def warn_mcpu_will_be_deprecated : Warning<"-mcpu is going to be deprecated for this target, use -march and -mtune instead">,
+  InGroup<Deprecated>;
+
 
 def note_drv_command_failed_diag_msg : Note<
   "diagnostic msg: %0">;
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -4305,7 +4305,6 @@
     NeonMode
   };
 
-  std::string CPU;
   unsigned FPU;
   unsigned CRC;
   unsigned Crypto;
@@ -4365,8 +4364,6 @@
                         .Cases("cortex-a53", "cortex-a57", true)
                         .Case("cyclone", true)
                         .Default(false);
-    if (CPUKnown)
-      CPU = Name;
     return CPUKnown;
   }
 
@@ -4438,23 +4435,6 @@
       (Feature == "neon" && FPU == NeonMode);
   }
 
-  void getDefaultFeatures(llvm::StringMap<bool> &Features) const override {
-
-  if (CPU == "cyclone") {
-    Features["fp-armv8"] = true;
-    Features["neon"] = true;
-    Features["crypto"] = true;
-    Features["crc"] = true;
-    Features["zcm"] = true;
-    Features["zcz"] = true;
-  } else if (CPU == "cortex-a53" || CPU == "cortex-a57") {
-    Features["fp-armv8"] = true;
-    Features["neon"] = true;
-    Features["crypto"] = true;
-    Features["crc"] = true;
-  }
-}
-
   bool handleTargetFeatures(std::vector<std::string> &Features,
                             DiagnosticsEngine &Diags) override {
     FPU = FPUMode;
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -879,11 +879,6 @@
       DAL->AddJoinedArg(nullptr, MArch, "armv7m");
     else if (Name == "armv7s")
       DAL->AddJoinedArg(nullptr, MArch, "armv7s");
-
-    else if (Name == "arm64")
-      DAL->AddJoinedArg(nullptr, MArch, "arm64");
-    else if (Name == "armv8")
-      DAL->AddJoinedArg(nullptr, MArch, "arm64");
   }
 
   return DAL;
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -484,29 +484,6 @@
   }
 }
 
-// Handle -mfpu=.
-//
-// FIXME: Centralize feature selection, defaulting shouldn't be also in the
-// frontend target.
-static void getAArch64FPUFeatures(const Driver &D, const Arg *A,
-                                  const ArgList &Args,
-                                  std::vector<const char *> &Features) {
-  StringRef FPU = A->getValue();
-  if (FPU == "fp-armv8") {
-    Features.push_back("+fp-armv8");
-  } else if (FPU == "neon-fp-armv8") {
-    Features.push_back("+fp-armv8");
-    Features.push_back("+neon");
-  } else if (FPU == "crypto-neon-fp-armv8") {
-    Features.push_back("+fp-armv8");
-    Features.push_back("+neon");
-    Features.push_back("+crypto");
-  } else if (FPU == "neon") {
-    Features.push_back("+neon");
-  } else
-    D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
-}
-
 // Handle -mhwdiv=.
 static void getARMHWDivFeatures(const Driver &D, const Arg *A,
                               const ArgList &Args,
@@ -845,18 +822,21 @@
 /// getAArch64TargetCPU - Get the (LLVM) name of the AArch64 cpu we are
 /// targeting.
 static std::string getAArch64TargetCPU(const ArgList &Args) {
-  // If we have -mcpu=, use that.
-  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
-    StringRef MCPU = A->getValue();
-    // Handle -mcpu=native.
-    if (MCPU == "native")
-      return llvm::sys::getHostCPUName();
-    else
-      return MCPU;
+  Arg *A;
+  std::string CPU;
+  // If we have -mtune or -mcpu, use that.
+  if ((A = Args.getLastArg(options::OPT_mtune_EQ))) {
+    CPU = A->getValue();
+  } else if ((A = Args.getLastArg(options::OPT_mcpu_EQ))) {
+    StringRef Mcpu = A->getValue();
+    CPU = Mcpu.split("+").first;
   }
 
-  // At some point, we may need to check -march here, but for now we only
-  // one arm64 architecture.
+  // Handle CPU name is 'native'.
+  if (CPU == "native")
+    return llvm::sys::getHostCPUName();
+  else if (CPU.size())
+    return CPU;
 
   // Make sure we pick "cyclone" if -arch is used.
   // FIXME: Should this be picked by checking the target triple instead?
@@ -891,9 +871,6 @@
   CmdArgs.push_back("-target-abi");
   CmdArgs.push_back(ABIName);
 
-  CmdArgs.push_back("-target-cpu");
-  CmdArgs.push_back(Args.MakeArgString(getAArch64TargetCPU(Args)));
-
   if (Args.hasArg(options::OPT_mstrict_align)) {
     CmdArgs.push_back("-backend-option");
     CmdArgs.push_back("-aarch64-strict-align");
@@ -1538,13 +1515,108 @@
   CmdArgs.push_back ("-machine-sink-split=0");
 }
 
+// Decode AArch64 features from string like +[no]featureA+[no]featureB+...
+static bool DecodeAArch64Features(const Driver &D, const StringRef &text,
+                                  std::vector<const char *> &Features) {
+  SmallVector<StringRef, 8> Splited;
+  text.split(Splited, StringRef("+"), -1, false);
+
+  while (Splited.size()) {
+    StringRef Slice = Splited.pop_back_val();
+    const char *result = nullptr;
+    result = llvm::StringSwitch<const char *>(Slice)
+                 .Case("fp", "+fp-armv8")
+                 .Cases("neon", "simd", "+neon")
+                 .Case("crc", "+crc")
+                 .Case("crypto", "+crypto")
+                 .Case("nofp", "-fp-armv8")
+                 .Cases("noneon", "nosimd", "-neon")
+                 .Case("nocrc", "-crc")
+                 .Case("nocrypto", "-crypto")
+                 .Default(nullptr);
+    if (result)
+      Features.push_back(result);
+    else
+      return false;
+  }
+  return true;
+}
+
+// Handle -march=.
+static bool getAArch64FeaturesFromMarch(const Driver &D, StringRef March,
+                                        const ArgList &Args,
+                                        std::vector<const char *> &Features) {
+  std::pair<StringRef, StringRef> Split = March.split("+");
+  if (Split.first != "armv8-a")
+    return false;
+
+  if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))
+    return false;
+
+  return true;
+}
+
+// Handle -march=.
+static void getAArch64FeaturesFromMtune(const Driver &D, StringRef Mtune,
+                                        const ArgList &Args,
+                                        std::vector<const char *> &Features) {
+  // Handle CPU name is 'native'.
+  if (Mtune == "native")
+    Mtune = llvm::sys::getHostCPUName();
+  if (Mtune == "cyclone") {
+    Features.push_back("+zcm");
+    Features.push_back("+zcz");
+  }
+}
+
+// Handle -mcpu=.
+static bool getAArch64FeaturesFromMcpu(const Driver &D, StringRef Mcpu,
+                                       const ArgList &Args,
+                                       std::vector<const char *> &Features) {
+  std::pair<StringRef, StringRef> Split = Mcpu.split("+");
+  if (Split.first.size() != 0) {
+    // Handle CPU name is 'native'.
+    if (Split.first == "native")
+      Split.first = llvm::sys::getHostCPUName();
+    if (Split.first == "cyclone" ||
+        Split.first == "cortex-a53" ||
+        Split.first == "cortex-a57") {
+      Features.push_back("+neon");
+      Features.push_back("+crc");
+      Features.push_back("+crypto");
+    } else if (Split.first == "generic") {
+      Features.push_back("+neon");
+    } else {
+      return false;
+    }
+    getAArch64FeaturesFromMtune(D, Split.first, Args, Features);
+  }
+
+  if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))
+    return false;
+
+  return true;
+}
+
 static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
                                      std::vector<const char *> &Features) {
-  // Honor -mfpu=.
-  if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ))
-    getAArch64FPUFeatures(D, A, Args, Features);
-  else
-    Features.push_back("+neon");
+  Arg *A;
+  bool success = true;
+  // Enable NEON by default.
+  Features.push_back("+neon");
+  // Collect feature from -mcpu.
+  if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+      (success = getAArch64FeaturesFromMcpu(D, A->getValue(), Args, Features)))
+    D.Diag(diag::warn_mcpu_will_be_deprecated);
+  // Collect feature from -march.
+  if (success && (A = Args.getLastArg(options::OPT_march_EQ)))
+    success = getAArch64FeaturesFromMarch(D, A->getValue(), Args, Features);
+  // Collect feature from -mtune.
+  if (success && (A = Args.getLastArg(options::OPT_mtune_EQ)))
+    getAArch64FeaturesFromMtune(D, A->getValue(), Args, Features);
+
+  if (!success)
+    D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
 
   if (Args.getLastArg(options::OPT_mgeneral_regs_only)) {
     Features.push_back("-fp-armv8");
Index: test/CodeGen/arm_acle.c
===================================================================
--- test/CodeGen/arm_acle.c
+++ test/CodeGen/arm_acle.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -ffreestanding -triple armv8 -target-cpu cortex-a57 -O -S -emit-llvm -o - %s | FileCheck %s -check-prefix=ARM -check-prefix=AArch32
-// RUN: %clang_cc1 -ffreestanding -triple aarch64 -target-cpu cortex-a57 -O -S -emit-llvm -o - %s | FileCheck %s -check-prefix=ARM -check-prefix=AArch64
+// RUN: %clang_cc1 -ffreestanding -triple armv8 -target-cpu cortex-a57 -target-feature +neon -O -S -emit-llvm -o - %s | FileCheck %s -check-prefix=ARM -check-prefix=AArch32
+// RUN: %clang_cc1 -ffreestanding -triple aarch64 -target-cpu cortex-a57 -target-feature +neon -target-feature +crc -O -S -emit-llvm -o - %s | FileCheck %s -check-prefix=ARM -check-prefix=AArch64
 
 #include <arm_acle.h>
 
Index: test/Driver/aarch64-cpus.c
===================================================================
--- test/Driver/aarch64-cpus.c
+++ test/Driver/aarch64-cpus.c
@@ -16,21 +16,33 @@
 // 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
+// RUN: %clang -target aarch64 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s
 // CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
 // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
 // RUN: %clang -target arm64_be -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
+// RUN: %clang -target arm64 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
+// RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
+// RUN: %clang -target arm64_be -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s
 // ARM64-CA53: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a53"
 
 // RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
 // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
 // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
+// RUN: %clang -target aarch64 -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
+// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
+// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
 // CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57"
 
 // RUN: %clang -target arm64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
 // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
 // RUN: %clang -target arm64_be -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
+// RUN: %clang -target arm64 -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
+// RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
+// RUN: %clang -target arm64_be -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s
 // ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57"
 
 // RUN: %clang -target aarch64_be -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s
@@ -46,19 +58,31 @@
 // RUN: %clang -target aarch64_be -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
 // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
 // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
+// RUN: %clang -target aarch64_be -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s
 // CA53-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a53"
 
 // RUN: %clang -target arm64_be -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
 // RUN: %clang -target arm64 -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
 // RUN: %clang -target arm64_be -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
+// RUN: %clang -target arm64_be -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
+// RUN: %clang -target arm64 -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
+// RUN: %clang -target arm64_be -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53-BE %s
 // ARM64-CA53-BE: "-cc1"{{.*}} "-triple" "arm64_be{{.*}}" "-target-cpu" "cortex-a53"
 
 // RUN: %clang -target aarch64_be -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
 // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
 // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
+// RUN: %clang -target aarch64_be -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
+// RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
+// RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s
 // CA57-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a57"
 
 // RUN: %clang -target arm64_be -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
 // RUN: %clang -target arm64 -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
 // RUN: %clang -target arm64_be -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
+// RUN: %clang -target arm64_be -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
+// RUN: %clang -target arm64 -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
+// RUN: %clang -target arm64_be -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57-BE %s
 // ARM64-CA57-BE: "-cc1"{{.*}} "-triple" "arm64_be{{.*}}" "-target-cpu" "cortex-a57"
Index: test/Driver/aarch64-mfpu.c
===================================================================
--- test/Driver/aarch64-mfpu.c
+++ /dev/null
@@ -1,32 +0,0 @@
-// Test that different values of -mfpu pick correct AArch64 FPU target-feature(s).
-
-// RUN: %clang -target aarch64-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON %s
-// RUN: %clang -target aarch64-linux-eabi %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON %s
-// RUN: %clang -target arm64-linux-eabi -mfpu=neon %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON %s
-// RUN: %clang -target arm64-linux-eabi %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON %s
-// CHECK-NEON: "-target-feature" "+neon"
-
-// RUN: %clang -target aarch64-linux-eabi -mfpu=fp-armv8 %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
-// RUN: %clang -target arm64-linux-eabi -mfpu=fp-armv8 %s -### -o %t.o 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
-// CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
-
-// RUN: %clang -target aarch64-linux-eabi -mfpu=neon-fp-armv8 %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
-// RUN: %clang -target arm64-linux-eabi -mfpu=neon-fp-armv8 %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-NEON-FP-ARMV8 %s
-// CHECK-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
-// CHECK-NEON-FP-ARMV8: "-target-feature" "+neon"
-
-// RUN: %clang -target aarch64-linux-eabi -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
-// RUN: %clang -target arm64-linux-eabi -mfpu=crypto-neon-fp-armv8 %s -### 2>&1 \
-// RUN:   | FileCheck --check-prefix=CHECK-CRYPTO-NEON-FP-ARMV8 %s
-// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+fp-armv8"
-// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+neon"
-// CHECK-CRYPTO-NEON-FP-ARMV8: "-target-feature" "+crypto"
Index: test/Driver/clang_f_opts.c
===================================================================
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -126,6 +126,9 @@
 // CHECK-MAX-O: warning: -O4 is equivalent to -O3
 // CHECK-MAX-O: -O3
 
+// RUN: %clang -### -target aarch64 -mcpu=cortex-a57 %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU %s
+// CHECK-MCPU: warning: -mcpu is going to be deprecated for this target, use -march and -mtune instead
+
 // RUN: %clang -S -O20 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-O %s
 // CHECK-INVALID-O: warning: optimization level '-O20' is unsupported; using '-O3' instead
 
Index: test/Preprocessor/aarch64-target-features.c
===================================================================
--- test/Preprocessor/aarch64-target-features.c
+++ test/Preprocessor/aarch64-target-features.c
@@ -25,12 +25,14 @@
 // CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1
 // CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2
 
-// RUN: %clang -target aarch64-none-linux-gnu -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
-// RUN: %clang -target arm64-none-linux-gnu -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+crypto -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
+// RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+crypto -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s
 // CHECK-CRYPTO: __ARM_FEATURE_CRYPTO 1
 
 // RUN: %clang -target aarch64-none-linux-gnu -mcrc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
 // RUN: %clang -target arm64-none-linux-gnu -mcrc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+crc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
+// RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+crc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRC32 %s
 // CHECK-CRC32: __ARM_FEATURE_CRC32 1
 
 // RUN: %clang -target aarch64-none-linux-gnu -ffast-math -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FASTMATH %s
@@ -45,17 +47,39 @@
 // RUN: %clang -target arm64-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTENUMS %s
 // CHECK-SHORTENUMS: __ARM_SIZEOF_MINIMAL_ENUM 1
 
-// RUN: %clang -target aarch64-none-linux-gnu -mfpu=neon -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NEON %s
-// RUN: %clang -target arm64-none-linux-gnu -mfpu=neon -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NEON %s
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8-a+neon -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NEON %s
+// RUN: %clang -target arm64-none-linux-gnu -march=armv8-a+neon -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NEON %s
 // CHECK-NEON: __ARM_NEON 1
 // CHECK-NEON: __ARM_NEON_FP 0xe
 
-// RUN: %clang -target aarch64-none-linux-gnu -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FEATURE %s
-// RUN: %clang -target aarch64-none-linux-gnu -mcpu=cortex-a57 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FEATURE %s
-// RUN: %clang -target aarch64-none-linux-gnu -mcpu=cyclone -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FEATURE %s
-// CHECK-FEATURE: __ARM_FEATURE_CRC32 1
-// CHECK-FEATURE: __ARM_FEATURE_CRYPTO 1
-// CHECK-FEATURE: __ARM_NEON 1
-// CHECK-FEATURE: __ARM_NEON_FP 0xe
+// RUN: %clang -target aarch64 -march=arm64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
+// RUN: %clang -target aarch64 -march=aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-ARCH-NOT-ACCEPT %s
+// CHECK-ARCH-NOT-ACCEPT: error: the clang compiler does not support
 
+// RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC %s
+// RUN: %clang -target aarch64 -march=armv8-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC %s
+// CHECK-GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon"
 
+// RUN: %clang -target aarch64 -mtune=cyclone -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MTUNE-CYCLONE %s
+// CHECK-MTUNE-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+zcm" "-target-feature" "+zcz"
+
+// RUN: %clang -target aarch64 -mcpu=cyclone -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-CYCLONE %s
+// RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A53 %s
+// RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A57 %s
+// CHECK-MCPU-CYCLONE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz"
+// CHECK-MCPU-A53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
+// CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
+
+// RUN: %clang -target aarch64 -march=armv8-a+fp+neon+crc+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-1 %s
+// RUN: %clang -target aarch64 -march=armv8-a+nofp+noneon+nocrc+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-2 %s
+// RUN: %clang -target aarch64 -march=armv8-a+nosimd -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-3 %s
+// CHECK-MARCH-1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+crypto" "-target-feature" "+crc"  "-target-feature" "+neon" "-target-feature" "+fp-armv8"
+// CHECK-MARCH-2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "-crypto" "-target-feature" "-crc"  "-target-feature" "-neon" "-target-feature" "-fp-armv8"
+// CHECK-MARCH-3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "-neon"
+
+// RUN: %clang -target aarch64 -mcpu=cyclone+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-1 %s
+// RUN: %clang -target aarch64 -mcpu=generic+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-2 %s
+// RUN: %clang -target aarch64 -mcpu=cortex-a53+nosimd -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-3 %s
+// CHECK-MCPU-1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "-crypto"
+// CHECK-MCPU-2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc"
+// CHECK-MCPU-3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "-neon"
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to