1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 15:12:30 +02:00

55 Commits

Author SHA1 Message Date
Christian Clauss
dcddc4a2cb Fix typos discovered by codespell 2025-02-26 13:37:34 +01:00
Christoph Grüninger
0bc979d7ca
cmake: Remove useless check for CMP0077 (#372)
cpu_features requires CMake 3.13 which sets CMP0077
always to NEW.
2024-12-09 11:45:22 +01:00
Brad Smith
aabbd16864
Add OpenBSD Arm64 support (#367) 2024-11-08 11:14:32 +01:00
Mykola Hohsadze
89a3f0358a
Add FreeBSD Arm64 support (#295)
* Add FreeBSD Arm64 detection

Getting all the features is handled by reading /var/run/dmesg.boot. Feature detections were taken from the freebsd kernel code sys/arm64/arm64/identcpu.c

* Add FreeBSD Arm64 tests

* Add flagm, flagm2 and rng detection

* Add HWCAP FreeBSD AArch64

* Update include to use linux hwcaps for powerpc

* Add FreeBSD aarch64 impl

* Separate Hwacps to freebsd and linux implementation

* Add aarch64 midr_el1 implementation

* Add detection hwcap cpuid to hwcaps.h

* Add MIDR_EL1 tests
2023-09-19 11:02:25 +02:00
Guillaume Chatelet
ba4bffa86c Release v0.9.0 2023-09-14 12:15:33 +00:00
Mizux
688decfc80
cmake: Use CpuFeatures:: as TARGET namespace (Fix #333) (#334) 2023-09-14 10:19:28 +02:00
Alexander Mitin
52874f0ced
Add BUILD_INSTALL option to manage 'install' target (#325) 2023-08-31 10:58:45 +02:00
Guillaume Chatelet
e2d0f2ca21 Bumping CMake minimum version to 3.13
Following gtest minimum version https://github.com/google/googletest/blob/v1.14.0/CMakeLists.txt#L4
2023-08-30 13:55:44 +00:00
Weihang Ding
bd580370ee
Fix windows x86 and arm64 build and add an option to enable/disable target list_cpu_features (#317)
* Add an option to enable/disable target list_cpu_features

* Fix windows x86 and arm64
2023-08-28 16:29:00 +02:00
arkivm
c5ece5e8cc
Add support for Apple M1 AArch64 SoCs (#204)
* Add support for Apple M1 AArch64 SoCs

Completely based on #150. Thanks to @sbehnke!
+ Refactoring to accomodate the new source tree
+ Adding more feature flags

* revert minimum version to 3.0

* Update introspection table

* Simplify logic for Apple HAVE_SYSCTLBYNAME

---------

Co-authored-by: Guillaume Chatelet <gchatelet@google.com>
2023-08-28 11:16:41 +02:00
Wang Xiang
0d5f398c58
Add loongarch64 Support (#314)
* Add macros for LOONGARCH hwcaps

* Update hwcaps.h

* LoongArch Support

* Remove unused definitions.

* Add ignored feature in test.
2023-08-23 20:35:29 +02:00
damageboy
41e206e435
cmake: make default test building dependent on being a main project build vs. being included into other projects (#290) 2023-05-04 08:54:03 +02:00
Guillaume Chatelet
936b9ab551 Release v0.8.0 2023-04-27 07:44:32 +00:00
Mykola Hohsadze
a6bf4f9031
Add Windows Arm64 support (#291)
* Add Windows Arm64 support

To add Windows Arm64 support was added detection of features via Windows API function IsProcessorFeaturePresent. Added _M_ARM64 to detect CPU_FEATURES_AARCH64 macro on Windows. Added initial code for Windows Arm64 testing and provided test for Raspberry PI 4. We can't use "define_introspection_and_hwcaps.inl" as a common file for all operating systems due to msvc compiler error C2099: initializer is not a constant, so as a workaround for Windows I used separate "define_introspection.inl"

See also: #268, #284, #186

* [CMake] Add  windows_utils.h to PROCESSOR_IS_AARCH64

* Add detection of armv8.1 atomic instructions

* Update note on win-arm64 implementation and move to cpuinfo_aarch64.h

* Remove redundant #ifdef CPU_FEATURES_OS_WINDOWS

* Add note on FP/SIMD and Cryptographic Extension for win-arm64

* Add comments to Aarch64Info fields

Added comments to specify that implementer, part and variant we set 0 for Windows, since Win API does not provide a way to get information. For revision added comment that we use GetNativeSystemInfo
2023-02-23 11:41:33 +01:00
Ben Beasley
273af56a15
Update C++ standard for tests from C++11 to C++14 (#293)
Since 1.13.0, gtest requires at least C++14. When it is automatically
downloaded and compiled, gtest’s CMake scripts override the C++
standard, so the tests are compiled in C++14 mode already. Changing the
C++ standard in cpu_features will make it easier for users such as Linux
distribution packagers who are linking against an external or
system-wide copy of gtest 1.13.0 or later.
2023-02-22 15:13:23 +01:00
Guillaume Chatelet
c919e9aa77
Support risc-v (#287)
Co-authored-by: DaniAffCH <danieleaffinita2000@gmail.com>
Co-authored-by: Corentin Le Molgat <corentinl@google.com>
2023-01-12 17:19:05 +01:00
marquitos0119
981fbe3914
S390X Support (#274)
* support for s390x

* added z15 T01, T02 model checking

* removed z15 checking

* removed empty strings

* added s390x unit tests

* added reference url for hwcaps

* moved documentation to S390XFeatures struct, updated copyright date, removed unused include statement

* changed num_processors to int

* removed newlines from test inputs

* scripts: Add bootlin s390x support

* cmake(ci): Add s390x support

* ci: Add s390x workflow

Co-authored-by: Marcos <marcos.araque.fiallos@ibm.com>
Co-authored-by: Corentin Le Molgat <corentinl@google.com>
2022-11-02 09:38:13 +01:00
Andrei Kurushin
38ae5d095c
add windows ssse3,sse4_1,sse4_2 detection for non avx path (#251)
* add windows ssse3,sse4_1,sse4_2 detection for non avx path

* remove special WESTMERE case

* move windows conditional redefinition to separate header

* fix minor issues
2022-07-21 21:56:50 +02:00
Guillaume Chatelet
8a494eb1e1 Release v0.7.0 2022-03-08 10:31:24 +00:00
Guillaume Chatelet
69d39934e8
Fix arm64 detection precedence in CMakeLists.txt (#209)
Fixes #179
2021-11-30 10:45:28 +01:00
Guillaume Chatelet
deb2a61b80
New code layout - breaking change in cpu_features_macros.h (#194)
This commit helps with platform code separation (fixes #3). It should also help with the build as we can simply include all `impl_*.c` files regardless of OS / arch.

Note: this patch contains breaking changes in `include/cpu_features_macros.h`
 - `CPU_FEATURES_OS_LINUX_OR_ANDROID` does not exist anymore
 - `CPU_FEATURES_OS_FREEBSD`, `CPU_FEATURES_OS_ANDROID` and `CPU_FEATURES_OS_LINUX` are now mutually exclusive (i.e. `CPU_FEATURES_OS_ANDROID` does not imply `CPU_FEATURES_OS_LINUX`)
 - `CPU_FEATURES_OS_DARWIN` has been renamed into `CPU_FEATURES_OS_MACOS` to be able to target non-Mac Apple products (IOS, TV, WATCH). They are now targetable with `CPU_FEATURES_OS_IPHONE`. This matches Apple naming convention described in [this stackoverflow](https://stackoverflow.com/a/49560690).
2021-10-28 13:52:46 +02:00
Corentin Le Molgat
545b2e84ec cmake: Use of CMAKE_POSITION_INDEPENDENT_CODE instead of BUILD_PIC (Fix #143) 2021-10-25 12:01:38 +00:00
SpaceIm
2939ece4d2
add BUNDLE DESTINATION (#177)
required for installation of executable target if cross-build to iOS/tvOS/watchOS
see https://cmake.org/cmake/help/latest/policy/CMP0006.html
2021-10-18 13:29:39 +02:00
Mizux
06fdc0aa1d
cmake: Use CTest default (Fix #169) (#170)
note: this is the default behaviour when using include(CTest)
2021-06-30 15:15:01 +02:00
Guillaume Chatelet
a8397ba459
Bump version to v0.6.0 2020-10-15 11:09:51 +02:00
Guillaume Chatelet
9a8f04b24c
[NFC] Generate separate tables via macro (#137)
This is a non functional change, it allows:
 - Getting rid of `unix_features_aggregator`
 - Have a single blob describing the features
 - Fix wrong mocking of `hwcaps`

Downside: abuse of macros makes the code slightly magical and harder to understand.
It think it's still an improvement over the current situation as there's less repetition and less chances to get something wrong.
2020-10-12 09:50:35 +00:00
Guillaume Chatelet
e63405f118
Remove need for utsname (#136) 2020-10-09 20:40:06 +00:00
Guillaume Chatelet
4795373db2
Fix SSE detection on non-AVX CPUs (#135)
Fixes #4. This is based on #115 with a few modifications:
 - Removed use of __builtin_cpu_supports since it relies on cpuid and doesn't improve on the current situation,
 - Added detection for all of sse, sse2, sse3, ssse3, sse4_1 and sse4_2,
 - Added tests for Atom, Nehalem, and P3 processors,

Thx to @gadoofou87 for providing the original PR.
It also removes the need for #92

* Fix SSE detection on non-AVX CPUs
* Fixes typo
* Mock OSX sysctlbyname in tests
* Also update other tests
* FakeCpu is reset between each tests
* Fix conflicting name on Windows
* Disable pre AVX cpu sse detection tests on Windows
* Guard OS specific code with macros
* Fix missing import for tests
* Fix wrong function prototype
* Fix wrong mocking of P3 on Windows
* Completely guard OS specific parts in x86 tests
* Store DWORD instead unsigned long for x86 tests
2020-10-09 15:20:25 +00:00
Mizux
a7e0963508
Fix trailing spaces. (#133) 2020-09-23 07:27:23 +00:00
Mizux
4efc837a92
Bump version 0.1.0 -> 0.5.0 (Fix #118) (#129) 2020-09-21 09:59:55 +00:00
Nikita Karpey
eb168a2da2
Fix shared build (#113)
* Fix PIC property in util library.
* Force PIC when building shared lib on unix.
* Enable CMP0077 for better option handling.
2020-03-11 21:54:42 +01:00
Nikita Karpey
ba81cb3da9
CMake: Enable CXX compiler for tests only (#110)
CMake: Enable CXX compiler for tests only

Co-authored-by: Mizux <mizux.dev@gmail.com>
2020-03-11 14:40:23 +01:00
Mizux
b5c271c537
CMake: Add missing alias for cpu_feature (#107)
For customers using add_subdirectory() approach

related to #106
2020-02-06 09:42:20 +01:00
Artem Alekseev
bd358abe6a Fix cmake install 2019-07-16 13:45:33 +03:00
Steven Kreuzer
f832ad2b12 Fix builds on BSD
Fix the build on BSD by setting PROCESSOR_IS_X86 when CMAKE_SYSTEM_PROCESSOR
matches amd64.

Signed-off-by: Steven Kreuzer <skreuzer@FreeBSD.org>
2019-07-13 22:33:31 -04:00
Artem Alekseev
653d581e03 Add support for leaf2 and leaf4 on Intel's x86 arch (#80)
* Add support for leaf4 on Intel's x86 arch
* Update cpuinfo_x86.h
* Fix typo
* Force compiler to use C99
* Add Intel x86 leaf2 support
* Fixes after review
* Fix review comments
2019-07-02 16:52:25 +02:00
William Tambellini
7806502271 Add PIC option (#66) 2019-02-13 11:55:17 +01:00
Guillaume Chatelet
20fa92a02a
Release ndk support (#62)
Fixes #47
2019-01-23 12:59:46 +01:00
Guillaume Chatelet
dfdac6adfc
Add partial implementation of ndk_compat (#54)
* First implementation of ndk_compat
* Restrict building of linux_based_hardware_detection to UNIX
* Fix variable declaration and printf formatting
* Restrict ndk compat to UNIX style systems
* Restrict cpu_mask index to 32
* Fix values display in ndk-compat-test
* Addressing comments
2019-01-17 18:00:21 +01:00
Guillaume Chatelet
98bd43ffce UNIX works for Unix like OS so no need to add APPLE. 2019-01-15 17:35:04 +01:00
Guillaume Chatelet
b3bb9048f4 Fix discovery of <sys/auxv.h> 2019-01-15 17:34:52 +01:00
Guillaume Chatelet
347065af95 Add AMD64 and i386/i686 to x86 detection 2019-01-15 15:30:43 +01:00
Guillaume Chatelet
122b067087 Use Cmake macros to detect getauxval and dlopen 2019-01-15 15:18:08 +01:00
Guillaume Chatelet
e8e5610fc4 Per arch build and inlining of cpuid_x86. 2019-01-15 10:52:56 +01:00
Peter Steinbach
ce4637008d without cpu_features_macros.h in the install tree, the library cannot
be used after `make install`
2018-05-22 10:09:00 +02:00
Rashmica Gupta
3adafbfe66
powerpc: Added PowerPC implementation
Signed-off-by: Rashmica Gupta <rashmica.gupta@au1.ibm.com>
2018-05-15 14:24:45 +10:00
Guillaume Chatelet
07fd90d4f5 Add JSON output. Fixes #24 2018-03-27 15:28:40 +02:00
Guillaume Chatelet
7634420f31 GCC does not discover all cpu features. Fixes #22 2018-02-13 10:12:21 +01:00
Guillaume Chatelet
9df2d78b8d Update googletest management. 2018-02-13 10:07:02 +01:00
Guillaume Chatelet
57917d2b12 Fix typo in CMakeLists.txt 2018-02-12 16:48:57 +01:00