capstone icon indicating copy to clipboard operation
capstone copied to clipboard

AArch64 cond operands

Open adamjseitz opened this issue 2 years ago • 1 comments

There are a number of ARM64 instructions that represent a condition code as an operand. These include:

ccmn, ccmp, cinc, cinv, cneg, csel, cset, csetm, csinc, csinv, csneg, fccmp, fccmpe, fcsel

However, capstone does not represent these as an operand:

cstool -d arm64 00bc211e
 0  00 bc 21 1e  fcsel  s0, s0, s1, lt
        ID: 194 (fcsel)
        op_count: 3
                operands[0].type: REG = s0
                operands[0].access: WRITE
                operands[1].type: REG = s0
                operands[1].access: READ
                operands[2].type: REG = s1
                operands[2].access: READ
        Code-condition: 12
        Registers read: nzcv s0 s1
        Registers modified: s0
        Groups: fparmv8

I would suggest adding a new enum value ARM64_OP_COND to arm64_op_type and a field arm64_op_cc cc to the cs_arm64_op structure's value union to more accurately represent these instructions as having four operands.

adamjseitz avatar Jun 30 '22 13:06 adamjseitz

Personally I wouldn't say this is necessary. lt at an operand position is syntactical sugar IMHO. Having condition information at two different places makes the whole design just more complicated.

Rot127 avatar Nov 02 '23 14:11 Rot127