From: Derek Schuff Date: Thu, 26 Mar 2015 21:58:46 +0000 (+0000) Subject: Default to armv7 cpu for NaCl when march=arm X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=337bd191d23e54c34b7d3942828409d6cb2c10b7;p=oota-llvm.git 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233321 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index e9a22429883..d4b150a6cb1 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -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: diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index 230f2ab7e1e..1113bb60dc4 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -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")); + } } }