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

Normalize [us]shll.* ..., #0 aarch64 disassembly to the preferred [us]xtl.* #1213

Merged
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
25 changes: 24 additions & 1 deletion crates/stdarch-test/src/disassembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn parse(output: &str) -> HashSet<Function> {
cached_header = None;
break;
}
let parts = if cfg!(target_env = "msvc") {
let mut parts = if cfg!(target_env = "msvc") {
// Each line looks like:
//
// > $addr: ab cd ef $instr..
Expand All @@ -152,6 +152,29 @@ fn parse(output: &str) -> HashSet<Function> {
.map(std::string::ToString::to_string)
.collect::<Vec<String>>()
};

if cfg!(target_arch = "aarch64") {
// Normalize [us]shll.* ..., #0 instructions to the preferred form: [us]xtl.* ...
// as LLVM objdump does not do that.
// See https://developer.arm.com/documentation/ddi0602/latest/SIMD-FP-Instructions/UXTL--UXTL2--Unsigned-extend-Long--an-alias-of-USHLL--USHLL2-
// and https://developer.arm.com/documentation/ddi0602/latest/SIMD-FP-Instructions/SXTL--SXTL2--Signed-extend-Long--an-alias-of-SSHLL--SSHLL2-
// for details.
match (parts.first(), parts.last()) {
(Some(instr), Some(last_arg))
if (instr.starts_with("ushll.") || instr.starts_with("sshll."))
&& last_arg == "#0" =>
{
assert_eq!(parts.len(), 4);
let mut new_parts = Vec::with_capacity(3);
let new_instr = format!("{}{}{}", &instr[..1], "xtl", &instr[5..]);
new_parts.push(new_instr);
new_parts.push(parts[1].clone());
new_parts.push(parts[2][0..parts[2].len() - 1].to_owned()); // strip trailing comma
parts = new_parts;
}
_ => {}
};
}
instructions.push(parts.join(" "));
}
let function = Function {
Expand Down