Skip to content

Commit 643b3b7

Browse files
committed
Make assert_instr stricter
1 parent a514252 commit 643b3b7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/stdarch-test/src/disassembly.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ fn parse(output: &str) -> HashSet<Function> {
150150
instruction
151151
.split_whitespace()
152152
.skip(1)
153-
.skip_while(|s| *s == "lock" || *s == "{evex}") // skip x86-specific prefix
153+
.skip_while(|s| *s == "lock" || *s == "{evex}" || *s == "{vex}") // skip x86-specific prefix
154154
.map(std::string::ToString::to_string)
155155
.collect::<Vec<String>>()
156156
};

crates/stdarch-test/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) {
8484
// 2. It is a mark, indicating that the instruction will be
8585
// compiled into other instructions - mainly because of llvm
8686
// optimization.
87-
let found = expected == "nop" || instrs.iter().any(|s| s.contains(expected));
87+
let found = expected == "nop"
88+
|| instrs.iter().any(|s| s.starts_with(expected))
89+
|| (expected == "unknown" && instrs.iter().any(|s| s.starts_with("<unknown>"))); // Workaround for rust-lang/stdarch#1674
8890

8991
// Look for subroutine call instructions in the disassembly to detect whether
9092
// inlining failed: all intrinsics are `#[inline(always)]`, so calling one

0 commit comments

Comments
 (0)