Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: check inlining and instruction count even if we don't check for a specific instruction #1218

Merged
merged 1 commit into from
Sep 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions crates/stdarch-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down