about summary refs log tree commit diff
path: root/library/stdarch/crates/std_detect/src
AgeCommit message (Collapse)AuthorLines
2021-11-19Work-around buggy Intel chips erroneously reporting BMI1/BMI2 support (#1249)Thom Chiovoloni-0/+20
2021-11-10Add remaining insturctions (#1250)Sparrow Li-0/+2
* add vmmla vusmmla vsm4e vsm3 vrax1 vxar vsha512 vbcax veor3 neon instructions * update runtime feature detect * correct tests * add `vrnd32x` `vrnd64x` * add MISSING.md
2021-10-16Fix error message of is_*_feature_detected on nort_feature (#1232)Taiki Endo-1/+1
2021-09-20Make dedup guard optional (#1215)Hans Kratz-3/+3
2021-08-22Fix typos “an”→“a”Frank Steffahn-1/+1
2021-05-28Update aarch64 linux feature detection (#1146)Adam Gemmell-62/+331
2021-04-24Move cfg!(target_feature) directly into is_*_feature_detected!() (#1141)Amanieu d'Antras-3/+3
Fixes #1135
2021-04-23remove unused const_fn feature (#1140)Ralf Jung-1/+1
2021-04-07Deny 2018 idiom lints (#1108)Joshua Nelson-2/+4
This lint is allow by default, which is why this wasn't spotted earlier. It's denied by rust-lang/rust, so it's good to warn about it here so it can be fixed more quickly.
2021-03-18Fix building std_detect as a dependency of std (#1089)Amanieu d'Antras-2/+3
2021-03-17Convert all uses of llvm_asm! to asm! (#1052)Amanieu d'Antras-4/+16
2021-03-13Remove trailing semicolon from macro expression (#1080)Aaron Hill-1/+1
Unblocks https://github.com/rust-lang/rust/pull/83089
2021-02-14Turn std_detect into a no_std crate (#1005)Amanieu d'Antras-95/+165
2021-01-18Fix false rustdoc broken_intra_link detection (#984)Carlos Pérez-1/+1
I saw in https://github.com/rust-lang/rust/issues/81037 that when you document private items with rustdoc the `x86 AVX-512 BITALG` feature comment does not contain scape characters in the message and therefore rustdoc was emiting warnings. This fixes it.
2020-09-17Optimize std_detect's caching (#908)Thom Chiovoloni-34/+47
2020-07-18Update and revamp wasm32 SIMD intrinsics (#874)Alex Crichton-0/+3
Lots of time and lots of things have happened since the simd128 support was first added to this crate. Things are starting to settle down now so this commit syncs the Rust intrinsic definitions with the current specification (https://github.com/WebAssembly/simd). Unfortuantely not everything can be enabled just yet but everything is in the pipeline for getting enabled soon. This commit also applies a major revamp to how intrinsics are tested. The intention is that the setup should be much more lightweight and/or easy to work with after this commit. At a high-level, the changes here are: * Testing with node.js and `#[wasm_bindgen]` has been removed. Instead intrinsics are tested with Wasmtime which has a nearly complete implementation of the SIMD spec (and soon fully complete!) * Testing is switched to `wasm32-wasi` to make idiomatic Rust bits a bit easier to work with (e.g. `panic!)` * Testing of this crate's simd128 feature for wasm is re-enabled. This will run on CI and both compile and execute intrinsics. This should bring wasm intrinsics to the same level of parity as x86 intrinsics, for example. * New wasm intrinsics have been added: * `iNNxMM_loadAxA_{s,u}` * `vNNxMM_load_splat` * `v8x16_swizzle` * `v128_andnot` * `iNNxMM_abs` * `iNNxMM_narrow_*_{u,s}` * `iNNxMM_bitmask` - commented out until LLVM is updated to LLVM 11 * `iNNxMM_widen_*_{u,s}` - commented out until bytecodealliance/wasmtime#1994 lands * `iNNxMM_{max,min}_{u,s}` * `iNNxMM_avgr_u` * Some wasm intrinsics have been removed: * `i64x2_trunc_*` * `f64x2_convert_*` * `i8x16_mul` * The `v8x16.shuffle` instruction is exposed. This is done through a `macro` (not `macro_rules!`, but `macro`). This is intended to be somewhat experimental and unstable until we decide otherwise. This instruction has 16 immediate-mode expressions and is as a result unsuited to the existing `constify_*` logic of this crate. I'm hoping that we can game out over time what a macro might look like and/or look for better solutions. For now, though, what's implemented is the first of its kind in this crate (an architecture-specific macro), so some extra scrutiny looking at it would be appreciated. * Lots of `assert_instr` annotations have been fixed for wasm. * All wasm simd128 tests are uncommented and passing now. This is still missing tests for new intrinsics and it's also missing tests for various corner cases. I hope to get to those later as the upstream spec itself gets closer to stabilization. In the meantime, however, I went ahead and updated the `hex.rs` example with a wasm implementation using intrinsics. With it I got some very impressive speedups using Wasmtime: test benches::large_default ... bench: 213,961 ns/iter (+/- 5,108) = 4900 MB/s test benches::large_fallback ... bench: 3,108,434 ns/iter (+/- 75,730) = 337 MB/s test benches::small_default ... bench: 52 ns/iter (+/- 0) = 2250 MB/s test benches::small_fallback ... bench: 358 ns/iter (+/- 0) = 326 MB/s or otherwise using Wasmtime hex encoding using SIMD is 15x faster on 1MB chunks or 7x faster on small <128byte chunks. All of these intrinsics are still unstable and will continue to be so presumably until the simd proposal in wasm itself progresses to a later stage. Additionaly we'll still want to sync with clang on intrinsic names (or decide not to) at some point in the future. * wasm: Unconditionally expose SIMD functions This commit unconditionally exposes SIMD functions from the `wasm32` module. This is done in such a way that the standard library does not need to be recompiled to access SIMD intrinsics and use them. This, hopefully, is the long-term story for SIMD in WebAssembly in Rust. It's unlikely that all WebAssembly runtimes will end up implementing SIMD so the standard library is unlikely to use SIMD any time soon, but we want to make sure it's easily available to folks! This commit enables all this by ensuring that SIMD is available to the standard library, regardless of compilation flags. This'll come with the same caveats as x86 support, where it doesn't make sense to call these functions unless you're enabling simd support one way or another locally. Additionally, as with x86, if you don't call these functions then the instructions won't show up in your binary. While I was here I went ahead and expanded the WebAssembly-specific documentation for the wasm32 module as well, ensuring that the current state of SIMD/Atomics are documented.
2020-05-29feature detectionMahmut Bulut-0/+4
2020-04-24Unbreak non-x86 build on FreeBSDTobias Kortkamp-1/+1
error[E0432]: unresolved import `self::arm::check_for` --> src/libstd/../stdarch/crates/std_detect/src/detect/os/freebsd/mod.rs:11:17 | 11 | pub use self::arm::check_for; | ^^^^^^^^^^^^^^^^^^^^ no `check_for` in `std_detect::detect::os::arm` error[E0425]: cannot find value `detect_features` in module `self::os` --> src/libstd/../stdarch/crates/std_detect/src/detect/mod.rs:121:37 | 121 | cache::test(x as u32, self::os::detect_features) | ^^^^^^^^^^^^^^^ not found in `self::os` | help: possible candidate is found in another module, you can import it into scope | 20 | use crate::std_detect::detect::os::arm::detect_features;
2020-04-24Stabilize all remaining x86 features for feature detectionAmanieu d'Antras-19/+27
2020-04-09Use llvm_asm! instead of asm! (#846)Amanieu d'Antras-4/+4
2020-04-04Replace all max/min_value() with MAX/MINLinus Färnstrand-2/+2
2020-03-29Replace module MIN/MAX and min/max_value() with assoc consts (#843)Linus Färnstrand-1/+1
2020-03-29Add crypto target feature detection to arm32 (#833)Makoto Kato-0/+18
2020-03-19re-stabilize the AVX-512 features that were stabilized in Rust 1.27.0 (#842)Jack O'Connor-10/+14
* re-stabilize the AVX-512 features that were stabilized in Rust 1.27.0 https://github.com/rust-lang/stdarch/pull/739 added per-feature stabilization of runtime CPU feature detection. In so doing, it de-stabilized some detection features that had been stable since Rust 1.27.0, breaking some published crates (on nightly). This commit re-stabilizes the subset of AVX-512 detection features that were included in 1.27.0 (that is, the pre-Ice-Lake subset). Other instruction sets (MMX in particular) remain de-stabilized, pending a decision about whether should ever stabilize them. See https://github.com/rust-lang/rust/issues/68905. * add a comment explaining feature detection stability * adjust stabilizations to match most recent proposal https://github.com/rust-lang/rust/issues/68905#issuecomment-595376319
2020-01-28Fix race condition in feature cache on 32 platforms (#837)Aleksey Kladov-63/+36
* Fix race condition in feature cache on 32 platforms If we observe that the second word is initialized, we can't really assume that the first is initialized as well. So check each word separately. * Use stronger atomic ordering Better SeqCst than sorry! * Use two caches on x64 for simplicity
2020-01-26Add Icelake avx512 features (#838)Luca Barbato-0/+24
* 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.
2019-12-27Use issue = "none" instead of "0"Yuki Okushi-1/+1
2019-12-11Run-time feature detection for Aarch64 on Windows.Makoto Kato-0/+58
2019-12-02Add CRC32 detection to arm32Makoto Kato-1/+5
armv8 has 32-bit mode, but it can use crc32 instruction sets even if 32-bit.
2019-10-10Remove need for `#[macro_use]` with `cfg-if`Alex Crichton-18/+12
Modernizes usage of `cfg_if!` slightly
2019-09-18Feature::from_str is not always neededgnzlbg-0/+1
2019-09-18These items do not need to be publicgnzlbg-8/+15
2019-09-17Implement a fallback for the No-op FeatureLuca Barbato-0/+7
2019-09-17Move the tests away from the codeLuca Barbato-143/+0
2019-09-17Add a test for the env_overrideLuca Barbato-0/+26
2019-09-17Make the test function smallerLuca Barbato-7/+6
2019-09-17Simplify the std importsLuca Barbato-12/+1
2019-09-17Remove the FIXME about the cache size checksLuca Barbato-6/+2
And leave a NOTE.
2019-09-17Override the features detected using an env::varLuca Barbato-2/+42
Fixes: #804
2019-09-17Add a mean to unset a bit in the cacheLuca Barbato-0/+19
2019-09-17Try harder to error on usage of unstable featuresgnzlbg-1/+1
2019-09-17Remove staged_api from the allowed_internal_unstabled of the feature macrosgnzlbg-1/+1
2019-09-16Fix std_detect on targets without feature detectiongnzlbg-0/+4
2019-09-16Formatgnzlbg-75/+86
2019-09-16Enforce staged_api on a per-feature basisgnzlbg-67/+87
2019-09-16Add std_detect::detect::features() -> impl Iterator<Item=(&'static str, ↵gnzlbg-546/+295
bool)> API
2019-09-09Factor out check_forLuca Barbato-63/+17
All the os-specific code implements a `check_for` and a `detect_features`. Move the always identical check_for in the mod.rs and use `os::detect_features` there.
2019-09-06Document how miri support worksLuca Barbato-0/+5
Co-Authored-By: gnzlbg <gnzlbg@users.noreply.github.com>
2019-09-06Minimal miri supportLuca Barbato-1/+4
Should address https://github.com/rust-lang/miri/issues/932
2019-07-09Update repo namegnzlbg-1/+0