forked from OSchip/llvm-project
Switch CPU names not recognized by GNU assembler
Summary: Switch CPU names not recognized by GNU assembler to a close CPU that it does recognize. In this patch, kryo, falkor and saphira all get replaced by cortex-a57 when invoking the assembler. In addition, krait was already being replaced by cortex-a15. Reviewers: weimingz Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D40476 llvm-svn: 319077
This commit is contained in:
parent
4414b08bb1
commit
87ff0a7467
|
@ -42,6 +42,24 @@ static bool forwardToGCC(const Option &O) {
|
|||
!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 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
|
|||
}
|
||||
|
||||
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:
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue