52 Commits

Author SHA1 Message Date
sayantn
2a6953d38a Add runtime feature detection for keylocker 2025-02-13 10:54:53 +00:00
sayantn
efb7cf80b9 Move all x86 std_detect tests to x86-specific.rs to reduce duplication 2025-02-07 22:09:48 +00:00
Folkert de Vries
b5babcfac2 add is_s390x_feature_detected 2025-01-16 20:39:13 +00:00
Kajetan Puchalski
168479a4a5 std_detect: Add pauth-lr aarch64 target feature
Add feature detection for aarch64 FEAT_PAuth_LR.
There is currently no Linux cpuinfo support so the OS-specific lines are
commented out.
2024-10-27 02:59:49 +08:00
Kajetan Puchalski
485ded6369 std_detect: Add sme-b16b16 as an explicit aarch64 target feature
LLVM 20 split out what used to be called b16b16 and correspond to aarch64
FEAT_SVE_B16B16 into sve-b16b16 and sme-b16b16.
Add sme-b16b16 as an explicit feature and update the detection accordingly.
2024-09-18 12:48:54 -04:00
Taiki Endo
720973b1b4 std_detect: Use elf_aux_info on FreeBSD 2024-09-18 05:07:32 -04:00
Mads Marquart
8a511191a0 Enable feature detection on all Apple/Darwin targets
Tested in the simulator and on the device I had lying around, a 1st
generation iPad Mini (which isn't Aarch64, but shows that the
`sysctlbyname` calls still work even there, even if they return false).

`sysctlbyname` _should_ be safe to use without causing rejections from
the app store, as its usage is documented in:
https://developer.apple.com/documentation/kernel/1387446-sysctlbyname/determining_instruction_set_characteristics

Also, the standard library will use these soon anyhow, so this shouldn't
affect the situation:
https://github.com/rust-lang/rust/pull/129019
2024-09-14 04:25:01 +01:00
Kajetan Puchalski
ef538bc614 std_detect: Add aarch64/linux/LLVM SME features
Add detection for SME features supported by LLVM and the Linux Kernel.
Include commented-out hwcap fields for features supported by Linux but not by LLVM.

This commit adds feature detection for the following features:

- FEAT_SME
- FEAT_SME_F16F16
- FEAT_SME_F64F64
- FEAT_SME_F8F16
- FEAT_SME_F8F32
- FEAT_SME_FA64
- FEAT_SME_I16I64
- FEAT_SME_LUTv2
- FEAT_SME2
- FEAT_SME2p1
- FEAT_SSVE_FP8DOT2
- FEAT_SSVE_FP8DOT4
- FEAT_SSVE_FP8FMA

Linux features: https://github.com/torvalds/linux/blob/master/arch/arm64/include/uapi/asm/hwcap.h
LLVM features: llvm-project/llvm/lib/Target/AArch64/AArch64.td
2024-07-25 15:18:37 +01:00
Kajetan Puchalski
dfc5dfc8ef std_detect: Add aarch64/linux/LLVM features
Add detection for various aarch64 CPU features already supported by LLVM and Linux.

This commit adds feature detection for the following features:

- FEAT_CSSC
- FEAT_ECV
- FEAT_FAMINMAX
- FEAT_FLAGM2
- FEAT_FP8
- FEAT_FP8DOT2
- FEAT_FP8DOT4
- FEAT_FP8FMA
- FEAT_HBC
- FEAT_LSE128
- FEAT_LUT
- FEAT_MOPS
- FEAT_LRCPC3
- FEAT_SVE_B16B16
- FEAT_SVE2p1
- FEAT_WFxT

It also adds feature detection for FEAT_FPMR. It is somewhat of a
special case because FPMR only exists as a feature in LLVM 18, it has
been removed from the LLVM upstream. On that account the intention is
for it to be detectable at runtime through stdarch but not have a
corresponding compile-time Rust target feature.

