Put is_x86_feature_detected behind a target_arch check
This change adds a target arch check so that cargo build can be run from an Apple M1 mac.
This commit is contained in:
parent
8a9b7f5ef2
commit
7ee5b02bc5
|
@ -1,6 +1,9 @@
|
|||
#![allow(clippy::integer_arithmetic)]
|
||||
use clap::{crate_description, crate_name, value_t, App, Arg};
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
use solana_ledger::entry::{self, create_ticks, init_poh, EntrySlice, VerifyRecyclers};
|
||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
||||
use solana_ledger::entry::{create_ticks, init_poh, EntrySlice, VerifyRecyclers};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_perf::perf_libs;
|
||||
use solana_sdk::hash::hash;
|
||||
|
@ -84,6 +87,11 @@ fn main() {
|
|||
time.as_us() / iterations as u64
|
||||
);
|
||||
|
||||
// A target_arch check is required here since calling
|
||||
// is_x86_feature_detected from a non-x86_64 arch results in a build
|
||||
// error.
|
||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||
{
|
||||
if is_x86_feature_detected!("avx2") && entry::api().is_some() {
|
||||
let mut time = Measure::start("time");
|
||||
for _ in 0..iterations {
|
||||
|
@ -113,6 +121,7 @@ fn main() {
|
|||
time.as_us() / iterations as u64
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if perf_libs::api().is_some() {
|
||||
let mut time = Measure::start("time");
|
||||
|
|
Loading…
Reference in New Issue