[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:14:08 PST 2017
pirama created this revision.
Using -no-integrated-as causes -mcpu=kryo to fail since GNU assembler
doesn't recognize kryo. Cortex-a57 is the closest CPU to kryo that the
assembler does recognize. So we should switch the assembler to use
that instead.
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: bin/as{{.*}}-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: bin/as{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
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) {
+ if(StringRef(A->getValue()).equals_lower("krait"))
+ CmdArgs.push_back("-mcpu=cortex-a15");
+ else if(StringRef(A->getValue()).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.124317.patch
Type: text/x-patch
Size: 2856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171126/34fdc660/attachment.bin>
More information about the cfe-commits
mailing list