[LLVMbugs] [Bug 16917] New: Missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 et al for non-x86/x64 architectures

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 16 08:21:03 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16917

            Bug ID: 16917
           Summary: Missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 et al for
                    non-x86/x64 architectures
           Product: clang
           Version: 3.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: s_llvm at nedprod.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Here's an illustrative patch for the ARM driver, but I think one of these needs
to go into every architecture supporting CAS atomics:

--- a/tools/clang/lib/Basic/Targets.cpp
+++ b/tools/clang/lib/Basic/Targets.cpp
@@ -3819,6 +3859,15 @@ public:
     // when Neon instructions are actually available.
     if ((FPU & NeonFPU) && !SoftFloat && IsARMv7)
       Builder.defineMacro("__ARM_NEON__");
+    
+    // These need setting for every architecture I think, but I'll just patch
+    // for ARM now. See http://llvm.org/bugs/show_bug.cgi?id=12730 for more
info.
+    if ('6' <= CPUArch[0]) {
+      Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+      Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+      Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+      Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+    }
   }
   virtual void getTargetBuiltins(const Builtin::Info *&Records,
                                  unsigned &NumRecords) const {

Related is http://llvm.org/bugs/show_bug.cgi?id=12730#c13.

Niall

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130816/50594ada/attachment.html>


More information about the llvm-bugs mailing list