Skip to content

Commit 6d92794

Browse files
committed
Optimize has_cpuid for x86 Rust targets that have cpuid
Improves #497.
1 parent 27b5661 commit 6d92794

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

coresimd/x86/cpuid.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ pub fn has_cpuid() -> bool {
8686
}
8787
#[cfg(target_arch = "x86")]
8888
{
89+
// Optimization for i586 and i686 Rust targets which SSE enabled
90+
// and support cpuid:
91+
#[cfg(target_feature = "sse")] {
92+
true
93+
}
94+
95+
// If SSE is not enabled, detect whether cpuid is available:
96+
#[cfg(not(target_feature = "sse"))]
8997
unsafe {
9098
// On `x86` the `cpuid` instruction is not always available.
9199
// This follows the approach indicated in:

0 commit comments

Comments
 (0)