impl atomic ops with compiler intrinsics