2019-07-26 21:54:25 +00:00
|
|
|
// run-pass
|
2016-04-19 16:37:39 +00:00
|
|
|
|
2018-12-09 10:20:20 +00:00
|
|
|
#![allow(stable_features)]
|
2016-04-19 16:37:39 +00:00
|
|
|
#![feature(cfg_target_feature)]
|
|
|
|
|
2017-01-14 00:22:47 +00:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2017-01-20 01:18:12 +00:00
|
|
|
match env::var("TARGET") {
|
|
|
|
Ok(s) => {
|
|
|
|
// Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
|
|
|
|
if s.contains("i586") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(_) => return,
|
2017-01-14 00:22:47 +00:00
|
|
|
}
|
2016-04-19 16:37:39 +00:00
|
|
|
if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
|
|
|
|
assert!(cfg!(target_feature = "sse2"),
|
2017-01-14 00:22:47 +00:00
|
|
|
"SSE2 was not detected as available on an x86 platform");
|
2016-04-19 16:37:39 +00:00
|
|
|
}
|
2020-07-07 15:12:44 +00:00
|
|
|
// check a negative case too -- allowed on x86, but not enabled by default
|
2018-03-27 19:27:45 +00:00
|
|
|
assert!(cfg!(not(target_feature = "avx2")),
|
|
|
|
"AVX2 shouldn't be detected as available by default on any platform");
|
2016-04-19 16:37:39 +00:00
|
|
|
}
|