Skip to content

Commit

Permalink
vector: disassemble: Let operand ordering be vd, [vr]s1, vs2 to vecto…
Browse files Browse the repository at this point in the history
…r integer multiply-add instructions
  • Loading branch information
YenHaoChen committed Sep 2, 2024
1 parent 3c5b1bb commit d398872
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions disasm/disasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,21 @@ static void NOINLINE add_vector_vv_insn(disassembler_t* d, const char* name, uin
d->add_insn(new disasm_insn_t(name, match, mask, {&vd, &vs2, &vs1, opt, &vm}));
}

static void NOINLINE add_vector_multiplyadd_vv_insn(disassembler_t* d, const char* name, uint32_t match, uint32_t mask)
{
d->add_insn(new disasm_insn_t(name, match, mask, {&vd, &vs1, &vs2, opt, &vm}));
}

static void NOINLINE add_vector_vx_insn(disassembler_t* d, const char* name, uint32_t match, uint32_t mask)
{
d->add_insn(new disasm_insn_t(name, match, mask, {&vd, &vs2, &xrs1, opt, &vm}));
}

static void NOINLINE add_vector_multiplyadd_vx_insn(disassembler_t* d, const char* name, uint32_t match, uint32_t mask)
{
d->add_insn(new disasm_insn_t(name, match, mask, {&vd, &xrs1, &vs2, opt, &vm}));
}

static void NOINLINE add_vector_vf_insn(disassembler_t* d, const char* name, uint32_t match, uint32_t mask)
{
d->add_insn(new disasm_insn_t(name, match, mask, {&vd, &vs2, &frs1, opt, &vm}));
Expand Down Expand Up @@ -1642,7 +1652,9 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)

#define DEFINE_VECTOR_V(code) add_vector_v_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_VV(code) add_vector_vv_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_MULTIPLYADD_VV(code) add_vector_multiplyadd_vv_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_VX(code) add_vector_vx_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_MULTIPLYADD_VX(code) add_vector_multiplyadd_vx_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_VF(code) add_vector_vf_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_VI(code) add_vector_vi_insn(this, #code, match_##code, mask_##code)
#define DEFINE_VECTOR_VIU(code) add_vector_viu_insn(this, #code, match_##code, mask_##code)
Expand All @@ -1659,6 +1671,10 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)
DEFINE_VECTOR_VV(name##_vv); \
DEFINE_VECTOR_VX(name##_vx)

#define DISASM_OPIV_MULTIPLYADD_VX__INSN(name, sign) \
DEFINE_VECTOR_MULTIPLYADD_VV(name##_vv); \
DEFINE_VECTOR_MULTIPLYADD_VX(name##_vx)

#define DISASM_OPIV__XI_INSN(name, sign) \
DEFINE_VECTOR_VX(name##_vx); \
if (sign) \
Expand All @@ -1678,6 +1694,8 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)

#define DISASM_OPIV__X__INSN(name, sign) DEFINE_VECTOR_VX(name##_vx)

#define DISASM_OPIV_MULTIPLYADD__X__INSN(name, sign) DEFINE_VECTOR_MULTIPLYADD_VX(name##_vx)

#define DEFINE_VECTOR_VVM(name) \
add_vector_vvm_insn(this, #name, match_##name, mask_##name | mask_vm)

Expand Down Expand Up @@ -1821,10 +1839,10 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)
DISASM_OPIV_VX__INSN(vmul, 1);
DISASM_OPIV_VX__INSN(vmulhsu, 0);
DISASM_OPIV_VX__INSN(vmulh, 1);
DISASM_OPIV_VX__INSN(vmadd, 1);
DISASM_OPIV_VX__INSN(vnmsub, 1);
DISASM_OPIV_VX__INSN(vmacc, 1);
DISASM_OPIV_VX__INSN(vnmsac, 1);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vmadd, 1);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vnmsub, 1);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vmacc, 1);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vnmsac, 1);

//0b11_0000
DISASM_OPIV_VX__INSN(vwaddu, 0);
Expand All @@ -1838,10 +1856,10 @@ void disassembler_t::add_instructions(const isa_parser_t* isa)
DISASM_OPIV_VX__INSN(vwmulu, 0);
DISASM_OPIV_VX__INSN(vwmulsu, 0);
DISASM_OPIV_VX__INSN(vwmul, 1);
DISASM_OPIV_VX__INSN(vwmaccu, 0);
DISASM_OPIV_VX__INSN(vwmacc, 1);
DISASM_OPIV__X__INSN(vwmaccus, 1);
DISASM_OPIV_VX__INSN(vwmaccsu, 0);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vwmaccu, 0);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vwmacc, 1);
DISASM_OPIV_MULTIPLYADD__X__INSN(vwmaccus, 1);
DISASM_OPIV_MULTIPLYADD_VX__INSN(vwmaccsu, 0);

#undef DISASM_OPIV_VXI_INSN
#undef DISASM_OPIV_VX__INSN
Expand Down

0 comments on commit d398872

Please sign in to comment.