[clang] [llvm] Implement a subset of builtin_cpu_supports() features (PR #82809)

Lei Huang via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 12:40:05 PDT 2024


================
@@ -141,46 +149,98 @@ PPC_LNX_CPU("power10",47)
   #define AIX_BUILTIN_PPC_TRUE 1
   #define AIX_BUILTIN_PPC_FALSE 0
   #define USE_SYS_CONF 2
-
-  // Supported COMPARE_OP values.
-  #define COMP_EQ  0
-
+  #define SYS_CALL 3
 #endif
 
 // The value of SUPPORT_METHOD can be AIX_BUILTIN_PPC_TRUE,
-// AIX_BUILTIN_PPC_FALSE, or USE_SYS_CONF.
-// When the value of SUPPORT_METHOD is USE_SYS_CONF, the return value
-// depends on the result of comparing the data member of
-// _system_configuration specified by INDEX with a certain value.
+// AIX_BUILTIN_PPC_FALSE, USE_SYS_CONF, SYS_CALL.
+// When the value of SUPPORT_METHOD is set to USE_SYS_CONF, the return value
+// depends on comparing VALUE with the specified data member of
+// _system_configuration at INDEX, where the data member is masked by Mask.
+// When the SUPPORT_METHOD value is set to SYS_CALL, the return value depends
+// on comparing a VALUE with the return value of calling `getsystemcfg`
+//  with the parameter INDEX, which is then masked by Mask.
+// AIX_BUILTIN_PPC_TRUE and AIX_BUILTIN_PPC_FALSE are for features
+// that are supported or unsupported on all systems respectively.
----------------
lei137 wrote:

Maybe this will be more clear:
```suggestion
// The value of SUPPORT_METHOD can be:
//    AIX_BUILTIN_PPC_TRUE : feature supported
//    AIX_BUILTIN_PPC_FALSE : feature not supported
//    USE_SYS_CONF : return value depends on comparing VALUE with the specified
//                   data member of _system_configuration at INDEX, where the
//                   data member is masked by Mask.
//    SYS_CALL : return value depends on comparing a VALUE with the return value
//               of calling `getsystemcfg` with the parameter INDEX, which is
//               then masked by Mask.
```

https://github.com/llvm/llvm-project/pull/82809


More information about the cfe-commits mailing list