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

AArch64 Capstone Update / SME2 support #429

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open

Conversation

FinnWilkinson
Copy link
Contributor

@FinnWilkinson FinnWilkinson commented Sep 4, 2024

This PR updates SimEng to work with a newer release of Capstone who's AArch64 engine is based on LLVM18, hence allowing SME2 support.

The reccommended version of LLVM has also been changed to 18.1.8 and the test suite has been updated to work with this version in order to dissassemble new AArch64 instructions.

Closes Issue #349

There have been large changes to Capstone internally for AArch64, some of the main ones which effect our current development / usage include:

  • A writeback from a pre/post index load/store is now included as an implicit destination. Hence, in instruction_execute the updated base address register is resuts[0] rather than results[1] (for example).

  • Post index immediate operands are now included as part of the memory operand in mem.disp. Post indexing with a register however is added as an additional operand.

  • Aliasing can be dissabled for auto-sync architectures, and has been done for AArch64. This means expected registers for the operand are now correct and allows us to remove revertalias() from instruction_metadata completely! The only oddity is the mnemonic and operandStr are still that of the alias. This means exceptions or debugging print statements may be confusing. To indicate aliases better, an isAlias bool has been added to the metadata and exception print out.

  • Get automatic LLVM download and install working for version 18.1.8

  • Add AArch64 multi-vector operand enum decoding logic to instruction_decode

    • No longer required as multi-vector operands already give each register individually rather than using the multi-register enums

@FinnWilkinson FinnWilkinson added the enhancement New feature or request label Sep 4, 2024
@FinnWilkinson FinnWilkinson self-assigned this Sep 4, 2024
@FinnWilkinson FinnWilkinson marked this pull request as ready for review September 17, 2024 17:08
@FinnWilkinson FinnWilkinson added the 0.9.7 Part of SimEng Release 0.9.7 label Sep 17, 2024
CMakeLists.txt Show resolved Hide resolved
src/include/simeng/arch/aarch64/Instruction.hh Outdated Show resolved Hide resolved
src/lib/arch/aarch64/ExceptionHandler.cc Outdated Show resolved Hide resolved
src/lib/arch/aarch64/Instruction_decode.cc Outdated Show resolved Hide resolved
src/lib/config/ModelConfig.cc Outdated Show resolved Hide resolved
@FinnWilkinson FinnWilkinson changed the title [WIP] AArch64 Capstone Update / SME2 support AArch64 Capstone Update / SME2 support Oct 2, 2024
@FinnWilkinson FinnWilkinson linked an issue Oct 24, 2024 that may be closed by this pull request
Copy link
Contributor

@jj16791 jj16791 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fair few comments but there's a lot of work done here so expected. Great job on this, a significant amount of effort done!

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
docs/sphinx/developer/arch/index.rst Outdated Show resolved Hide resolved
docs/sphinx/developer/arch/supported/aarch64.rst Outdated Show resolved Hide resolved
docs/sphinx/developer/arch/supported/aarch64.rst Outdated Show resolved Hide resolved
src/lib/arch/aarch64/Instruction_decode.cc Show resolved Hide resolved
src/lib/arch/aarch64/Instruction_decode.cc Outdated Show resolved Hide resolved
if (((Opcode::AArch64_FMOVD0 <= metadata_.opcode &&
metadata_.opcode <= Opcode::AArch64_FMOVS0) ||
(Opcode::AArch64_FMOVDXHighr <= metadata_.opcode &&
metadata_.opcode <= Opcode::AArch64_FMOVv8f16_ns)) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't the _ns instructions moving immediates into vector registers? (and thus aren't "move to general instructions")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this I replaced the numbers with Opcodes (and referred to the previous Capstone version to make sure they aligned). If this is the case then we can remove the _ns ones from this catch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-checked and we should remove _ns from this catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated catch

src/lib/arch/aarch64/Instruction_decode.cc Outdated Show resolved Hide resolved
src/lib/arch/aarch64/Instruction_decode.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@dANW34V3R dANW34V3R left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much to add on top of the others' comments. Will approve once theirs have been resolved

docs/sphinx/user/building_simeng.rst Outdated Show resolved Hide resolved
docs/sphinx/user/configuring_simeng.rst Outdated Show resolved Hide resolved
src/include/simeng/arch/aarch64/helpers/sve.hh Outdated Show resolved Hide resolved
src/lib/arch/aarch64/Architecture.cc Show resolved Hide resolved
src/lib/arch/riscv/InstructionMetadata.cc Show resolved Hide resolved
src/lib/arch/aarch64/Instruction_decode.cc Outdated Show resolved Hide resolved
dANW34V3R
dANW34V3R previously approved these changes Nov 11, 2024
ABenC377
ABenC377 previously approved these changes Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.9.7 Part of SimEng Release 0.9.7 enhancement New feature or request
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

Add SME2 support
5 participants