Package: llvm-toolchain-5.0 / 1:5.0.1-2~bpo9+1

atomic_library_2.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
 clang/lib/Basic/Targets.cpp           |   20 +++++++++++++++++---
 clang/test/CodeGen/linux-arm-atomic.c |    1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -4423,9 +4423,23 @@ protected:
     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:
--- a/clang/test/CodeGen/linux-arm-atomic.c
+++ b/clang/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) {