4 ms·
I suspect that the overwhelming majority of cases that warrant inline assembly would not benefit if it was instead a function call out to something you've linke
by mattst88 11y ago
I suspect that the overwhelming majority of cases that warrant inline assembly would not benefit if it was instead a function call out to something you've linked in. That is, most inline assembly is a small snippet of optimized code that necessarily exists in the function you're optimizing.
- pjmlp 11y agoThat is why naked and inline exist for.
- daeken 11y agoInline from C libraries won't -- as far as I'm aware -- inline into a Rust function. Inline is a compile-time hint, not a link-time behavior. In theory this could be changed in LLVM, but it seems really unlikely to me. The function exposed from C (with the inline asm) can be naked, though, assuming you are hygienic.
- pjmlp 11y agoYeah, but that is a consequence of not having a Rust aware linker and relying on one that basically uses C semantics. Languages that use their own linkers tend to have better opportunities for code optimization during linking.
- steveklabnik 11y agoYeah, as always, when we're considering stabilizing or removing something, we talk to who is using the feature and in what way, and these kinds of issues surface.