[llvm] r233321 - Default to armv7 cpu for NaCl when march=arm
Derek Schuff
dschuff at google.com
Thu Mar 26 14:58:46 PDT 2015
Author: dschuff
Date: Thu Mar 26 16:58:46 2015
New Revision: 233321
URL: http://llvm.org/viewvc/llvm-project?rev=233321&view=rev
Log:
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
Modified:
llvm/trunk/lib/Support/Triple.cpp
llvm/trunk/unittests/ADT/TripleTest.cpp
Modified: llvm/trunk/lib/Support/Triple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=233321&r1=233320&r2=233321&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Triple.cpp (original)
+++ llvm/trunk/lib/Support/Triple.cpp Thu Mar 26 16:58:46 2015
@@ -1137,6 +1137,8 @@ const char *Triple::getARMCPUForArch(Str
default:
return "strongarm";
}
+ case llvm::Triple::NaCl:
+ return "cortex-a8";
default:
switch (getEnvironment()) {
case llvm::Triple::EABIHF:
Modified: llvm/trunk/unittests/ADT/TripleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=233321&r1=233320&r2=233321&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/TripleTest.cpp (original)
+++ llvm/trunk/unittests/ADT/TripleTest.cpp Thu Mar 26 16:58:46 2015
@@ -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"));
+ }
}
}
More information about the llvm-commits
mailing list