<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang does not support 64bit gcc atomics on ia32"
href="https://bugs.llvm.org/show_bug.cgi?id=34214">34214</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang does not support 64bit gcc atomics on ia32
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>raj.khem@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>