From 145fdb421c18f2f341f42dc499b87cd2d2490839 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Sat, 28 Oct 2023 02:34:08 +0100 Subject: [PATCH] Fix tests --- crates/intrinsic-test/src/main.rs | 8 +++++ crates/std_detect/tests/cpu-detection.rs | 29 ++++++++++--------- .../std_detect/tests/macro_trailing_commas.rs | 4 ++- crates/stdarch-verify/tests/arm.rs | 3 +- examples/connect5.rs | 4 ++- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/crates/intrinsic-test/src/main.rs b/crates/intrinsic-test/src/main.rs index 162d3a72bd..3c181584be 100644 --- a/crates/intrinsic-test/src/main.rs +++ b/crates/intrinsic-test/src/main.rs @@ -166,6 +166,14 @@ fn generate_rust_program(notices: &str, intrinsic: &Intrinsic, a32: bool) -> Str format!( r#"{notices}#![feature(simd_ffi)] #![feature(link_llvm_intrinsics)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_neon_intrinsics))] +#![feature(stdarch_arm_crc32)] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_fcma))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_dotprod))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_i8mm))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_sha3))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_sm4))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_ftts))] #![allow(overflowing_literals)] #![allow(non_upper_case_globals)] use core_arch::arch::{target_arch}::*; diff --git a/crates/std_detect/tests/cpu-detection.rs b/crates/std_detect/tests/cpu-detection.rs index f20ea6a2f7..8d551fc2cb 100644 --- a/crates/std_detect/tests/cpu-detection.rs +++ b/crates/std_detect/tests/cpu-detection.rs @@ -1,19 +1,20 @@ -#![feature( - stdarch_internal, - stdarch_arm_feature_detection, - stdarch_powerpc_feature_detection -)] +#![feature(stdarch_internal)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))] +#![cfg_attr(target_arch = "powerpc", feature(stdarch_powerpc_feature_detection))] +#![cfg_attr(target_arch = "powerpc64", feature(stdarch_powerpc_feature_detection))] #![allow(clippy::unwrap_used, clippy::use_debug, clippy::print_stdout)] -#![cfg(any( - target_arch = "arm", - target_arch = "aarch64", - target_arch = "x86", - target_arch = "x86_64", - target_arch = "powerpc", - target_arch = "powerpc64" -))] -#[macro_use] +#[cfg_attr( + any( + target_arch = "arm", + target_arch = "aarch64", + target_arch = "x86", + target_arch = "x86_64", + target_arch = "powerpc", + target_arch = "powerpc64" + ), + macro_use +)] extern crate std_detect; #[test] diff --git a/crates/std_detect/tests/macro_trailing_commas.rs b/crates/std_detect/tests/macro_trailing_commas.rs index 3d5c736a05..8304b225f5 100644 --- a/crates/std_detect/tests/macro_trailing_commas.rs +++ b/crates/std_detect/tests/macro_trailing_commas.rs @@ -1,4 +1,6 @@ -#![feature(stdarch_arm_feature_detection, stdarch_powerpc_feature_detection)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))] +#![cfg_attr(target_arch = "powerpc", feature(stdarch_powerpc_feature_detection))] +#![cfg_attr(target_arch = "powerpc64", feature(stdarch_powerpc_feature_detection))] #![allow(clippy::unwrap_used, clippy::use_debug, clippy::print_stdout)] #[cfg(any( diff --git a/crates/stdarch-verify/tests/arm.rs b/crates/stdarch-verify/tests/arm.rs index 84131c0fbe..d6f8e69acb 100644 --- a/crates/stdarch-verify/tests/arm.rs +++ b/crates/stdarch-verify/tests/arm.rs @@ -1,8 +1,9 @@ +#![allow(unused)] + use std::collections::HashMap; use serde::Deserialize; -#[allow(unused)] struct Function { name: &'static str, arguments: &'static [&'static Type], diff --git a/examples/connect5.rs b/examples/connect5.rs index 6298255421..ffbff5e486 100644 --- a/examples/connect5.rs +++ b/examples/connect5.rs @@ -28,7 +28,9 @@ //! You should see a game self-playing. In the end of the game, it shows the average time for //! each move. -#![feature(avx512_target_feature, stdarch_x86_avx512)] +#![feature(avx512_target_feature)] +#![cfg_attr(target_arch = "x86", feature(stdarch_x86_avx512))] +#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512))] #![feature(stmt_expr_attributes)] use rand::seq::SliceRandom;