Default to armv7 cpu for NaCl when march=arm

Summary:
When the arch is given as "arm" clang uses the default target CPU from
LLVM to determine what the real arch should be (i.e. "arm" becomes
"armv4t" because LLVM's getARMCPUForArch falls back to "arm7tdmi").
Default to "cortex-a8" so that we end up with "armv7" in clang.

the nacl-direct.c test in clang also covers this case.

Differential Revision: http://reviews.llvm.org/D8589

llvm-svn: 233321
This commit is contained in:
Derek Schuff 2015-03-26 21:58:46 +00:00
parent 346048a1fa
commit a3b594c480
2 changed files with 6 additions and 0 deletions

View File

@ -1137,6 +1137,8 @@ const char *Triple::getARMCPUForArch(StringRef MArch) const {
default:
return "strongarm";
}
case llvm::Triple::NaCl:
return "cortex-a8";
default:
switch (getEnvironment()) {
case llvm::Triple::EABIHF:

View File

@ -669,6 +669,10 @@ TEST(TripleTest, getARMCPUForArch) {
EXPECT_STREQ("cortex-a8", Triple.getARMCPUForArch());
EXPECT_STREQ("swift", Triple.getARMCPUForArch("armv7s"));
}
{
llvm::Triple Triple("arm--nacl");
EXPECT_STREQ("cortex-a8", Triple.getARMCPUForArch("arm"));
}
}
}