[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
Mon Nov 27 11:19:02 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL319077: Switch CPU names not recognized by GNU assembler (authored by pirama).
Repository:
rL LLVM
https://reviews.llvm.org/D40476
Files:
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/as-mcpu.c
Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -42,6 +42,24 @@
!O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
}
+// Switch CPU names not recognized by GNU assembler to a close CPU that it does
+// recognize, instead of a lower march from being picked in the absence of a cpu
+// flag.
+static void normalizeCPUNamesForAssembler(const ArgList &Args,
+ ArgStringList &CmdArgs) {
+ if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+ StringRef CPUArg(A->getValue());
+ if (CPUArg.equals_lower("krait"))
+ CmdArgs.push_back("-mcpu=cortex-a15");
+ else if(CPUArg.equals_lower("kryo") ||
+ CPUArg.equals_lower("falkor") ||
+ CPUArg.equals_lower("saphira"))
+ CmdArgs.push_back("-mcpu=cortex-a57");
+ else
+ Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+ }
+}
+
void tools::gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
@@ -652,23 +670,16 @@
}
Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
+ normalizeCPUNamesForAssembler(Args, CmdArgs);
- // 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);
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);
+ normalizeCPUNamesForAssembler(Args, CmdArgs);
+
break;
}
case llvm::Triple::mips:
Index: cfe/trunk/test/Driver/as-mcpu.c
===================================================================
--- cfe/trunk/test/Driver/as-mcpu.c
+++ cfe/trunk/test/Driver/as-mcpu.c
@@ -0,0 +1,17 @@
+// ================== Check that krait is substituted by cortex-a15 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-a57 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
+
+// RUN: %clang -target arm-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=saphira -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=saphira -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40476.124426.patch
Type: text/x-patch
Size: 3623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171127/82206a65/attachment.bin>
More information about the cfe-commits
mailing list