Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong intrinsics for GCC in atomic/atomic.h #32

Open
leafi opened this issue Apr 1, 2020 · 0 comments
Open

Wrong intrinsics for GCC in atomic/atomic.h #32

leafi opened this issue Apr 1, 2020 · 0 comments

Comments

@leafi
Copy link

leafi commented Apr 1, 2020

When PSNIP_ATOMIC_IMPL is equal to PSNIP_ATOMIC_IMPL_GCC, the wrong intrinsics are used for the _int64_add & _int64_sub implementations.

In https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html , you can see these intrinsics exist:

__atomic_add_fetch
__atomic_sub_fetch

__atomic_fetch_add
__atomic_fetch_sub

To be consistent with the other implementations of psnip_atomic_int64_add and psnip_atomic_int64_sub, we want to fetch and then add or subtract. However, the intrinsics used in PSNIP_ATOMIC_IMPL_GCC do things in the opposite "order".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant