Skip to content
Snippets Groups Projects
Commit 915ac0c5 authored by Martin Larralde's avatar Martin Larralde
Browse files

Implement detection of SSE flush modes in `setup.py`

parent 04a516b1
No related branches found
No related tags found
No related merge requests found
Pipeline #61933 passed
......@@ -459,7 +459,7 @@ class configure(_build_clib):
except CompileError:
_eprint("no")
return False
except (subprocess.SubprocessError, OSError):
except Exception:
_eprint("yes, but cannot run code")
return True # assume we are cross-compiling, and still build
else:
......@@ -519,6 +519,30 @@ class configure(_build_clib):
"""
)
def _check_denormals_zero_mode(self):
return self._check_simd_generic(
"denormals-are-zero",
program="""
#include <pmmintrin.h>
int main(int argc, const char** argv) {
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
return 0;
}
"""
)
def _check_flush_zero_mode(self):
return self._check_simd_generic(
"flush-to-zero",
program="""
#include <xmmintrin.h>
int main(int argc, const char** argv) {
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
return 0;
}
"""
)
# --- Required interface for `setuptools.Command` ---
def build_libraries(self, libraries):
......@@ -598,6 +622,13 @@ class configure(_build_clib):
if not supported_feature:
raise RuntimeError("failed to compile platform-specific code, aborting.")
# check zeroing mode for SSE code
if self.hmmer_impl == "SSE":
if self._check_denormals_zero_mode():
defines["HAVE_DENORMALS_ZERO_MODE"] = 1
if self._check_flush_zero_mode():
defines["HAVE_FLUSH_ZERO_MODE"] = 1
# fill the defines if headers are found
headers = headers or []
for header in headers:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment