380 Commits

Author SHA1 Message Date
Daniel Smith
e0ffa88fe7 Add one AVX512f comparison and the intrinsics needed to test it 2020-05-29 00:07:03 +01:00
Daniel Smith
7a29fcc1c8 Convert __mmask16 to use an unsigned type 2020-05-28 22:24:46 +01:00
Amanieu d'Antras
079ce26eb7 Fix CI issues caused by updated nightly
Rust bug: https://github.com/rust-lang/rust/issues/72545
2020-05-28 17:20:07 +01:00
Marko Mijalkovic
15154a882d Use fp64 detection instead of OS blacklist 2020-05-07 20:48:47 +01:00
Marko Mijalkovic
66ef866b34 Fix code style 2020-05-07 20:48:47 +01:00
Marko Mijalkovic
aaee0709b3 Fix building libcore for the Sony PSP
Building the MIPS MSA module for non-fp64 targets fails with an LLVM
error. This commit blacklists PSP targets from MSA support in order to
fix building libcore.
2020-05-07 20:48:47 +01:00
Daniel Verkamp
d9a67ea922
Manually preserve rbx across cpuid instruction (#851)
* Manually preserve rbx across cpuid instruction

This fixes an issue observed when using __cpuid and __cpuid_count with
Address Sanitizer enabled: the generated code uses the rbx register to
access ASAN tracking information without reloading it after cpuid,
resulting in a segfault since the rbx register is overwritten by cpuid
(https://crbug.com/1072045).

This seems like a compiler backend bug, and indeed there is a
long-standing LLVM bug report about a very similar issue:
https://bugs.llvm.org/show_bug.cgi?id=17907

To work around this issue, we can manually preserve the rbx register
contents in the inline assembly.  This is the approach taken by LLVM's
own host cpuid detection code (lib/Host/Support.cpp).  The original rbx
value is stashed in rsi, which is then swapped with rbx to restore the
original value as well as keep the output ebx value from the CPUID
instruction to be used as an output of the inline assembly.

The rbx clobber is also removed; this seems ineffective, and it
conflicts with the ebx output of the inline assembly (ebx is a
subregister of rbx): "Note that clobbering named registers that are also
present in output constraints is not legal."
(https://llvm.org/docs/LangRef.html#clobber-constraints)

* Add link to LLVM bug in cpuid workaround comment
2020-04-29 01:50:13 +01:00
Tobias Kortkamp
a69b5ec7ae Unbreak non-x86 build on FreeBSD
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-24 12:45:05 +01:00
Amanieu d'Antras
1f32017c84 Rustfmt 2020-04-24 00:36:01 +01:00
Amanieu d'Antras
39fc893f6b Stabilize all remaining x86 features for feature detection 2020-04-24 00:36:01 +01:00
Amanieu d'Antras
04c1a9a9e9
Use llvm_asm! instead of asm! (#846) 2020-04-09 00:05:10 +01:00
Heinz N. Gies
70f3623b52
Implement additional ARM NEON intriniscs (#792) 2020-04-07 20:06:38 +01:00
Linus Färnstrand
d7a1dbd509 Replace all std::<primitive>::MIN/MAX with just <primitive>::MIN/MAX 2020-04-04 09:51:11 -07:00
Linus Färnstrand
f14b746319 Replace all max/min_value() with MAX/MIN 2020-04-04 09:51:11 -07:00
Linus Färnstrand
e0533a30d3 Stop importing int/float modules 2020-04-04 09:51:11 -07:00
Makoto Kato
d5d3117b9b
Support crc32 even if on arm32 (#834)
CRC32 is supported on A32 and T32.
2020-03-30 16:38:23 +01:00
Linus Färnstrand
b852344de5
Replace module MIN/MAX and min/max_value() with assoc consts (#843) 2020-03-29 17:08:21 +01:00
Amanieu d'Antras
c554b42b2a
Fix CI (#845)
* Use ubuntu 18.04 instead of 18.10 for MIPS CI

* Fix WASM CI
2020-03-29 15:15:59 +01:00
Makoto Kato
09ef01ade1
Add crypto target feature detection to arm32 (#833) 2020-03-29 12:28:17 +01:00
Jack O'Connor
e367bcd7f9
re-stabilize the AVX-512 features that were stabilized in Rust 1.27.0 (#842)
* 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-03-19 14:29:50 +00:00
Tyg13
9ab5dc0873
Remove unnecessary parens. (#839) 2020-01-30 13:15:36 +01:00
Aleksey Kladov
0bd16446db Fix race condition in feature cache on 32 platforms (#837)
* 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-28 21:53: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
Yuki Okushi
c8c587d0cd Use issue = "none" instead of "0" 2019-12-27 11:25:13 +01:00
Oliver Scherer
43d49b6247 Update simd_llvm.rs 2019-12-20 23:31:51 +01:00
Oliver Scherer
5548609204 Add const unstability attributes
These are needed for rustc to be able to correctly handle stability of constness of intrinsics. Without either `rustc_const_unstable` or `rustc_const_stable` an intrinsic is not const evaluable at all.
2019-12-20 23:31:51 +01:00
bjorn3
c8249c76c4 Revert mmx changes
On i586 the simd_* intrinsics don't compile to MMX instructions, even
with `#[target_feature(enable = "mmx")]`.
2019-12-18 17:41:21 +01:00
bjorn3
ea51d868ec Rustfmt 2019-12-18 17:41:21 +01:00
bjorn3
0aa5e29724 Revert _mm_{min,max}_ps changes and add explanation why 2019-12-18 17:41:21 +01:00
bjorn3
2112972a64 Use <i64>::swap_bytes instead of llvm.bswap.i64 2019-12-18 17:41:21 +01:00
bjorn3
61693f3b53 Remove some unused llvm intrinsic declarations 2019-12-18 17:41:21 +01:00
bjorn3
c7e16bcebe Use <i32>::swap_bytes instead of llvm.bswap.i32 2019-12-18 17:41:21 +01:00
bjorn3
35fc3c36e3 Use simd_* in x86/avx2.rs where possible 2019-12-18 17:41:21 +01:00
bjorn3
fb84f79ce7 Use simd_* in x86/avx.rs where possible 2019-12-18 17:41:21 +01:00
bjorn3
c5572ec1f6 Use simd_* in x86/sse41.rs where possible 2019-12-18 17:41:21 +01:00
bjorn3
4da22d5120 Use simd_saturating_* in x86/sse2.rs where possible 2019-12-18 17:41:21 +01:00
bjorn3
039944d366 Use simd_fmin and simd_fmax for _mm_min_ps and _mm_max_ps 2019-12-18 17:41:21 +01:00
bjorn3
4de364cfb4 Use simd_* in x86/mmx.rs where possible 2019-12-18 17:41:21 +01:00
bjorn3
1c38869538 Add missing simd platform intrinsics 2019-12-18 17:41:21 +01:00
bjorn3
a4cd918dff Use simd_fma where possible 2019-12-18 17:41:21 +01:00
bjorn3
8c643df017 Use simd_floor and simd_ceil where possible 2019-12-18 17:41:21 +01:00
bjorn3
1ac2f13d76 Use simd_fsqrt where possible 2019-12-18 17:41:21 +01:00
bjorn3
dd65ed38db Require prefix of instruction line to be the expected instruction
`rsqrtps %xmm0,%xmm1` used to match `sqrtps` without leading `r`.
2019-12-18 17:41:21 +01:00
Makoto Kato
f5783f5193 Run-time feature detection for Aarch64 on Windows. 2019-12-11 12:24:03 +01:00
Makoto Kato
51c3295de1 Fix unused import: mem::transmute
When building on aarch64, the following warning occurs.

```
warning: unused import: `mem::transmute`
 --> crates/core_arch/src/arm/neon.rs:3:38
  |
3 | use crate::{core_arch::simd_llvm::*, mem::transmute};
  |                                      ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
```
2019-12-06 12:17:56 +01: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
ecstatic-morse
7c56404f1a Add #[rustc_args_required_const] to simd_shuffle
Currently, these have to be special-cased in the promotion logic for rustc.
2019-10-30 10:29:15 +01:00
Taiki Endo
5c1430079b Format with rustfmt 2019-10-26 18:46:57 +02:00
Taiki Endo
8f07ba7489 Update proc-macro2, syn, and quote to 1.0 2019-10-26 18:46:57 +02:00
Mateusz Mikuła
ed27e2fccd Replace rustfmt::skip custom inner attribute with rustfmt.toml 2019-10-26 18:46:22 +02:00