Change this to:
#ifndef K_CALG_COH_SHAREABLE
#define K_CALG_COH_SHAREABLE 5
#endif
This would then be a separate patch from the LOONGSON3 sopecific things.
Then move your LOONGSON3 specific version to spaces.h