This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/36793] New: x86-64 does not get __sync_synchronize right
- From: "jfc at mit dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jul 2008 15:10:14 -0000
- Subject: [Bug target/36793] New: x86-64 does not get __sync_synchronize right
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
As I understand __sync_synchronize, the intent is to emit a memory barrier
instruction, at least on multiprocessor systems. Currently on x86
__sync_synchronize inhibits explicit code motion across the builtin function
call but not processor reordering of memory operations across the builtin
function call.
I think mfence is the right instruction on x86-64, and this or a similar
pattern should be added to sync.md:
(define_insn "memory_barrier"
[(unspec_volatile [(const_int 0)] UNSPEC_MFENCE)]
"TARGET_SSE2"
"mfence")
--
Summary: x86-64 does not get __sync_synchronize right
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jfc at mit dot edu
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793