[llvm-bugs] [Bug 38515] New: 64-bit atomic_load
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Aug 10 02:55:26 PDT 2018
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: unassignedbugs at nondot.org
Reporter: nruslan_devel at yahoo.com
CC: llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180810/fa3c0062/attachment-0001.html>
More information about the llvm-bugs
mailing list