Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement vendor intrinsics by pre-compiling using LLVM #1547

Open
bjorn3 opened this issue Dec 11, 2024 · 0 comments
Open

Implement vendor intrinsics by pre-compiling using LLVM #1547

bjorn3 opened this issue Dec 11, 2024 · 0 comments
Assignees
Labels
A-core-arch Area: Necessary for full core::arch support C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Dec 11, 2024

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)

@bjorn3 bjorn3 added A-core-arch Area: Necessary for full core::arch support C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 11, 2024
@bjorn3 bjorn3 self-assigned this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core-arch Area: Necessary for full core::arch support C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

1 participant