This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [cxx-mem-model] Generic atomic functions
- From: Michael Matz <matz at suse dot de>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Wed, 26 Oct 2011 14:29:53 +0200 (CEST)
- Subject: Re: [cxx-mem-model] Generic atomic functions
- References: <4EA6EFEE.5090403@redhat.com>
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.