aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-08-31 17:37:09 -0400
committerJack O'Connor <[email protected]>2020-08-31 18:25:38 -0400
commit3c1db555293a85aa3c131b59904dcbe2dd8161ac (patch)
treea98201704731324d3c70e8b755fcfee1b3f75202
parenta79fec7e392b93b1571bf835570249848be66a16 (diff)
add the dynamic check for SSE2 support
It will be very rare that this actually executes, but we should include it for completeness.
-rw-r--r--src/platform.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/platform.rs b/src/platform.rs
index ee9c349..4bd67de 100644
--- a/src/platform.rs
+++ b/src/platform.rs
@@ -337,7 +337,7 @@ pub fn avx512_detected() -> bool {
{
return true;
}
- // Dyanmic check, if std is enabled.
+ // Dynamic check, if std is enabled.
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("avx512f") && is_x86_feature_detected!("avx512vl") {
@@ -359,7 +359,7 @@ pub fn avx2_detected() -> bool {
{
return true;
}
- // Dyanmic check, if std is enabled.
+ // Dynamic check, if std is enabled.
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("avx2") {
@@ -381,7 +381,7 @@ pub fn sse41_detected() -> bool {
{
return true;
}
- // Dyanmic check, if std is enabled.
+ // Dynamic check, if std is enabled.
#[cfg(feature = "std")]
{
if is_x86_feature_detected!("sse4.1") {
@@ -393,6 +393,7 @@ pub fn sse41_detected() -> bool {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[inline(always)]
+#[allow(unreachable_code)]
pub fn sse2_detected() -> bool {
// A testing-only short-circuit.
if cfg!(feature = "no_sse2") {
@@ -403,7 +404,13 @@ pub fn sse2_detected() -> bool {
{
return true;
}
- #[allow(unreachable_code)]
+ // Dynamic check, if std is enabled.
+ #[cfg(feature = "std")]
+ {
+ if is_x86_feature_detected!("sse2") {
+ return true;
+ }
+ }
false
}