diff options
author | iximeow <me@iximeow.net> | 2024-03-17 10:40:41 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-03-17 10:40:41 -0700 |
commit | 96cac06673bfb2c9fb6ea2da4bee4f0ed0f9b055 (patch) | |
tree | 936baf031c64b6512c581af4edec2b61ecdf239b /differential-tests | |
parent | 9835e702110eeed2f1fa498cd01c9751612b76a0 (diff) |
differential test: more refinement on exceptions
Diffstat (limited to 'differential-tests')
-rw-r--r-- | differential-tests/tests/capstone-differential.rs | 25 |
1 files 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. |