From 94dd5f26e01d1ef2fa8e13b71234a2569c0d69ac Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Wed, 6 Feb 2019 20:08:48 -0800 Subject: [PATCH] Add a fixup pass for cpuid values when validating XML. --- .../crates/stdsimd-verify/tests/x86-intel.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/stdarch/crates/stdsimd-verify/tests/x86-intel.rs b/library/stdarch/crates/stdsimd-verify/tests/x86-intel.rs index 4a81b8f16d2c..eb84c8d0d701 100644 --- a/library/stdarch/crates/stdsimd-verify/tests/x86-intel.rs +++ b/library/stdarch/crates/stdsimd-verify/tests/x86-intel.rs @@ -273,15 +273,25 @@ fn matches(rust: &Function, intel: &Intrinsic) -> Result<(), String> { .flat_map(|c| c.to_lowercase()) .collect::(); + // 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 )