[PATCH] Enable atomics on Bitrig+arm

Patrick Wildt mail at patrick-wildt.de
Sun Jun 16 13:23:26 PDT 2013


Is the following ok?

--- lib/Basic/Targets.cpp.orig	Sun Jun 16 21:08:39 2013
+++ lib/Basic/Targets.cpp	Sun Jun 16 21:20:01 2013
@@ -3534,7 +3534,9 @@ 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 && T.getOS() != llvm::Triple::FreeBSD)
+    if (T.getOS() != llvm::Triple::Linux &&
+        T.getOS() != llvm::Triple::FreeBSD &&
+        T.getOS() != llvm::Triple::Bitrig)
       return false;
     StringRef ArchName = T.getArchName();
     if (T.getArch() == llvm::Triple::arm) {
--- test/CodeGen/linux-arm-atomic.c.orig	Sun Jun 16 22:17:54 2013
+++ test/CodeGen/linux-arm-atomic.c	Sun Jun 16 22:17:19 2013
@@ -2,6 +2,7 @@
 // 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
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple=armv6-unknown-bitrig | FileCheck %s
 
 typedef int _Atomic_word;
 _Atomic_word exchange_and_add(volatile _Atomic_word *__mem, int __val) {

On Sun, Jun 16, 2013 at 04:08:48PM -0400, Rafael EspĂ­ndola wrote:
> Needs a testcase. OK with it.
> 
> On 16 June 2013 16:05, Patrick Wildt <mail at patrick-wildt.de> wrote:
> > Hi,
> >
> > as of r184040, atomics on ARM were enabled for FreeBSD.  Bitrig also suffers
> > the issue, therefore I've attached a patch which enables those for Bitrig.
> >
> > I'd like to ask you to commit it.
> >
> > Thanks in advance,
> > Patrick Wildt
> >
> > --- lib/Basic/Targets.cpp.orig  Sun Jun 16 21:08:39 2013
> > +++ lib/Basic/Targets.cpp       Sun Jun 16 21:20:01 2013
> > @@ -3534,7 +3534,9 @@ 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 && T.getOS() != llvm::Triple::FreeBSD)
> > +    if (T.getOS() != llvm::Triple::Linux &&
> > +        T.getOS() != llvm::Triple::FreeBSD &&
> > +        T.getOS() != llvm::Triple::Bitrig)
> >        return false;
> >      StringRef ArchName = T.getArchName();
> >      if (T.getArch() == llvm::Triple::arm) {
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list