aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorJack O'Connor <[email protected]>2020-02-14 11:59:59 -0500
committerJack O'Connor <[email protected]>2020-02-14 11:59:59 -0500
commitfdd329ba57896faac4ae797775c175ad880cbe42 (patch)
treed6e2c2b80f523cbb2cf361f47f0ffd728926a863 /build.rs
parent865d2017222a657eeb60fd4888f43d221dd6222b (diff)
check for AVX-512 compiler support even when using assembly
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/build.rs b/build.rs
index 7112f94..8d74f04 100644
--- a/build.rs
+++ b/build.rs
@@ -66,7 +66,8 @@ re-enable with "--features=rayon".) Other crates might or might not support
this workaround.
"#;
-fn check_for_avx512_compiler_support(build: &cc::Build) {
+fn check_for_avx512_compiler_support() {
+ let build = new_build();
if is_windows_msvc() {
if !build.is_flag_supported("/arch:AVX512").unwrap() {
eprintln!("{}", WINDOWS_MSVC_ERROR.trim());
@@ -82,6 +83,7 @@ fn check_for_avx512_compiler_support(build: &cc::Build) {
fn main() -> Result<(), Box<dyn std::error::Error>> {
if defined("CARGO_FEATURE_C") {
+ check_for_avx512_compiler_support();
if is_x86_64() && !defined("CARGO_FEATURE_C_PREFER_INTRINSICS") {
// On 64-bit, use the assembly implementations, unless the
// "c_prefer_intrinsics" feature is enabled.
@@ -136,7 +138,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
avx2_build.compile("blake3_avx2");
let mut avx512_build = new_build();
- check_for_avx512_compiler_support(&avx512_build);
avx512_build.file("c/blake3_avx512.c");
if is_windows_msvc() {
// Note that a lot of versions of MSVC don't support /arch:AVX512,