From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23381 invoked by alias); 10 Jul 2008 15:10:56 -0000 Received: (qmail 23123 invoked by uid 48); 10 Jul 2008 15:10:14 -0000 Date: Thu, 10 Jul 2008 15:10:00 -0000 Subject: [Bug target/36793] New: x86-64 does not get __sync_synchronize right X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jfc at mit dot edu" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-07/txt/msg01046.txt.bz2 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