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

Add PowerPC paired-singles support #1898

Merged
merged 3 commits into from
Jul 23, 2022
Merged

Conversation

riptl
Copy link
Contributor

@riptl riptl commented Jul 22, 2022

Adds support for the proprietary paired-singles extension in PowerPC 750CXe (Gekko) and 750CL (Broadway) CPUs.

  • Add TableGen code
  • Re-run synctools
  • Update bindings
  • Add GQR registers (not needed; GQRs are SPRs, which Capstone represents as immediate)
  • Support psq_l, psq_lu, psq_st, psq_stu
  • Test disassembly

Closes #476

@riptl riptl changed the base branch from master to next July 22, 2022 07:55
@riptl riptl force-pushed the ppc-ps branch 5 times, most recently from 68b668c to 9f04a0a Compare July 23, 2022 05:57
@riptl riptl marked this pull request as ready for review July 23, 2022 05:57
suite/synctools/tablegen/PPC/PPC.td Outdated Show resolved Hide resolved
@@ -372,33 +372,32 @@ enum {
PPC_F4RCRegClassID = 6,
PPC_CRRCRegClassID = 7,
PPC_CARRYRCRegClassID = 8,
PPC_CRRC0RegClassID = 9,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

PPC_CRRC0RegClassID got removed, most likely due to LLVM TableGen version mismatch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also causing build warnings

arch/PowerPC/PPCGenSubtargetInfo.inc Show resolved Hide resolved
include/capstone/ppc.h Outdated Show resolved Hide resolved
@kabeor
Copy link
Member

kabeor commented Jul 23, 2022

@terorie Cool, that's really great work, thanks for your contribution! Can I merge now?
Btw, which version of llvm you are using, still 8.0.0?

@riptl
Copy link
Contributor Author

riptl commented Jul 23, 2022

@kabeor I am using LLVM 7.0.1 (without patches), which is the wrong version. It seems the correct version uses some LLVM patch that fixes a security vulnerability: #1510 (comment). So therefore I would be cautious not to reintroduce it.

Perhaps let's try to move to LLVM 8.0.1 before merging? Hopefully there aren't too many breaking changes.

To make the build work under LLVM 7.0.1, I used the following patch.

HTM patch
From c9d1d43410b56a92aa6951c85497d5fe94c6e80b Mon Sep 17 00:00:00 2001
From: Richard Patel <me@terorie.dev>
Date: Sat, 23 Jul 2022 08:38:29 +0200
Subject: [PATCH] htm

---
 suite/synctools/tablegen/PPC/PPCInstrHTM.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/suite/synctools/tablegen/PPC/PPCInstrHTM.td b/suite/synctools/tablegen/PPC/PPCInstrHTM.td
index f9c4f42b..fa33a7db 100644
--- a/suite/synctools/tablegen/PPC/PPCInstrHTM.td
+++ b/suite/synctools/tablegen/PPC/PPCInstrHTM.td
@@ -22,7 +22,7 @@ def HTM_get_imm : SDNodeXForm<imm, [{
 
 let hasSideEffects = 1, usesCustomInserter = 1  in {
 def TCHECK_RET : Pseudo<(outs gprc:$out), (ins), "#TCHECK_RET", []>;
-def TBEGIN_RET : PPCCustomInserterPseudo<(outs gprc:$out), (ins u1imm:$R), "#TBEGIN_RET", []>;
+def TBEGIN_RET : Pseudo<(outs gprc:$out), (ins u1imm:$R), "#TBEGIN_RET", []>;
 }
 
 
-- 
2.32.1 (Apple Git-133)

@kabeor
Copy link
Member

kabeor commented Jul 23, 2022

Perhaps let's try to move to LLVM 8.0.1 before merging? Hopefully there aren't too many breaking changes.

It's no need for this PR:) But would you like to check #1803 and #1831? Maybe we can auto-sync the latest version by using this tools.

@riptl
Copy link
Contributor Author

riptl commented Jul 23, 2022

@kabeor Sounds good, should I try to run PowerPC arch through auto-sync now or wait until #1831 gets merged first? There's not really a rush in getting this PR merged, so let's try the cleanest way maybe?

@kabeor
Copy link
Member

kabeor commented Jul 23, 2022

@kabeor Sounds good, should I try to run PowerPC arch through auto-sync now or wait until #1831 gets merged first? There's not really a rush in getting this PR merged, so let's try the cleanest way maybe?

Ah, I will merge this immediately (after ci test finished). As you see, #1803 and #1831 lost their contributors, so I wonder to know if you would like to continue work on it?

@kabeor kabeor merged commit af3b4fc into capstone-engine:next Jul 23, 2022
@riptl
Copy link
Contributor Author

riptl commented Jul 23, 2022

As you see, #1803 and #1831 lost their contributors, so I wonder to know if you would like to continue work on it?

@kabeor Alright, I'm up for the challenge :) I'm not very experienced with LLVM but sounds like a cool project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants