Opened 9 years ago

Closed 9 years ago

#8574 closed Patches (fixed)

Optimization for 64 bit loads and stores for 32 bit x86 on gcc

Reported by: Andrey Semashev Owned by: timblechmann
Milestone: To Be Determined Component: atomic
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

The attached patch contains some fixes and optimizations for 32 bit x86 atomics support for gcc and its pretenders. In particular, the patch contains:

  1. Fix for BOOST_ATOMIC_LLONG_LOCK_FREE macro value on 32 bit x86. The macro should have value 2 when cmpxchg8b instruction is enabled in compile time and 0 otherwise (as long as Boost.Atomic doesn't perform run time detection).
  2. Fixed compile time cmpxchg8b presence check. The previous check only worked on compilers with sync* intrinsics support or on i686 class CPUs (but not later or i586).
  3. Optimized 64 bit loads and stores in 32 bit x86. When the target/source memory is 8-byte aligned (which is the most common case) it is possible to avoid expensive "lock cmpxchg8b" and use regular loads and stores instead.
  4. Added a few missing noexcept specifications.

Attachments (1)

atomic_x86.patch (5.8 KB ) - added by Andrey Semashev 9 years ago.
The patch with fixes and optimizations for 32 bit x86

Download all attachments as: .zip

Change History (3)

by Andrey Semashev, 9 years ago

Attachment: atomic_x86.patch added

The patch with fixes and optimizations for 32 bit x86

comment:1 by Andrey Semashev, 9 years ago

Note: I tried it locally on Linux with gcc and clang 32 and 64 bit. All tests passed.

comment:2 by timblechmann, 9 years ago

Resolution: fixed
Status: newclosed

(In [84288]) atomic: Optimization for 64 bit loads and stores for 32 bit x86 on gcc

fixes #8574

Note: See TracTickets for help on using tickets.