capstone icon indicating copy to clipboard operation
capstone copied to clipboard

AArch64 update to LLVM 18

Open Rot127 opened this issue 11 months ago • 8 comments

WIP

Based on: https://github.com/capstone-engine/capstone/pull/2313

Your checklist for this pull request

  • [ ] I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • [x] I've added tests that prove my fix is effective or that my feature works (if possible)

Detailed description

Generated with: https://github.com/capstone-engine/llvm-capstone/pull/45

New features/instructions

New features:

AArch64_FEATURE_HasPAuthLR,
AArch64_FEATURE_HasSMEFA64,
AArch64_FEATURE_HasFPMR,
AArch64_FEATURE_HasFP8,
AArch64_FEATURE_HasFAMINMAX,
AArch64_FEATURE_HasFP8FMA,
AArch64_FEATURE_HasSSVE_FP8FMA,
AArch64_FEATURE_HasFP8DOT2,
AArch64_FEATURE_HasSSVE_FP8DOT2,
AArch64_FEATURE_HasFP8DOT4,
AArch64_FEATURE_HasSSVE_FP8DOT4,
AArch64_FEATURE_HasLUT,
AArch64_FEATURE_HasSME_LUTv2,
AArch64_FEATURE_HasSMEF8F16,
AArch64_FEATURE_HasSMEF8F32,
AArch64_FEATURE_HasSVE2orSME2,
AArch64_FEATURE_HasCHK,
AArch64_FEATURE_HasGCS,
AArch64_FEATURE_HasCPA,

New instructions:

AArch64_INS_ADDPT,
AArch64_INS_AUTIA171615,
AArch64_INS_AUTIASPPC,
AArch64_INS_AUTIB171615,
AArch64_INS_AUTIBSPPC,
AArch64_INS_BF1CVTL2,
AArch64_INS_BF1CVTLT,
AArch64_INS_BF1CVTL,
AArch64_INS_BF1CVT,
AArch64_INS_BF2CVTL2,
AArch64_INS_BF2CVTLT,
AArch64_INS_BF2CVTL,
AArch64_INS_BF2CVT,
AArch64_INS_F1CVTL2,
AArch64_INS_F1CVTLT,
AArch64_INS_F1CVTL,
AArch64_INS_F1CVT,
AArch64_INS_F2CVTL2,
AArch64_INS_F2CVTLT,
AArch64_INS_F2CVTL,
AArch64_INS_F2CVT,
AArch64_INS_FAMAX,
AArch64_INS_FAMIN,
AArch64_INS_FCVTNB,
AArch64_INS_FMLALLBB,
AArch64_INS_FMLALLBT,
AArch64_INS_FMLALLTB,
AArch64_INS_FMLALLTT,
AArch64_INS_FMLALL,
AArch64_INS_FVDOTB,
AArch64_INS_FVDOTT,
AArch64_INS_GCSPOPCX,
AArch64_INS_GCSPOPM,
AArch64_INS_GCSPOPX,
AArch64_INS_GCSPUSHM,
AArch64_INS_GCSPUSHX,
AArch64_INS_GCSSS1,
AArch64_INS_GCSSS2,
AArch64_INS_GCSSTR,
AArch64_INS_GCSSTTR,
AArch64_INS_MADDPT,
AArch64_INS_MADPT,
AArch64_INS_MLAPT,
AArch64_INS_MSUBPT,
AArch64_INS_PACIA171615,
AArch64_INS_PACIASPPC,
AArch64_INS_PACIB171615,
AArch64_INS_PACIBSPPC,
AArch64_INS_PACNBIASPPC,
AArch64_INS_PACNBIBSPPC,
AArch64_INS_RETAASPPC,
AArch64_INS_RETABSPPC,
AArch64_INS_SUBPT,

Test plan

  • [x] Fix current one.
  • [x] Add new MC tests
  • [x] Add tests for SME
  • [x] Fuzzing

General detail testing comes afterwards, when testing in general is modernized.

Closing issues

closes https://github.com/capstone-engine/capstone/issues/2269 closes https://github.com/capstone-engine/capstone/issues/2270 closes https://github.com/capstone-engine/capstone/issues/2268 closes https://github.com/capstone-engine/capstone/issues/2285 closes https://github.com/capstone-engine/capstone/issues/2363

Rot127 avatar Mar 25 '24 11:03 Rot127

Relative to the Mar 2024 spec, the system registers listed below don't currently have a representation in Capstone. I've not yet checked to see if they are in LLVM-18's tablegen.

DBGBCR{16-63}_EL1 DBGBVR{16-63}_EL1 DBGWCR{16-63}_EL1 DBGWVR{16-63}_EL1 ICV_AP0R{0-3}_EL1 ICV_AP1R{0-3}_EL1 ICV_BPR1_EL1 ICV_CTLR_EL1 ICV_DIR_EL1 ICV_EOIR{0-1}_EL1 ICV_HPPIR{0-1}_EL1 ICV_IAR{0-1}_EL1 ICV_IGRPEN{0-1}_EL1 ICV_NMIAR1_EL1 ICV_PMR_EL1 ICV_RPR_EL1 SPMEVCNTR{16-63}_EL0 SPMEVFILT2R{16-63}_EL0 SPMEVFILTR{16-63}_EL0 SPMEVTYPER{16-63}_EL0 SP_EL3 TRBMPAM_EL1

hainest avatar Apr 30 '24 14:04 hainest

Couldn't find them in LLVM with grep as well.

Rot127 avatar May 01 '24 07:05 Rot127

I cannot reproduce the fuzzing bug. Locally everything is fine (also no segfault for 0x0->0xffffffff).

~~My guess is, it is a Python 2 issues. So I'd wait for https://github.com/capstone-engine/capstone/pull/2378 and https://github.com/google/oss-fuzz/pull/12028.~~

clang-tidy fails with a false positive. The code is correct and clang-tidy-19/18 don't give the warning. But ubuntu-latest doesn't have clang-tidy-18 as package. So we just need to ignore it for now.

Rot127 avatar Jun 06 '24 08:06 Rot127

Hi @Rot127, I'm really keen to see this PR merged into the next branch and know that there is a lot of other work that you and others are doing throughout the project. Is there anything I can do to help speed up this PR being merged?

FinnWilkinson avatar Jun 14 '24 10:06 FinnWilkinson

@FinnWilkinson The main thing is the missing review from @kabeor and/or @aquynh. I'm currently off. But will take time in two days to rebase it and address reviewer comments.

Rot127 avatar Jun 15 '24 15:06 Rot127

@FinnWilkinson Please be aware that we will likely change the enum naming of AArch64_ -> AARCH64_ in the near future. Just so you are aware of (see: https://github.com/capstone-engine/capstone/pull/2349#discussion_r1641227883). I am sorry for apparently being sloppy and forgot to check it way earlier.

Rot127 avatar Jun 15 '24 15:06 Rot127

@aquynh @kabeor Please review this. I just rebase it again. The failing tests are explained here: https://github.com/capstone-engine/capstone/pull/2298#issuecomment-2151699039

Rot127 avatar Jun 26 '24 11:06 Rot127

@aquynh @kabeor When you review this weekend, you can skip https://github.com/capstone-engine/capstone/pull/2298/commits/0615ebb3cd51d2626d171c5361a87196f1478951. This one is only the enum name change.

Rot127 avatar Jun 28 '24 08:06 Rot127