On Fri, May 13, 2011 at 07:55:44AM +0200, Piotr Wyderski wrote: > Jakub Jelinek wrote: > > > /* X86_TUNE_USE_INCDEC */ > > ~(m_PENT4 | m_NOCONA | m_CORE2I7 | m_GENERIC | m_ATOM), > > > > So, if you say -mtune=bdver1 or -mtune=k8, it will generate incl, > > if addl is better (e.g. on Atom incl is very bad compared to addl $1), > > it will generate it. > > Why is lock inc/dec worse than add/sub on Core2I7? > The only difference I know of is the way the carry flag > is handled.
Yeah, and that is exactly the problem, instructions that only sets a subset of the flags is problematic. See e.g. Intel's 248966.pdf, 3.5.1.1 "Use of the INC and DEC Instructions". Jakub