[libc-commits] [PATCH] D142108: [libc][NFC] Detect host CPU features using try_compile instead of try_run.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jan 19 08:20:37 PST 2023


lntue added a comment.

In D142108#4065441 <https://reviews.llvm.org/D142108#4065441>, @gchatelet wrote:

> I have two design questions:
>
> - Do we want to merge "architectures.h" and "cpu_features.h" since they usually are used together?
> - Do we want to autogenerate the C files since they are not quite minimal?

I think it is good to have "architectures.h" and "cpu_features.h" as 2 separate files, but maybe we can require user to only include one of them by like including "cpu_features.h" at the end of "architectures.h" (or the other way around).
About autogenerating those C files, for now I don't think we need it yet, as the number of CPU features are quite minimal and manageable.  So for a few CPU features that we care right now, explicit check files are clearer IMO, and I don't expect them to be too many.



================
Comment at: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake:60
+      COMPILE_DEFINITIONS -I${LIBC_SOURCE_DIR} ${LIBC_COMPILE_OPTIONS_NATIVE}
+      SOURCES ${LIBC_SOURCE_DIR}/cmake/modules/cpu_features/check_${feature}.c
+    )
----------------
Look like `SOURCES` argument needs to be right after output directory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142108/new/

https://reviews.llvm.org/D142108



More information about the libc-commits mailing list