Skip to content

MIPS partial support for c.eq.d and friends #1851

@wideglide

Description

@wideglide

It seems MIPS[32/64] bit has only partial support for the family of c.{eq,le,ge}.d instructions.

I'm testing on next 31af3c3

This version is supported:

$ ./cstool/cstool -d mips64 "32 C0 38 46"
 0  32 c0 38 46  c.eq.d $f24, $f24
        ID: 168 (c)
        op_count: 2
                operands[0].type: REG = f24
                operands[1].type: REG = f24
        Groups: stdenc notmips32r6 notmips64r6 fp64bit

These versions are unsupported:

$ ./cstool/cstool -d mips64 "32 02 20 46"
ERROR: invalid assembly code
$ ./cstool/cstool -d mips64 "32 03 20 46"
ERROR: invalid assembly code

$ ./cstool/cstool -v
cstool for Capstone Disassembler, v5.0.0
Capstone build: x86=1 arm=1 arm64=1 mips=1 ppc=1 sparc=1 sysz=1 xcore=1 m68k=1 tms320c64x=1 m680x=1 evm=1 wasm=1 mos65xx=1 bpf=1 riscv=1

But the are supported with llvm-mc-9:

$ echo "0x32 0xC0 0x38 0x46" | llvm-mc-9 -disassemble -triple=mips64el-linux-gnu
        .text
        c.eq.d  $f24, $f24
$ echo "0x32 0x02 0x20 0x46" | llvm-mc-9 -disassemble -triple=mips64el-linux-gnu
        .text
        c.eq.d  $fcc2, $f0, $f0

Similiar result for mips (32-bit):

$ echo "0x33 0x05 0x22 0x46" | llvm-mc-9 -disassemble -triple=mipsel-linux-gnu
        .text
        c.ueq.d $fcc5, $f0, $f2
$ ./cstool/cstool -d mips "3e 05 22 46"
ERROR: invalid assembly code
$ ./cstool/cstool -d mips "3e 00 22 46"
 0  3e 00 22 46  c.le.d $f0, $f2
        ID: 168 (c)
        op_count: 2
                operands[0].type: REG = f0
                operands[1].type: REG = f2
        Groups: stdenc notmips32r6 notmips64r6 notfp64bit


Excerpt from busybox:

.text:00000001200B8EF4 D0 FF 52 10                 beq     $v0, $s2, loc_1200B8E38
.text:00000001200B8EF8 01 00 10 24                 li      $s0, 1
.text:00000001200B8EFC 32 C0 38 46                 c.eq.d  $f24, $f24          <== OK
.text:00000001200B8F00 06 00 01 45                 bc1t    loc_1200B8F1C
.text:00000001200B8F04 32 02 20 46                 c.eq.d  $fcc2, $f0, $f0     <== ERROR
.text:00000001200B8F08 32 03 20 46                 c.eq.d  $fcc3, $f0, $f0
.text:00000001200B8F0C 01 00 10 24                 li      $s0, 1
.text:00000001200B8F10 01 80 0C 00                 movf    $s0, $zero, $fcc3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions