From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3699 invoked by alias); 9 Mar 2010 23:25:37 -0000 Received: (qmail 3614 invoked by uid 48); 9 Mar 2010 23:25:23 -0000 Date: Tue, 09 Mar 2010 23:25:00 -0000 Message-ID: <20100309232523.3613.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/42869] GOMP_critical_start wrong on Itanium due to __sync miscompilation In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sje at cup dot hp dot com" 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: 2010-03/txt/msg00888.txt.bz2 ------- Comment #2 from sje at cup dot hp dot com 2010-03-09 23:25 ------- I think the code is wrong. Looking at ToT, config/ia64/sync.md will generate the code shown where the memory fence is in front of the cmpxchg4.rel instruction. cmpxchg4.rel has release semantics which are defined in the Itanium manual as: "Release instructions guarentee that all previous orderable instructions are made visible prior to being made visible themselves." This would imply to me that the memory fence before the cmpxchg4.rel is not needed but we do need one after it in order to prevent things being moved up ahead of the cmpxchg4.rel. Alternatively, we could change to code to use cmpxchg4.acq instead of cmpxchg4.rel and keep the memory fence where it is. cmpxchg4.acq has acquire semantics instead of release semantics. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42869