-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove inline assembly from hint::spin_loop #59239
Conversation
r? @shepmaster (rust_highfive has picked a reviewer for you, use r? to override) |
292ffad
to
e07d163
Compare
The claim that
|
Indeed. I suppose that this means that an assembler, like the LLVM assembler, cannot deduce from seeing When trying to compile libcore with non-LLVM backends (like Cranelift), inline assembly is problematic (e.g. Cranelift does not support LLVM inline assembly). The @Fanael is there an advantage of emitting |
It really is not. The intrinsic is defined in Intel manuals in terms of the instruction itself (the intrinsics in LLVM and everywhere else just follow Intel definitions), and LLVM itself doesn't require SSE2 for
Not that I know, there is no advantage on any of Intel's old microarchitectures, they just interpret it as a nop and have no special way of handling spin loops. It might be different on AMD's K7 or VIA Nehemiah, but I don't have that hardware to test, and I doubt it makes any difference anyway. |
It is in Rust, due to what appears to be a bug in the Intel C Intrinsics spec that we use for our definitions. I've opened rust-lang/stdarch#705 to track this.
Then I think I would prefer to not emit anything on those, at least until the bug in |
The implementation LGTM. @bors r+ |
📌 Commit e07d163 has been approved by |
Remove inline assembly from hint::spin_loop This PR removes the inline assembly which was not required since these instructions are available in core::arch, and extends support of the spin_loop hint to arm targets with the v6 feature which also support the yield instruction.
Failed in #59300 (comment), @bors r- |
Submodules messed up? |
The pause instruction requires SSE2 but was being unconditionally used on targets without it, resulting in undefined behavior. This PR fixes that by only using the pause intrinsic if SSE2 is available. It also removes the inline assembly which was not required since these instructions are available in core::arch, and extends support of the spin_loop hint to arm targets with the v6 feature which also support the yield instruction. Closes rust-lang#59237 .
Indeed, thanks! |
@bors: r=nagisa |
📌 Commit 830c98d has been approved by |
Remove inline assembly from hint::spin_loop This PR removes the inline assembly which was not required since these instructions are available in core::arch, and extends support of the spin_loop hint to arm targets with the v6 feature which also support the yield instruction.
Remove inline assembly from hint::spin_loop This PR removes the inline assembly which was not required since these instructions are available in core::arch, and extends support of the spin_loop hint to arm targets with the v6 feature which also support the yield instruction.
Remove inline assembly from hint::spin_loop This PR removes the inline assembly which was not required since these instructions are available in core::arch, and extends support of the spin_loop hint to arm targets with the v6 feature which also support the yield instruction.
Rollup of 7 pull requests Successful merges: - #59213 (Track changes to robots.txt) - #59239 (Remove inline assembly from hint::spin_loop) - #59251 (Use a valid name for graphviz graphs) - #59296 (Do not encode gensymed imports in metadata) - #59328 (Implement specialized nth_back() for Box and Windows.) - #59355 (Fix ICE with const generic param in struct) - #59377 (Correct minimum system LLVM version in tests)
This PR removes the inline assembly which was not required since these
instructions are available in core::arch, and extends support of
the spin_loop hint to arm targets with the v6 feature which also
support the yield instruction.