r184040 - Emit native implementations of atomic operations on FreeBSD/armv6.

Ed Schouten ed at 80386.nl
Sat Jun 15 02:40:16 PDT 2013


Author: ed
Date: Sat Jun 15 04:40:14 2013
New Revision: 184040

URL: http://llvm.org/viewvc/llvm-project?rev=184040&view=rev
Log:
Emit native implementations of atomic operations on FreeBSD/armv6.

Just like on Linux, FreeBSD/armv6 assumes the system supports
ldrex/strex unconditionally. It is also used by the kernel. We can
therefore enable support for it, like we do on Linux.

While there, change one of the unit tests to explicitly test against
armv5 instead of armv7, as it actually tests whether libcalls are
emitted.


Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/test/CodeGen/c11atomics.c
    cfe/trunk/test/CodeGen/linux-arm-atomic.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=184040&r1=184039&r2=184040&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Jun 15 04:40:14 2013
@@ -3534,8 +3534,8 @@ class ARMTargetInfo : public TargetInfo
     // the kernel which on armv6 and newer uses ldrex and strex. The net result
     // is that if we assume the kernel is at least as recent as the hardware,
     // it is safe to use atomic instructions on armv6 and newer.
-    if (T.getOS() != llvm::Triple::Linux)
-     return false;
+    if (T.getOS() != llvm::Triple::Linux && T.getOS() != llvm::Triple::FreeBSD)
+      return false;
     StringRef ArchName = T.getArchName();
     if (T.getArch() == llvm::Triple::arm) {
       if (!ArchName.startswith("armv"))

Modified: cfe/trunk/test/CodeGen/c11atomics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/c11atomics.c?rev=184040&r1=184039&r2=184040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/c11atomics.c (original)
+++ cfe/trunk/test/CodeGen/c11atomics.c Sat Jun 15 04:40:14 2013
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv7-unknown-freebsd -std=c11 | FileCheck %s
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv5-unknown-freebsd -std=c11 | FileCheck %s
 
 // Test that we are generating atomicrmw instructions, rather than
 // compare-exchange loops for common atomic ops.  This makes a big difference

Modified: cfe/trunk/test/CodeGen/linux-arm-atomic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/linux-arm-atomic.c?rev=184040&r1=184039&r2=184040&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/linux-arm-atomic.c (original)
+++ cfe/trunk/test/CodeGen/linux-arm-atomic.c Sat Jun 15 04:40:14 2013
@@ -1,6 +1,7 @@
 // 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
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-freebsd | FileCheck %s
 
 typedef int _Atomic_word;
 _Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) {





More information about the cfe-commits mailing list