Add some new functions to atomic.h and rearrange a bit

This is currently only done on x86_64.  We will need to add similar functions
for i686 and Risc-V.
Conditionally decide to use fsgsbase or arch_prctl

On newer intel cpus rdfsbase and wrfsbase instructions are callable from
userspace to read/write the fsbase register for use by TLS.  The changes we
made here use the HAVE_FSGSBASE macro new defined at configure time to decide
if we should use these instructions or default back to using arch_prctl() if
they are not supported.