Description
Description
The operands for some SVE memory instructions (at least those that are "vector plus immediate" addressing modes) are not set correctly. Where there should be a memory type, it is labeled as a register type. The immediate should be marked as the displacement, but it is stored as an immediate in the next operand, which is labeled as INVALID.
Examples
Using commit d0ef88a on the next
branch:
$ ./cstool -d arm64be "c5 a1 c4 24"
0 c5 a1 c4 24 ld1d {z4.d}, p1/z, [z1.d, #8]
ID: 435 (ld1d)
op_count: 4
operands[0].type: REG = z4
Vector Arrangement Specifier: 0xd
operands[1].type: REG = p1
operands[2].type: REG = z1
In the above, the string is correct, but operand 2 should be of type mem and have a displacement of 8.
A similar example, but a different instruction:
$ ./cstool -d arm64be "e5 41 a4 22"
0 e5 41 a4 22 st1w {z2.d}, p1, [z1.d, #4]
ID: 976 (st1w)
op_count: 4
operands[0].type: REG = z2
Vector Arrangement Specifier: 0xd
operands[1].type: REG = p1
operands[2].type: REG = z1
Again, the string is correct but the second operand should be a memory operand.
Suggested Solution
In AArch64InstPrinter.c:printSVERegOp
, the MI->csh>doing_mem
flag could be checked, and operand information could be set accordingly. This would be very similar to the printOperand
function in the same file:
if (doing_mem)
if (base is INVALID)
mem.base = Reg
else if (index is INVALID)
mem.index = Reg
else
set access
type = REG
reg = Reg
op_count++