[cairo-bugs] [Bug 103559] Incorrect code generation for atomic operations if HAVE_INTEL_ATOMIC_PRIMITIVES defined

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Nov 6 10:49:08 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103559

--- Comment #3 from Mikhail Fludkov <fludkov.me at gmail.com> ---
(In reply to Adrian Johnson from comment #2)
> I would just use __sync_fetch_and_add(x, 0) for the get. The C++11 atomics
> were added in gcc 4.7 (about 5 years ago). Anyone caring about speed should
> be using a recent version of gcc.

Agree it will be explicit and less "magical". What about using the same
implementation regardless of ATOMIC_OP_NEEDS_MEMORY_BARRIER define?

The naming is a bit confusing though. When I read HAVE_INTEL_ATOMIC_PRIMITIVES
define, I immediately thought about Intel Compiler and the libraries that come
with it. Maybe HAVE_GCC_41_ATOMICS, or HAVE_GCC_OLD_ATOMICS names are better?

> What version of gcc were you using? Maybe the old versions that don't
> support C++11 atomics do not optimize away the read.
We backported the patch (https://bugs.freedesktop.org/show_bug.cgi?id=103037)
on top of libcairo version which didn't have the code under
HAVE_CXX11_ATOMIC_PRIMITIVES define. Compiled with gcc 4.9, ended up with a hot
loop.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20171106/a33f95f8/attachment.html>


More information about the cairo-bugs mailing list