This is the mail archive of the gcc-patches@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]

Re: [cxx-mem-model] Generic atomic functions


Hi,

On Tue, 25 Oct 2011, Andrew MacLeod wrote:

> and new generic routines are provided as follows:
> 
> void __atomic_load (T* object, T* return_value, memory_order m)
> void __atomic_store (T* object, T* new_value, memory_order m)
> void __atomic_exchange (T* object, T* new_value, T* return_value, memory_order
> m)
> void __atomic_compare_exchange (T* object, T* expected_value, T* new_value,
> bool weak, memory_order success, memory_order fail)
> 
> When a generic routine is called with an object whose size maps to one 
> of the type specific built-ins, (ie sizeof (T) == 1,2,4,8 or 16) the 
> generic call is translated into the appropriate direct call.

Are the generic routines really generic?  In particular do they accept 
objects that aren't naturally aligned and are supposed to still work?  In 
that case you can't rewrite them into the type specific builtins after 
only checking the size, you also need to check alignment.


Ciao,
Michael.


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