On 2019-10-07, Charlene Wendling <juliana...@posteo.jp> wrote:

>> I admit I haven't followed the subject of __atomic* at all.
>> What's the reason to enable the use of these primitives only for
>> powerpc/hppa and not on all archs?
>
> GCC has no 64-bits __sync* operators support on macppc and hppa, the
> newer __atomic* ones have it.
>
> We sure can enable __atomic* for all archs, it works at least on amd64,
> but may break somewhere else - upstream's intention was to provide a
> workaround [0].

It works on aarch64 and the test program also works on i386:

    #include <cstdint>
    int main() {
        uint64_t x = 1;
        __atomic_add_fetch(&x, 0, __ATOMIC_RELAXED);
        return x;
    }

More generally, I assume if an arch supports (1) 64-bit __sync*
primitives and (2) __atomic* primitives, then it will also have
64-bit __atomic*.

> +# Use __atomic* function instead of __sync* ones, allowing to build on
> +# the following archs.
> +CONFIGURE_ARGS +=    -DUSE_NEW_ATOMIC_BUILTINS=On
> +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "hppa"
> +WANTLIB +=           atomic
> +.endif

I like this better.
But I don't want to start backseat-driving atomic fixes now, after
ignoring them all throughout the release cycle...

-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to