[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

Pirama Arumuga Nainar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 26 14:42:38 PST 2017


pirama updated this revision to Diff 124318.
pirama added a comment.

Few refactorings.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===================================================================
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// ================== Check that krait is substituted by cortex-15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// ================== Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,36 @@
 
     Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-    // FIXME: remove krait check when GNU tools support krait cpu
-    // for now replace it with -mcpu=cortex-a15 to avoid a lower
-    // march from being picked in the absence of a cpu flag.
-    Arg *A;
-    if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-        StringRef(A->getValue()).equals_lower("krait"))
-      CmdArgs.push_back("-mcpu=cortex-a15");
-    else
-      Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+    // FIXME: remove krait and kryo checks when GNU tools support them.  For now
+    // use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+    // -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+    // of a cpu flag.
+    Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+    if (A) {
+      StringRef CPUArg(A->getValue());
+      if(CPUArg.equals_lower("krait"))
+        CmdArgs.push_back("-mcpu=cortex-a15");
+      else if(CPUArg.equals_lower("kryo"))
+        CmdArgs.push_back("-mcpu=cortex-a57");
+      else
+        Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+    }
     Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
     break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
     Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-    Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+    // FIXME: remove kryo check when GNU tools support them.  For now use
+    // -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+    // of a cpu flag.
+    Arg *A;
+    if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+        (StringRef(A->getValue()).equals_lower("kryo")))
+      CmdArgs.push_back("-mcpu=cortex-a57");
+    else
+      Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
     break;
   }
   case llvm::Triple::mips:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40476.124318.patch
Type: text/x-patch
Size: 2880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171126/19a03a35/attachment-0001.bin>


More information about the cfe-commits mailing list