]> git.lizzy.rs Git - rust.git/commit
Fix undefined behavior in hint::spin_loop for x86 targets without SSE2
authorgnzlbg <gonzalobg88@gmail.com>
Sat, 16 Mar 2019 17:07:58 +0000 (18:07 +0100)
committergnzlbg <gonzalobg88@gmail.com>
Thu, 21 Mar 2019 13:23:29 +0000 (14:23 +0100)
commit830c98d7fa4da9381d3ee9c8b918bc5dff11c378
treeeaa621dc760f9c9b704330912775c4b22835a960
parent52e885628e4317aa3f158622435927eb29b812e9
Fix undefined behavior in hint::spin_loop for x86 targets without SSE2

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 #59237 .
src/libcore/hint.rs