From 5c0de829c06422123e843e31de3227aabae5703e Mon Sep 17 00:00:00 2001 From: Hans Kratz Date: Fri, 17 Sep 2021 22:29:38 +0200 Subject: [PATCH] Check inlining and instruction count for assert_instr(nop) as well --- crates/stdarch-test/src/lib.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/stdarch-test/src/lib.rs b/crates/stdarch-test/src/lib.rs index ab7ed4b5e5..15ff9595af 100644 --- a/crates/stdarch-test/src/lib.rs +++ b/crates/stdarch-test/src/lib.rs @@ -76,19 +76,16 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) { instrs = &instrs[..instrs.len() - 1]; } + // Look for `expected` as the first part of any instruction in this + // function, e.g., tzcntl in tzcntl %rax,%rax. + // // There are two cases when the expected instruction is nop: // 1. The expected intrinsic is compiled away so we can't // check for it - aka the intrinsic is not generating any code. // 2. It is a mark, indicating that the instruction will be // compiled into other instructions - mainly because of llvm // optimization. - if expected == "nop" { - return; - } - - // Look for `expected` as the first part of any instruction in this - // function, e.g., tzcntl in tzcntl %rax,%rax. - let found = instrs.iter().any(|s| s.starts_with(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