runtime, sync: use __atomic intrinsics instead of __sync

GCC has supported the __atomic intrinsics since 4.7.  They are better
than the __sync intrinsics in that they specify a memory model and,
more importantly for our purposes, they are reliably implemented
either in the compiler or in libatomic.

Fixes https://gcc.gnu.org/PR52084

Change-Id: I27333d59e7c795c1e2a6de63eb5eab67d9fe13b2
Reviewed-on: https://go-review.googlesource.com/c/160820
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
13 files changed