Implement generic UPC atomics.

While porting UPC atomics it was discovered that Clang builtin atomics
do not work the way they are supposed too.  Its deficiencies:

- Missing 128 bit atomics
- Missing 64 bit inline atomics on 32-bit targets (libatomics calls
  are generated)
- Bad code generation for 64 bit atomics on 32 bit target

For the above reasons, Clang uses generic UPC atomics where a spin
lock is used to protect critical regions.
Implement generic UPC atomics.