Linux features: https://github.com/torvalds/linux/blob/master/arch/arm64/include/uapi/asm/hwcap.h
LLVM features: llvm-project/llvm/lib/Target/AArch64/AArch64.td
2024-07-25 15:18:37 +01:00
sayantn
94153c46e9 Implemented runtime detection of xop target-feature 2024-07-06 18:55:26 +02:00
sayantn
d67ca1fe09 Added runtime detection
Cannot do a `cupid` test because they don't support `amx`.
2024-07-06 18:28:25 +02:00
sayantn
268ac7fe92 Add detection for SHA512, SM3 and SM4
Cannot cross-verify with `cupid` because they do not have these features yet.
2024-07-06 11:29:28 +02:00
sayantn
1f779b7b40 Added runtime detection
Expanded the cache size to 93 (we will need this in near future)
Fixed detection of VAES, GFNI and VPCLMULQDQ
Could not test with `cupid` because they do not support these yet
2024-06-23 10:36:46 +02:00
Daniel Paoliello
a00a70eacb arm64ec 2024-03-13 22:30:36 +00:00
usamoi
8531e289b0 feat: std_detect avx512fp16
Signed-off-by: usamoi <usamoi@outlook.com>
2024-02-24 16:07:04 +00:00
Makoto Kato
d51ea0d261 Add CPU detection for macOS/aarch64. 2024-01-16 02:57:10 +00:00
Amanieu d'Antras
76d52cdd68 Fix std_detect not being an unstable crate
More fallout from #1486
2024-01-05 11:14:38 +00:00
Amanieu d'Antras
b5406fedd4 Add #![allow(internal_features)] to a test to fix CI 2023-12-19 01:25:56 +00:00
Eduardo Sánchez Muñoz
4bfd9935f7 Simplify a cfg 2023-10-31 02:20:17 +01:00
Amanieu d'Antras
ea27e5cfcb Fix various compilation errors 2023-10-29 20:39:50 +01:00
Amanieu d'Antras
3e5850284a Fix more missing/incorrect feature specifications 2023-10-29 20:39:50 +01:00
Amanieu d'Antras
b8ba57f310 Cleanup last uses of the stdsimd feature 2023-10-29 20:39:50 +01:00
Jacob Bramley
a9fecd8456 Support AArch32 Neon dotprod intrinsics.
Note that the feature detection requires a recent Linux kernel (v6.2).
2023-06-21 18:52:21 +02:00
Taiki Endo
221eb88986 std_detect: Remove support for arm crypto target feature 2023-04-01 18:42:27 +01:00
Kathryn Long
1515d52d17 add f16c to x86 detection test 2023-03-12 20:19:54 +01:00
Taiki Endo
ba58f91769 std_detect: Support run-time detection of crc/aes/sha2/crypto on arm FreeBSD 2023-03-01 19:58:15 +01:00
Taiki Endo
8f9ed37be7 std_detect: Support run-time detection of fp on aarch64 Windows
According to google/cpu_features, IsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE)
returns whether fp is available.
a6bf4f9031/src/impl_aarch64_windows.c (L112-L113)
2023-03-01 19:57:28 +01:00
Taiki Endo
a9681a2ca6 Merge core_arch/tests/cpu-detection.rs to std_detect/tests/cpu-detection.rs
Except for the recently added `x86_deprecated` test,
`core_arch/tests/cpu-detection.rs` is a subset of
`std_detect/tests/cpu-detection.rs`.
2023-03-01 18:53:20 +01:00
Taiki Endo
dc49234574
std_detect: Support run-time detection of FEAT_LSE2 on aarch64 BSD (#1379) 2023-02-11 17:31:21 +00:00
Taiki Endo
a36f5bd7c8 std_detect: Support run-time detection on aarch64 OpenBSD 2023-01-26 23:33:52 +00:00
Taiki Endo
674fd58f60 std_detect: Move aarch64 freebsd test to tests/cpu-detection.rs 2023-01-26 23:33:52 +00:00
Taiki Endo
e706a13add std_detect: Add test for feature detection on aarch64 Windows 2023-01-23 22:26:08 +00:00
Caleb Zulawski
39c2524e1b
Detect MOVBE (#1356) 2023-01-05 17:54:07 +00:00
Caleb Zulawski
0b2b195544
Rename misleading features (#1355) 2022-11-21 20:56:45 +00:00
Yuri Astrakhan
81c221f058
Edition 2021, apply clippy::uninlined_format_args fix (#1339) 2022-10-25 20:17:23 +01:00
Adam Gemmell
3362d525c5
Split aarch64 pauth feature into paca and pacg (#1259) 2022-02-10 14:59:40 +00:00
Adam Gemmell
1069e66439
Update aarch64 linux feature detection (#1146) 2021-05-28 01:37:20 +01:00
minybot
981e250f89
Avx512vbmi (#977) 2021-01-04 00:35:51 +00:00
Joshua Nelson
33355e69c2
Fix some clippy lints (#937) 2020-11-02 00:53:39 +00:00
Mahmut Bulut
17e4b29dfd Implementation for Aarch64 TME intrinsics 2020-05-29 19:05:48 +01:00
Makoto Kato
09ef01ade1
Add crypto target feature detection to arm32 (#833) 2020-03-29 12:28:17 +01:00
Luca Barbato
1601ce4f2f Add Icelake avx512 features (#838)
* Add Icelake avx512 features

As documented in https://software.intel.com/sites/default/files/managed/c5/15//architecture-instruction-set-extensions-programming-reference.pdf

* Sort the avx512 feature checks by bit

* Unbreak macos

Force nightly.
2020-01-26 13:10:29 -06:00
Makoto Kato
cca9a86637 Add CRC32 detection to arm32
armv8 has 32-bit mode, but it can use crc32 instruction sets even if 32-bit.
2019-12-02 19:23:05 +01:00
Luca Barbato
5bec3383c9 Drop the features test for now 2019-09-18 09:03:42 +02:00
Luca Barbato
a4dddb4b2f Unbreak non-x86 2019-09-18 09:03:42 +02:00
Luca Barbato
8cad95c8ab Move the tests away from the code 2019-09-17 19:22:18 +02:00
gnzlbg
1f44c1407d Add std_detect::detect::features() -> impl Iterator<Item=(&'static str, bool)> API 2019-09-16 23:43:01 +02:00
gnzlbg
686b813f5d Update repo name 2019-07-09 01:37:07 +02:00
gnzlbg
d31cc0b09e Add runtime feature detection for F16C 2019-05-09 13:42:20 +02:00
gnzlbg
459afa7a59 Fix clippy issues 2019-04-17 14:20:42 +02:00