[v3] atomics

Lawrence Crowl crowl@google.com
Mon Apr 21 23:05:00 GMT 2008


On 4/21/08, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Apr 21, 2008 at 02:39:15PM -0500, Benjamin Kosnik wrote:
>  > That's possible, but certainly more work than just assuming that if the
>  > __sync builtins are implemented, they are implemented for the entire
>  > set of sizes. (This is only coming up now because libstdc++ only used
>  > the atomic word size up until recently. It looks like libgfortran is
>  > is also only checking for int in LIBGFOR_CHECK_SYNC_FETCH_AND_ADD.)
>
>
> Assuming you have full set of sizes is bad.  While backends can implement
>  smaller sizes by using large atomics, if the hw has no support for large
>  sizes, it is nothing that can be worked around in the backends.
>  Consider e.g. i486, which supports 1/2/4 byte __sync_val_compare_and_swap,
>  but doesn't support 8 byte (long long), similarly ppc 32-bit.

The expectation is that the atomics will use locking if they get too
large for the hardware.  There is an effect on macro definitions,
so some coordination between machine model and compiler front
end is necessary.

-- 
Lawrence Crowl



More information about the Gcc-patches mailing list