[llvm-branch-commits] [cfe-branch] r181920 - Merging r181750:

Bill Wendling isanbard at gmail.com
Wed May 15 14:07:10 PDT 2013


Author: void
Date: Wed May 15 16:07:09 2013
New Revision: 181920

URL: http://llvm.org/viewvc/llvm-project?rev=181920&view=rev
Log:
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.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_33/   (props changed)
    cfe/branches/release_33/lib/Basic/Targets.cpp
    cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c

Propchange: cfe/branches/release_33/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May 15 16:07:09 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:181286,181299,181368,181728
+/cfe/trunk:181286,181299,181368,181728,181750
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_33/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_33/lib/Basic/Targets.cpp?rev=181920&r1=181919&r2=181920&view=diff
==============================================================================
--- cfe/branches/release_33/lib/Basic/Targets.cpp (original)
+++ cfe/branches/release_33/lib/Basic/Targets.cpp Wed May 15 16:07:09 2013
@@ -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:

Modified: cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c?rev=181920&r1=181919&r2=181920&view=diff
==============================================================================
--- cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c (original)
+++ cfe/branches/release_33/test/CodeGen/linux-arm-atomic.c Wed May 15 16:07:09 2013
@@ -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) {





More information about the llvm-branch-commits mailing list