RTS SMP: Use compiler built-ins on all platforms.
authorPeter Trommler <ptrommler@acm.org>
Fri, 3 Jun 2016 20:22:23 +0000 (22:22 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sat, 4 Jun 2016 07:35:49 +0000 (09:35 +0200)
commiteda73a3ad3fdd98cf877b25c3c984c6e1b2217fc
treeac8bb4159a447d16283abd9dace93719032b3921
parent4aa299db6b1025822673713a110b17c002ddcfaf
RTS SMP: Use compiler built-ins on all platforms.

Use C compiler builtins for atomic SMP primitives. This saves a lot
of CPP ifdefs.

Add test for atomic xchg:
Test if __sync_lock_test_and_set() builtin stores the second argument.
The gcc manual says the actual value stored is implementation defined.

Test Plan: validate and eyeball generated assembler code

Reviewers: kgardas, simonmar, hvr, bgamari, austin, erikd

Reviewed By: simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2233
includes/stg/SMP.h
testsuite/tests/rts/all.T
testsuite/tests/rts/atomicxchg.c [new file with mode: 0644]