2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
2016-04-19 11:37:39 -05:00
|
|
|
|
2018-12-09 04:20:20 -06:00
|
|
|
#![allow(stable_features)]
|
2016-04-19 11:37:39 -05:00
|
|
|
#![feature(cfg_target_feature)]
|
|
|
|
|
2017-01-13 18:22:47 -06:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2017-01-19 19:18:12 -06: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-13 18:22:47 -06:00
|
|
|
}
|
2016-04-19 11:37:39 -05:00
|
|
|
if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
|
|
|
|
assert!(cfg!(target_feature = "sse2"),
|
2017-01-13 18:22:47 -06:00
|
|
|
"SSE2 was not detected as available on an x86 platform");
|
2016-04-19 11:37:39 -05:00
|
|
|
}
|
2020-07-07 10:12:44 -05:00
|
|
|
// check a negative case too -- allowed on x86, but not enabled by default
|
2018-03-27 14:27:45 -05:00
|
|
|
assert!(cfg!(not(target_feature = "avx2")),
|
|
|
|
"AVX2 shouldn't be detected as available by default on any platform");
|
2016-04-19 11:37:39 -05:00
|
|
|
}
|