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

Fix PPC insn names and psq displacement #1902

Merged
merged 3 commits into from
Jul 23, 2022
Merged

Conversation

riptl
Copy link
Contributor

@riptl riptl commented Jul 23, 2022

Fixes bug where PowerPC psq_l, psq_lu, psq_st, psq_stu operands get printed as unsigned operands (should be signed).

Fixes bug where almost all instruction names are wrong in PowerPC due to PPCMappingInsnName.c table getting out of sync with ppc.h.

Adds ppc32ps and ppc32beps cstool modes.

Avoid setting PowerPC branch hint on signed disp.


Before:

% ./cstool/cstool -d --help ppc32beps 'f3ec0ff8'
 0  f3 ec 0f f8  psq_st f31, 0xff8(r12), 0, 0
        ID: 1694 (xvtstdcdp)
        op_count: 4
                operands[0].type: REG = f31
                operands[1].type: MEM
                        operands[1].mem.base: REG = r12
                        operands[1].mem.disp: 0xff8
                operands[2].type: IMM = 0x0
                operands[3].type: IMM = 0x0

After:

% ./cstool/cstool -d --help ppc32beps 'f3ec0ff8'                                            
 0  f3 ec 0f f8  psq_st f31, -8(r12), 0, 0
        ID: 1694 (psq_st)
        op_count: 4
                operands[0].type: REG = f31
                operands[1].type: MEM
                        operands[1].mem.base: REG = r12
                        operands[1].mem.disp: 0xfffffff8
                operands[2].type: IMM = 0x0
                operands[3].type: IMM = 0x0

cc @kabeor

@riptl riptl marked this pull request as draft July 23, 2022 14:40
@riptl riptl marked this pull request as ready for review July 23, 2022 14:47
@kabeor
Copy link
Member

kabeor commented Jul 23, 2022

plz add opcode test at https://github.com/capstone-engine/capstone/blob/next/suite/cstest/issues.cs

@kabeor
Copy link
Member

kabeor commented Jul 23, 2022

Great! Merged.

@kabeor kabeor merged commit 0494e94 into capstone-engine:next Jul 23, 2022
@aquynh
Copy link
Collaborator

aquynh commented Jul 23, 2022

where is this fix from: by yourself, or from upstream llvm?

@riptl
Copy link
Contributor Author

riptl commented Jul 23, 2022

@aquynh Myself because LLVM doesn't support the paired-singles extension

@riptl riptl deleted the fix-ppc-psq branch July 23, 2022 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants