Boost logo

Boost :

Subject: Re: [boost] [atomic] comments
From: Domagoj Saric (domagoj.saric_at_[hidden])
Date: 2011-10-28 11:12:55

On 21.10.2011. 13:06, Tim Blechmann wrote:
>>> compile-time vs run-time dispatching:
>>> some instructions are not available on every CPU of a specific
>>> architecture. e.g. cmpxchg8b or cmpxchg16b are not available on all
>>> ia32/x86_64 cpus. i would appreciate if these instructions would not be
>>> used before performing a CPUID check, whether these instructions are
>>> really available (at least in a legacy mode)
>> the correct way to do that is to have different libraries for
>> sub-architectures and have the runtime- linker decide... this requires
>> infrastructure not present in boost
> it would be equally correct to have something like:
> static bool has_cmpxchg16b = query_cpuid_for_cmpxchg16b()
> if (has_cmpxchg16b)
> use_cmpxchg16b();
> else
> use_fallback();
> less bloat and prbly only a minor performance hit ;)

cmpxchg8b is available since the original Pentium. Preferably dynamic support
for such ancient hardware, if supported at all, should not be on by default (by
forcing dynamic dispatching on everyone).

"What Huxley teaches is that in the age of advanced technology, spiritual
devastation is more likely to come from an enemy with a smiling face than
from one whose countenance exudes suspicion and hate."
Neil Postman

Boost list run by bdawes at, gregod at, cpdaniel at, john at