Skip to content

Commit e020398

Browse files
committed
support never type in stdsimd-verify and white-list ud2 intrinsic
1 parent 7c93a23 commit e020398

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

crates/stdsimd-verify/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
113113
"u64" => quote! { &U64 },
114114
"u8" => quote! { &U8 },
115115
"CpuidResult" => quote! { &CPUID },
116-
s => panic!("unspported type: {}", s),
116+
s => panic!("unspported type: \"{}\"", s),
117117
}
118118
}
119119
syn::Type::Ptr(syn::TypePtr { ref elem, .. })
@@ -124,6 +124,7 @@ fn to_type(t: &syn::Type) -> proc_macro2::TokenStream {
124124
syn::Type::Slice(_) => panic!("unsupported slice"),
125125
syn::Type::Array(_) => panic!("unsupported array"),
126126
syn::Type::Tuple(_) => quote! { &TUPLE },
127+
syn::Type::Never(_) => quote! { &NEVER },
127128
_ => panic!("unsupported type"),
128129
}
129130
}

crates/stdsimd-verify/tests/x86-intel.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static M256D: Type = Type::M256D;
5757

5858
static TUPLE: Type = Type::Tuple;
5959
static CPUID: Type = Type::CpuidResult;
60+
static NEVER: Type = Type::Never;
6061

6162
#[derive(Debug)]
6263
enum Type {
@@ -73,6 +74,7 @@ enum Type {
7374
M256I,
7475
Tuple,
7576
CpuidResult,
77+
Never,
7678
}
7779

7880
x86_functions!(static FUNCTIONS);
@@ -135,14 +137,20 @@ fn verify_all_signatures() {
135137
let mut all_valid = true;
136138
'outer: for rust in FUNCTIONS {
137139
match rust.name {
138-
// These aren't defined by Intel but they're defined by what
139-
// appears to be all other compilers. For more
140-
// information see rust-lang-nursery/stdsimd#307, and
141-
// otherwise these signatures have all been manually
142-
// verified.
143-
"__readeflags" | "__writeeflags" | "__cpuid_count" | "__cpuid"
144-
| "__get_cpuid_max" => continue,
145-
140+
// These aren't defined by Intel but they're defined by what appears
141+
// to be all other compilers. For more information see
142+
// rust-lang-nursery/stdsimd#307, and otherwise these signatures
143+
// have all been manually verified.
144+
"__readeflags" |
145+
"__writeeflags" |
146+
"__cpuid_count" |
147+
"__cpuid" |
148+
"__get_cpuid_max" |
149+
// The UD2 intrinsic is not defined by Intel, but it was agreed on
150+
// in the RFC Issue 2512:
151+
// https://github.com/rust-lang/rfcs/issues/2512
152+
"ud2"
153+
=> continue,
146154
_ => {}
147155
}
148156

0 commit comments

Comments
 (0)