This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/42869] GOMP_critical_start wrong on Itanium due to __sync miscompilation



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]