[libc-commits] [PATCH] D74897: [libc] Add CMake script to check host cpu features
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Feb 20 12:48:35 PST 2020
sivachandra added a comment.
In D74897#1885013 <https://reviews.llvm.org/D74897#1885013>, @abrachet wrote:
> > For robustness we can go the OpenCV way and add individual c++ files with intrinsics.
> > https://github.com/opencv/opencv/blob/master/cmake/checks/cpu_avx2.cpp
>
> I think this makes the most sense. It's also what cmake does in the initial configuration step where it creates small source files and sees if they compile. Do all of the cpu features that you are interested in have related intrinsics? Or will we need to assemble and run files to see if the cpu raises an invalid opcode exception?
Yes, this is what I was hinting at when I proposed the `try_run`/`try_compile` solution.
I am OK with this change however if you think it will help you make progress with other things but may be put this in a x86 specific location.
================
Comment at: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake:10
+function(check_host_cpu_features)
+ if(${CMAKE_HOST_APPLE})
+ execute_process(
----------------
If OSX requires more massaging of the results, then may be just not include it here?
================
Comment at: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake:20
+ execute_process(
+ COMMAND grep -h -m1 \\w*flags\\w* /proc/cpuinfo
+ COMMAND cut -f2 -d:
----------------
Apparently, cpuinfo on powerpc does not give the flags!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74897/new/
https://reviews.llvm.org/D74897
More information about the libc-commits
mailing list