[AIX] support builtin_cpu_support
Lowering of intrinsic __builtin_cpu_is and __builtin_cpu_support into AIX platform-specific code.
The runtime external variable _system_configuration in /usr/include/sys/systemcfg.h provides all
the information needed for functions __builtin_cpu_is() and __builtin_cpu_support().
@llvm/issue-subscribers-backend-powerpc
Author: zhijian lin (diggerlin)
runtime external variable _system_configuration.version of /usr/include/sys/systemcfg.h provide all the information we need the function __builtin_cpu_is() and
it has structure like
extern struct _system_conf {
int architecture; /* processor architecture */
int implementation; /* processor implementation */
int version; /* processor version */
.....
}
it has some define as
We use the value of the implementation for the aix builtin_cpu_is()
#define POWER_7 0x8000 /* 7 class CPU /
#define POWER_8 0x10000 / 8 class CPU /
#define POWER_9 0x20000 / 9 class CPU */
It is not clear what the proposed code generation is. Is the plan to simply emit a reference to an external symbol that provides the information? If so, is there any safety if the binary is executed on a system that doesn't provide this definition in the library?
Is the plan to simply emit a reference to an external symbol that provides the information?
yes.
If so, is there any safety if the binary is executed on a system that doesn't provide this definition in the library?
I think _system_configuration is kernel variable , It do not need any library support. would like you help to double confirm? @stephenpeckham
Seems we are done for this issue? @diggerlin
yes, the PR Implement a subset of builtin_cpu_supports() features is merged