https://bugs.llvm.org/show_bug.cgi?id=38515
Bug ID: 38515
Summary: 64-bit atomic_load
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
I have noticed that clang/llvm generates atomic_load (64-bit) for i686+ as
cmpxchg8b, whereas gcc avoids it by using FPU instructions.
#include <stdatomic.h>
unsigned long long func(_Atomic(unsigned long long) *a)
{
return atomic_load(a);
}
clang -Wall -O2 -m32 -S test.c
clang/llvm:
func: # @func
# %bb.0:
pushl %ebx
pushl %esi
movl 12(%esp), %esi
xorl %eax, %eax
xorl %edx, %edx
xorl %ecx, %ecx
xorl %ebx, %ebx
lock cmpxchg8b (%esi)
popl %esi
popl %ebx
retl
.Lfunc_end0:
whereas gcc generates:
func:
.LFB0:
.cfi_startproc
subl $12, %esp
.cfi_def_cfa_offset 16
movl 16(%esp), %eax
fildq (%eax)
fistpq (%esp)
movl (%esp), %eax
movl 4(%esp), %edx
addl $12, %esp
.cfi_def_cfa_offset 4
ret
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs