Closed Quuxplusone closed 8 years ago
What version of clang is this?
I'm sorry. I forgot the revision number:
tatraian@server09:~$ clang++ --version
clang version 3.4 (186311)
Target: i386--linux-gnu
Thread model: posix
Last commit in llvm was 186311 and last commit in clang was 186306
In don't know does it matter but I send llc version as well:
tatraian@server09:~/tmp/llvm-svn/tools/clang$ llc --version
LLVM (http://llvm.org/):
LLVM version 3.4svn
Optimized build.
Built Jul 15 2013 (09:42:58).
Default target: i386-linux-gnu
Host CPU: corei7-avx
Registered Targets:
aarch64 - AArch64 (ARM 64-bit target)
arm - ARM
cpp - C++ backend
hexagon - Hexagon
mblaze - MBlaze
mips - Mips
mips64 - Mips64 [experimental]
mips64el - Mips64el [experimental]
mipsel - Mipsel
msp430 - MSP430 [experimental]
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
ppc32 - PowerPC 32
ppc64 - PowerPC 64
r600 - AMD GPUs HD2XXX-HD6XXX
sparc - Sparc
sparcv9 - Sparc V9
systemz - SystemZ
thumb - Thumb
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore - XCore
That's strange... we really don't have an implementation of __atomic_add_fetch.
(In reply to comment #3)
> That's strange... we really don't have an implementation of
> __atomic_add_fetch.
Huh, that is strange. Since the atomic library specification doesn't include
__atomic_add_fetch functions, we are presumably supposed to call
__atomic_fetch_add_<n> here.
Oh, right, duh... __atomic_add_fetch_n doesn't exist because you can easily emulate it on top of __atomic_fetch_add_n. It's just that clang IRGen doesn't know how yet.
Attached atomic.patch
(2686 bytes, text/plain): missing atomic_
I wrote a quick fix for the issue. I patched CGAtomic.cpp.
I'm not sure about my code. As I could recognize (without any detailed knowledge of llvm and clang) the switch that cannot recognize the atomic instruction generate library calls. So I put the missing calls there. But there is a problem with this solution. GCC 4.7 does not provide any atomic library from its atomic calls. There is an example libatomic.c on the web:
http://gcc.gnu.org/wiki/Atomic/GCCMM
but his code contains no _atomic
I attached the patch.
I wrote a quick fix for the issue. I patched CGAtomic.cpp.
I'm not sure about my code. As I could recognize (without any detailed knowledge of llvm and clang) the switch that cannot recognize the atomic instruction generate library calls. So I put the missing calls there. But there is a problem with this solution. GCC 4.7 does not provide any atomic library from its atomic calls. There is an example libatomic.c on the web:
http://gcc.gnu.org/wiki/Atomic/GCCMM
but his code contains no _atomic
I attached the patch.
Works in current clang.
atomic.patch
(2686 bytes, text/plain)