Add a fixup pass for cpuid values when validating XML.
This commit is contained in:
parent
19e23d1b15
commit
94dd5f26e0
1 changed files with 12 additions and 2 deletions
|
|
@ -273,15 +273,25 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> {
|
|||
.flat_map(|c| c.to_lowercase())
|
||||
.collect::<String>();
|
||||
|
||||
// The XML file names IFMA as "avx512ifma52", while Rust calls
|
||||
// it "avx512ifma". Fix this mismatch by replacing the Intel
|
||||
// name with the Rust name.
|
||||
let fixup_cpuid = |cpuid: String| match cpuid.as_ref() {
|
||||
"avx512ifma52" => String::from("avx512ifma"),
|
||||
_ => cpuid,
|
||||
};
|
||||
let fixed_cpuid = fixup_cpuid(cpuid);
|
||||
|
||||
let rust_feature = rust
|
||||
.target_feature
|
||||
.expect(&format!("no target feature listed for {}", rust.name));
|
||||
if rust_feature.contains(&cpuid) {
|
||||
|
||||
if rust_feature.contains(&fixed_cpuid) {
|
||||
continue;
|
||||
}
|
||||
bail!(
|
||||
"intel cpuid `{}` not in `{}` for {}",
|
||||
cpuid,
|
||||
fixed_cpuid,
|
||||
rust_feature,
|
||||
rust.name
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue