Yeap, good idea, both compilers use this macro. So we can check only it. #if defined(__e2k__) #define MY_CPU_E2K #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4) #define MY_CPU_NAME "e2k-ptr32" #define MY_CPU_SIZEOF_POINTER 4 #else #define MY_CPU_NAME "e2k" #define MY_CPU_SIZEOF_POINTER 8 #endif #define MY_CPU_64BIT #endif "e2k-32" is not quite the correct name, since -mptr32 is not a 32—bit mode, like i386 or SPARC V8. This is a 64-bit mode with 32-bit pointers, as in x32 ABI for x86-64....
Yeap, good idea, both compilers use this macro. So we can check only it. #if defined(__e2k__) #define MY_CPU_E2K #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4) #define MY_CPU_NAME "e2k-ptr32" #define MY_CPU_SIZEOF_POINTER 4 #else #define MY_CPU_NAME "e2k" #define MY_CPU_SIZEOF_POINTER 8 #endif #define MY_CPU_64BIT #endif "e2k-32" is not quite the correct name, since -mptr32 is not a 32—bit mode, like i386 or SPARC V8. This is a 64-bit mode with 32-bit pointers, as in x32 ABI for x86-64....
Yeap, good idea, both compilers use this macro. So we can check only it. #if defined(__e2k__) #define MY_CPU_E2K #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4) #define MY_CPU_NAME "e2k-ptr32" #define MY_CPU_SIZEOF_POINTER 4 #else #define MY_CPU_NAME "e2k" #define MY_CPU_SIZEOF_POINTER 8 #endif #define MY_CPU_64BIT #endif
Yeap, good idea, both compilers use this macro. So we can check only it. #if defined(__e2k__) #define MY_CPU_E2K #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4) #define MY_CPU_NAME "e2k-32" #define MY_CPU_SIZEOF_POINTER 4 #else #define MY_CPU_NAME "e2k" #define MY_CPU_SIZEOF_POINTER 8 #endif #define MY_CPU_64BIT #endif
Both clang and mcst-lcc use __ptr32__ and __ptr64__ respectively. Also clang has standard macros as _ILP32, __ILP32__and _LP64,__LP64__. So, __ptr32__ macro will be enough to check. A new workaround has also been added in patch for mcst-lcc compiler < 1.26.10 (don't support __attribute__((optimize("no-tree-vectorize"))))
Possible output strings of const char* __builtin_cpu_arch (void) is: elbrus-v1, elbrus-v2, elbrus-v3, elbrus-v4, elbrus-v5 and elbrus-v6. The documentation for the mcst-lcc compiler is currently supplied only with the compiler itself. This function (as const char* __builtin_cpu_name (void) function) is designed to work in run-time, so it takes data from the processor registers.
Thanks for your comment, I almost forgot about clang (this compiler has recently appeared on the Elbrus platform).
E2K compilation fix for Linux 7-Zip 23.01