Implement vendor intrinsics by pre-compiling using LLVM #1547
Labels
A-core-arch
Area: Necessary for full core::arch support
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
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)
The text was updated successfully, but these errors were encountered: