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.
* 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
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.
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
```
Apply snap of bootstrap compiler in rust-lang/rust
FWIW, in the future we should try to avoid this as I'm assuming we'll break CI trying to land this here (and we can't swap bootstrap compilers in Rust until this lands).
Verify that all intrinsics have a run-time test
Add a check to stdsimd-verify to check that all intrinsics have a run-time test. This is not the case right now, but we should at least not add intrinsics without tests.