rust-lang / rust-lang/rustc_codegen_cranelift

Implement vendor intrinsics by pre-compiling using LLVM

Open
#1,547 1 comment 7 reactions 1 assignee View on GitHub

@bjorn3 is already working on this.

Since Dec 11, 2024.

A-core-arch C-enhancement
Dominant language
Rust
Stars
2.1k
Forks
157
Avg merge
1d 19h
Merged PRs (30d)
3

Description

Basically we would scrape all vendor intrinsics defined in the LLVM source code at llvm/include/llvm/IR/Intrinsics.td, generate some Rust or C code which exercises the vendor intrinsic, compile it using LLVM and then extract the raw instruction bytes for each function and generate Rust code to include in cg_clif itself that reproduces those raw instruction bytes whenever it needs to codegen the respective vendor intrinsic.

The disadvantage of this would be that we did need to either check in generated source code (which distros may not like) or somehow integrate the generation process with building cg_clif itself (which would make building cg_clif more complicated and require the LLVM backend to be present too). The big advantage however is that is saves a ton of work manually implementing every single vendor intrinsic of which there are many thousands. It also likely has better performance than the manual emulation of them. And for the intrinsics we currently implement using inline asm it would be non-trivial compile time boost (as inline asm is implemented by invoking rustc a second time to use the LLVM backend)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.