13 Commits

Author SHA1 Message Date
Guillaume Chatelet
54963cad87 [libc] Add AVX detectionwq 2023-04-18 13:11:33 +00:00
Guillaume Chatelet
a6db871e85 [libc][NFC] Move cpu_features.h to properties subfolder 2023-02-09 09:30:24 +00:00
Guillaume Chatelet
a2569a76e0 [libc][NFC] Rename macros 2023-02-07 20:43:33 +00:00
Guillaume Chatelet
ced5a382a8 [libc][NFC] Move cpu_features to macros folder 2023-02-07 10:32:19 +00:00
Guillaume Chatelet
fd64482e3d [libc][NFC] Detect host CPU features using try_compile instead of try_run.
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D142108
2023-01-25 07:57:32 +00:00
Guillaume Chatelet
76f9a6a4e7 Revert D142108 "[reland][libc][NFC] Detect host CPU features using try_compile instead of try_run."
The build bots are failing.
This reverts commit c84d74f5bfe810744de1268eb0516a6622e4aa73.
2023-01-24 16:23:32 +00:00
Guillaume Chatelet
c84d74f5bf [reland][libc][NFC] Detect host CPU features using try_compile instead of try_run.
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.

Differential Revision: https://reviews.llvm.org/D142108
2023-01-24 16:04:10 +00:00
Guillaume Chatelet
9c4c32a3d0 Revert D142108 "[libc][NFC] Detect host CPU features using try_compile instead of try_run."
Build bots are failing.
https://lab.llvm.org/buildbot/#/builders/90/builds/44634

This reverts commit 9acc2f37bdfce08ca0c2faec03392db10d1bb7a9.
2023-01-23 10:43:34 +00:00
Guillaume Chatelet
9acc2f37bd [libc][NFC] Detect host CPU features using try_compile instead of try_run.
This implements the same behavior as D141997 but makes sure that the same detection mechanism is used between CMake and source code.

Differential Revision: https://reviews.llvm.org/D142108
2023-01-23 09:05:53 +00:00
Siva Chandra Reddy
c68b9cc0aa [libc][NFC] Use C headers in host CPU sniffing code. 2023-01-13 07:43:32 +00:00
Siva Chandra Reddy
7cd420649f [libc][NFC] Use a end of list marker for cpu feature detection.
Without this, the array can end up being an empty array leading to
compiler failures.
2021-01-27 01:24:15 -08:00
Guillaume Chatelet
04a309dd0b [libc] Adding memcpy implementation for x86_64
Summary:
The patch is not ready yet and is here to discuss a few options:
 - How do we customize the implementation? (i.e. how to define `kRepMovsBSize`),
 - How do we specify custom compilation flags? (We'd need `-fno-builtin-memcpy` to be passed in),
 - How do we build? We may want to test in debug but build the libc with `-march=native` for instance,
 - Clang has a brand new builtin `__builtin_memcpy_inline` which makes the implementation easy and efficient, but:
   - If we compile with `gcc` or `msvc` we can't use it, resorting on less efficient code generation,
   - With gcc we can use `__builtin_memcpy` but then we'd need a postprocess step to check that the final assembly do not contain call to `memcpy` (unlikely but allowed),
   - For msvc we'd need to resort on the compiler optimization passes.

Reviewers: sivachandra, abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits, courbet

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D74397
2020-03-18 17:43:21 +01:00
Guillaume Chatelet
1aab055dd8 [libc] Add CMake script to check host cpu features
Summary:
Tested on MacOSX and Linux.
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

Reviewers: sivachandra, abrachet

Subscribers: mgorny, MaskRay, tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D74897
2020-02-27 09:52:26 +01:00