diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-05-15 21:07:09 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-05-15 21:07:09 +0000 |
commit | 9d92987a583981bc013f4a22f89d24df104f13da (patch) | |
tree | a7b8e6d44dd4aab3234f370d0ddf307305eb7ae5 | |
parent | 39f229fdd3084dc995a1b45d94cde435c3a0a180 (diff) |
Merging r181750:
------------------------------------------------------------------------
r181750 | rafael | 2013-05-13 17:44:24 -0700 (Mon, 13 May 2013) | 4 lines
Use atomic instructions on linux thumb v7.
This matches gcc's behaviour. The patch also explicitly parses the version so
that this keeps working when we add support for v8.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_33@181920 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Basic/Targets.cpp | 20 | ||||
-rw-r--r-- | test/CodeGen/linux-arm-atomic.c | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 841ca62ab6..a622a11aa5 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -3536,9 +3536,23 @@ class ARMTargetInfo : public TargetInfo { if (T.getOS() != llvm::Triple::Linux) return false; StringRef ArchName = T.getArchName(); - if (ArchName.startswith("armv6") || ArchName.startswith("armv7")) - return true; - return false; + if (T.getArch() == llvm::Triple::arm) { + if (!ArchName.startswith("armv")) + return false; + StringRef VersionStr = ArchName.substr(4); + unsigned Version; + if (VersionStr.getAsInteger(10, Version)) + return false; + return Version >= 6; + } + assert(T.getArch() == llvm::Triple::thumb); + if (!ArchName.startswith("thumbv")) + return false; + StringRef VersionStr = ArchName.substr(6); + unsigned Version; + if (VersionStr.getAsInteger(10, Version)) + return false; + return Version >= 7; } public: diff --git a/test/CodeGen/linux-arm-atomic.c b/test/CodeGen/linux-arm-atomic.c index 3fda7f688c..c7ce1d228b 100644 --- a/test/CodeGen/linux-arm-atomic.c +++ b/test/CodeGen/linux-arm-atomic.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-linux | FileCheck %s // RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-linux | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - -triple=thumbv7-unknown-linux | FileCheck %s typedef int _Atomic_word; _Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) { |