From e020398d2836fffc558ec78896e6485c48b57aa4 Mon Sep 17 00:00:00 2001 From: gnzlbg Date: Sun, 11 Nov 2018 13:03:08 +0100 Subject: [PATCH] support never type in stdsimd-verify and white-list ud2 intrinsic --- crates/stdsimd-verify/src/lib.rs | 3 ++- crates/stdsimd-verify/tests/x86-intel.rs | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/stdsimd-verify/src/lib.rs b/crates/stdsimd-verify/src/lib.rs index 5490595c9e..256da4b7ca 100644 --- a/crates/stdsimd-verify/src/lib.rs +++ b/crates/stdsimd-verify/src/lib.rs @@ -113,7 +113,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream { "u64" => quote! { &U64 }, "u8" => quote! { &U8 }, "CpuidResult" => quote! { &CPUID }, - s => panic!("unspported type: {}", s), + s => panic!("unspported type: \"{}\"", s), } } syn::Type::Ptr(syn::TypePtr { ref elem, .. }) @@ -124,6 +124,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream { syn::Type::Slice(_) => panic!("unsupported slice"), syn::Type::Array(_) => panic!("unsupported array"), syn::Type::Tuple(_) => quote! { &TUPLE }, + syn::Type::Never(_) => quote! { &NEVER }, _ => panic!("unsupported type"), } } diff --git a/crates/stdsimd-verify/tests/x86-intel.rs b/crates/stdsimd-verify/tests/x86-intel.rs index 395b96389b..4f6015b99a 100644 --- a/crates/stdsimd-verify/tests/x86-intel.rs +++ b/crates/stdsimd-verify/tests/x86-intel.rs @@ -57,6 +57,7 @@ static M256D: Type = Type::M256D; static TUPLE: Type = Type::Tuple; static CPUID: Type = Type::CpuidResult; +static NEVER: Type = Type::Never; #[derive(Debug)] enum Type { @@ -73,6 +74,7 @@ enum Type { M256I, Tuple, CpuidResult, + Never, } x86_functions!(static FUNCTIONS); @@ -135,14 +137,20 @@ fn verify_all_signatures() { let mut all_valid = true; 'outer: for rust in FUNCTIONS { match rust.name { - // These aren't defined by Intel but they're defined by what - // appears to be all other compilers. For more - // information see rust-lang-nursery/stdsimd#307, and - // otherwise these signatures have all been manually - // verified. - "__readeflags" | "__writeeflags" | "__cpuid_count" | "__cpuid" - | "__get_cpuid_max" => continue, - + // These aren't defined by Intel but they're defined by what appears + // to be all other compilers. For more information see + // rust-lang-nursery/stdsimd#307, and otherwise these signatures + // have all been manually verified. + "__readeflags" | + "__writeeflags" | + "__cpuid_count" | + "__cpuid" | + "__get_cpuid_max" | + // The UD2 intrinsic is not defined by Intel, but it was agreed on + // in the RFC Issue 2512: + // https://github.com/rust-lang/rfcs/issues/2512 + "ud2" + => continue, _ => {} }