Skip to content

Commit

Permalink
rustc: Rewrite platform intrinsics crate
Browse files Browse the repository at this point in the history
This commit rewrites (updates) the `rustc_platform_intrinsics` crate
in this repository. This crate was previously procedurally generated
from a number of JSON files and was intended to be the basis for how we
bind SIMD in Rust. This crate is quite old at this point and is actually
only used very little. The `stdsimd` crate and `std::arch` modules are
the "new" way for stabilizing SIMD intrinsics.

Despite this, however, the crate isn't useless! Most LLVM intrinsics are
called directly in the `stdsimd` crate using the `link_llvm_intrinsics`
feature, but not all intrinsics can be expressed directly in Rust.
Instead some intrinsics, notably those that return LLVM aggregates, need
to be compiler-defined to ensure they're declared with the correct
signature.

A good example of this is the x86 rdrand/rdseed family of LLVM
intrinsics, all of which return an aggregate of some form. The stdsimd
functions which provide these x86 intrinsics link to functions defined
by this crate, so we need to keep those!

Adding all that together, this commit performs the following tasks:

* Deletes the now-outdated `src/etc/platform-intrinsics` infrastructure
* Deletes all `src/librustc_platform_intrinsics/*` intrinsics that are
  otherwise compatible to be defined in Rust itself. This includes
  everything that doesn't deal with aggregates basically. Empty
  architecture files are removed.
* The style of `src/librustc_platform_intrinsics/` was updated slightly
  to make it a bit easier to handwrite. The `x86` rdrand/rdseed
  intrinsics and some `aarch64` intrinsics which return aggregates have
  all survived to continue to be defined by this crate.

Closes #41885
  • Loading branch information
alexcrichton committed Dec 21, 2018
1 parent 9622f9d commit b890d51
Show file tree
Hide file tree
Showing 30 changed files with 274 additions and 14,743 deletions.
592 changes: 0 additions & 592 deletions src/etc/platform-intrinsics/aarch64.json

This file was deleted.

396 changes: 0 additions & 396 deletions src/etc/platform-intrinsics/arm.json

This file was deleted.

Loading

0 comments on commit b890d51

Please sign in to comment.