parent
943187ad69
commit
523e2600ae
3 changed files with 20 additions and 10 deletions
|
|
@ -17,10 +17,14 @@ use crate::{
|
|||
///
|
||||
/// [Intel's documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_pause)
|
||||
#[inline]
|
||||
#[target_feature(enable = "sse2")]
|
||||
#[cfg_attr(test, assert_instr(pause))]
|
||||
#[cfg_attr(
|
||||
all(test, target_feature = "sse2"),
|
||||
assert_instr(pause)
|
||||
)]
|
||||
#[stable(feature = "simd_x86", since = "1.27.0")]
|
||||
pub unsafe fn _mm_pause() {
|
||||
// note: `pause` is guaranteed to be interpreted as a `nop` by CPUs without
|
||||
// the SSE2 target-feature - therefore it does not require any target features
|
||||
pause()
|
||||
}
|
||||
|
||||
|
|
@ -3191,9 +3195,9 @@ mod tests {
|
|||
use stdsimd_test::simd_test;
|
||||
use test::black_box; // Used to inhibit constant-folding.
|
||||
|
||||
#[simd_test(enable = "sse2")]
|
||||
unsafe fn test_mm_pause() {
|
||||
_mm_pause();
|
||||
#[test]
|
||||
fn test_mm_pause() {
|
||||
unsafe { _mm_pause() }
|
||||
}
|
||||
|
||||
#[simd_test(enable = "sse2")]
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub fn arm_functions(input: TokenStream) -> TokenStream {
|
|||
|
||||
fn functions(input: TokenStream, dirs: &[&str]) -> TokenStream {
|
||||
let dir = Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
let root = dir.parent().unwrap();
|
||||
let root = dir.parent().expect("root-dir not found");
|
||||
|
||||
let mut files = Vec::new();
|
||||
for dir in dirs {
|
||||
|
|
@ -199,11 +199,11 @@ fn extract_path_ident(path: &syn::Path) -> syn::Ident {
|
|||
if path.segments.len() != 1 {
|
||||
panic!("unsupported path that needs name resolution")
|
||||
}
|
||||
match path.segments.first().unwrap().value().arguments {
|
||||
match path.segments.first().expect("segment not found").value().arguments {
|
||||
syn::PathArguments::None => {}
|
||||
_ => panic!("unsupported path that has path arguments"),
|
||||
}
|
||||
path.segments.first().unwrap().value().ident.clone()
|
||||
path.segments.first().expect("segment not found").value().ident.clone()
|
||||
}
|
||||
|
||||
fn walk(root: &Path, files: &mut Vec<(syn::File, String)>) {
|
||||
|
|
@ -224,9 +224,9 @@ fn walk(root: &Path, files: &mut Vec<(syn::File, String)>) {
|
|||
|
||||
let mut contents = String::new();
|
||||
File::open(&path)
|
||||
.unwrap()
|
||||
.expect(&format!("can't open file at path: {}", path.display()))
|
||||
.read_to_string(&mut contents)
|
||||
.unwrap();
|
||||
.expect("failed to read file to string");
|
||||
|
||||
files.push((
|
||||
syn::parse_str::<syn::File>(&contents).expect("failed to parse"),
|
||||
|
|
|
|||
|
|
@ -254,6 +254,12 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> {
|
|||
}
|
||||
|
||||
for cpuid in &intel.cpuid {
|
||||
// The pause intrinsic is in the SSE2 module, but it is backwards
|
||||
// compatible with CPUs without SSE2, and it therefore does not need the
|
||||
// target-feature attribute.
|
||||
if rust.name == "_mm_pause" {
|
||||
continue;
|
||||
}
|
||||
// this is needed by _xsave and probably some related intrinsics,
|
||||
// but let's just skip it for now.
|
||||
if *cpuid == "XSS" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue