From 47fb609e3b9a5841d791728122305ba112eabca5 Mon Sep 17 00:00:00 2001 From: sayantn Date: Sat, 21 Dec 2024 02:01:35 +0530 Subject: [PATCH] Make `assert_instr` stricter --- crates/stdarch-test/src/disassembly.rs | 2 +- crates/stdarch-test/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/stdarch-test/src/disassembly.rs b/crates/stdarch-test/src/disassembly.rs index a7b46a73fc..8c724b8d42 100644 --- a/crates/stdarch-test/src/disassembly.rs +++ b/crates/stdarch-test/src/disassembly.rs @@ -150,7 +150,7 @@ fn parse(output: &str) -> HashSet { instruction .split_whitespace() .skip(1) - .skip_while(|s| *s == "lock" || *s == "{evex}") // skip x86-specific prefix + .skip_while(|s| *s == "lock" || *s == "{evex}" || *s == "{vex}") // skip x86-specific prefix .map(std::string::ToString::to_string) .collect::>() }; diff --git a/crates/stdarch-test/src/lib.rs b/crates/stdarch-test/src/lib.rs index 3248de8f3a..11e24d43f9 100644 --- a/crates/stdarch-test/src/lib.rs +++ b/crates/stdarch-test/src/lib.rs @@ -84,7 +84,7 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { // 2. It is a mark, indicating that the instruction will be // compiled into other instructions - mainly because of llvm // optimization. - let found = expected == "nop" || instrs.iter().any(|s| s.contains(expected)); + let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected)); // Look for subroutine call instructions in the disassembly to detect whether // inlining failed: all intrinsics are `#[inline(always)]`, so calling one