From 96cac06673bfb2c9fb6ea2da4bee4f0ed0f9b055 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 17 Mar 2024 10:40:41 -0700 Subject: differential test: more refinement on exceptions --- differential-tests/tests/capstone-differential.rs | 25 +++++++---------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/differential-tests/tests/capstone-differential.rs b/differential-tests/tests/capstone-differential.rs index 8a3bda2..3e76321 100644 --- a/differential-tests/tests/capstone-differential.rs +++ b/differential-tests/tests/capstone-differential.rs @@ -467,21 +467,16 @@ fn capstone_differential() { } } - if cs_text - .replace("uxtw #0", "uxtw") - .replace("uxtx #0", "uxtx") == yax_text { - - return true; - } - - // capstone discards uxtw in some circumstances for reasons i don't yet - // know - if let Some(yax_text) = yax_text.strip_suffix(", uxtw") { + // capstone decodes [00, 40, 20, 0b] as "add w0, w0, w0, uxtw", note + // missing shift amount (should be lsl, too). yax decodes this as + // "add w0, w0, w0", no shift amount. + // + // same for x registers and uxtx, so handle that too. + if let Some(cs_text) = cs_text.strip_suffix(", uxtw") { if yax_text == cs_text { return true; } - } - if let Some(cs_text) = cs_text.strip_suffix(", uxtw") { + } else if let Some(cs_text) = cs_text.strip_suffix(", uxtx") { if yax_text == cs_text { return true; } @@ -534,12 +529,6 @@ fn capstone_differential() { return true; } - // yax omits `uxt{w,x}` for extended reg where extension matches the - // register size - if cs_text.starts_with(yax_text) && (cs_text.ends_with("uxtx") || cs_text.ends_with("uxtw")) { - return true; - } - // S being present or not has no bearing on the shift amount, #0 either // way. // yax will not print shift because of its ineffectual nature. -- cgit v1.1