-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Support .insn
directive in asm!
#90558
Comments
This will likely work automatically once LLVM supports it. A commit has recently landed (https://reviews.llvm.org/D108602?id=369214) but is not yet in any released version. |
@rustbot label +A-inline-assembly +F-asm |
I tried building rust+cargo from source with llvm/llvm-project@2838797 cherry-picked. Sadly it did not make the error message go away. |
Okay, it actually does work. What is the procedure around Rust's LLVM dependency? How often is it bumped? Is this a candidate for cherry-picking onto rust-llvm? |
LLVM procedure is at https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html. I think this is a candidate for cherry-picking but someone needs to do the work. |
Tracking issue: #72016.
The
.insn
assembler directive allows to treat data as instructions. This allows to generate CPU instructions that are otherwise not possible using assembler commands. It is platform specific and mostly relevant for RISC-V platforms, but I could also find uses for it on MIPS targets as well.More generally speaking, any solution that allows me to produce custom machine code instructions without a performance overhead will be okay for me. The current best workaround is to write the assembler code externally and then link to it. However, this adds the overhead of a function call that cannot be inlined due to the FFI boundary, so this is not acceptable in the long term.
See also https://users.rust-lang.org/t/custom-cpu-instructions-with-asm/66637 for some more discussion of my problem.
The text was updated successfully, but these errors were encountered: