about summary refs log tree commit diff
path: root/library/stdarch/crates/stdarch-test
diff options
context:
space:
mode:
Diffstat (limited to 'library/stdarch/crates/stdarch-test')
-rw-r--r--library/stdarch/crates/stdarch-test/src/lib.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/library/stdarch/crates/stdarch-test/src/lib.rs b/library/stdarch/crates/stdarch-test/src/lib.rs
index 98f44f745fd..317b4641059 100644
--- a/library/stdarch/crates/stdarch-test/src/lib.rs
+++ b/library/stdarch/crates/stdarch-test/src/lib.rs
@@ -92,7 +92,13 @@ pub fn assert(shim_addr: usize, fnname: &str, expected: &str) {
     };
 
     // Check whether the given instruction is part of the disassemblied body.
-    let found = expected == "nop" || instrs.iter().any(|s| s.starts_with(expected));
+    let found = expected == "nop"
+        || instrs.iter().any(|instruction| {
+            // Check that the next character is non-alphabetic. This prevents false negatives
+            // when e.g. `fminnm` was used but `fmin` was expected.
+            instruction.starts_with(expected)
+                && !instruction[expected.len()..].starts_with(|c: char| c.is_ascii_alphabetic())
+        });
 
     // Look for subroutine call instructions in the disassembly to detect whether
     // inlining failed: all intrinsics are `#[inline(always)]`, so calling one