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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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"))))
__ptr32__ is not good, because gcc doesn't use __ptr32__.
And I try to get some unification, where the code works same way in both gcc and clang for any platform.
So __SIZEOF_POINTER__ check looks better for me.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"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. Therefore, I suggest calling it "e2k-ptr32" above, so that there is no confusion and misunderstanding.
There is no such thing as a "32-bit Elbrus". The base registers are always 64-bit, capable of being decomposed into 2 halves or combined into 2 pieces (for v5+).
I suppose that
will not work with clang.
So we must use also
__LCC__
check for these calls.I'll fix
#pragma message
and another problems.Thanks.
Thanks for your comment, I almost forgot about clang (this compiler has recently appeared on the Elbrus platform).
What exact possible output strings of
__builtin_cpu_arch()
?Are there any docs for this function?
Does it read some registers from processor?
Last edit: Igor Pavlov 2023-10-25
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.please check also
-m32
modes of clang and lcc:lcc doesn't use
__ILP32__
by some reason, as another compilers.So we need more checks:
CpuArch.h
:Last edit: Igor Pavlov 2023-10-25
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")))
)__ptr32__
is not good, because gcc doesn't use__ptr32__
.And I try to get some unification, where the code works same way in both gcc and clang for any platform.
So
__SIZEOF_POINTER__
check looks better for me.Yeap, good idea, both compilers use this macro. So we can check only it.
"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. Therefore, I suggest calling it "e2k-ptr32" above, so that there is no confusion and misunderstanding.There is no such thing as a "32-bit Elbrus". The base registers are always 64-bit, capable of being decomposed into 2 halves or combined into 2 pieces (for v5+).
Last edit: Ramil Sattarov 2023-10-27