[llvm-bugs] [Bug 34214] New: clang does not support 64bit gcc atomics on ia32

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 16 13:34:09 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34214

            Bug ID: 34214
           Summary: clang does not support 64bit  gcc atomics on ia32
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: raj.khem at gmail.com
                CC: llvm-bugs at lists.llvm.org

a.c
===================
#include <stdint.h>
#if defined(USE_GCC_ATOMIC_BUILTINS)
# define p_atomic_add(v, i) (void) __atomic_add_fetch((v), (i),
__ATOMIC_ACQ_REL)
#else
# define p_atomic_add(v, i) (void) __sync_add_and_fetch((v), (i))
#endif

void foo(uint64_t* a, uint64_t b)
{
        p_atomic_add(a, b);
}


=============

clang -std=gnu11 -m32 -march=i586 -S -O2 a.c -DUSE_GCC_ATOMIC_BUILTINS

produces a call to __atomic_fetch_add_8

but same compiled with gcc resolves correctly ( uses lock cmpxchg8b )
instruction.


if I use -march=i386 then same code is generated with gcc as well but thats
expected since cmpxchg8b doesnt exist on i386

-- 
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/20170816/7a1ca132/attachment.html>


More information about the llvm-bugs mailing list