Skip to content

Commit

Permalink
Implement "transpose matrix register"
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 20, 2024
1 parent d2e4eca commit dadad6b
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 1,942 deletions.
1,937 changes: 1 addition & 1,936 deletions asdf.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions cplusplus/include/generated/OperandType_enum_class.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions include/generated/InstrDescriptor_Descriptors_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/OperandType_enum.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/OperandType_function_declarations.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/instrOpercandCallbacks_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rabbitizer/OperandType.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/src/operand_type_enum.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/instructions/RabbitizerInstrDescriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,15 @@ bool RabbitizerInstrDescriptor_hasOperandAlias(const RabbitizerInstrDescriptor *
case RAB_OPERAND_r4000allegrex_mp_vs:
case RAB_OPERAND_r4000allegrex_mp_vt:
case RAB_OPERAND_r4000allegrex_mp_vd:
case RAB_OPERAND_r4000allegrex_mp_vs_transpose:
case RAB_OPERAND_r4000allegrex_mt_vs:
case RAB_OPERAND_r4000allegrex_mt_vt:
case RAB_OPERAND_r4000allegrex_mt_vd:
case RAB_OPERAND_r4000allegrex_mt_vs_transpose:
case RAB_OPERAND_r4000allegrex_mq_vs:
case RAB_OPERAND_r4000allegrex_mq_vt:
case RAB_OPERAND_r4000allegrex_mq_vd:
case RAB_OPERAND_r4000allegrex_mq_vs_transpose:
case RAB_OPERAND_r4000allegrex_cop2cs:
case RAB_OPERAND_r4000allegrex_cop2cd:
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ void RabbitizerInstruction_blankOut(RabbitizerInstruction *self) {
case RAB_OPERAND_r4000allegrex_mp_vs:
case RAB_OPERAND_r4000allegrex_mt_vs:
case RAB_OPERAND_r4000allegrex_mq_vs:
case RAB_OPERAND_r4000allegrex_mp_vs_transpose:
case RAB_OPERAND_r4000allegrex_mt_vs_transpose:
case RAB_OPERAND_r4000allegrex_mq_vs_transpose:
self->word = RAB_INSTR_R4000ALLEGREX_PACK_vs(self->word, 0);
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ uint32_t RabbitizerInstruction_getValidBits(const RabbitizerInstruction *self) {
case RAB_OPERAND_r4000allegrex_mp_vs:
case RAB_OPERAND_r4000allegrex_mt_vs:
case RAB_OPERAND_r4000allegrex_mq_vs:
case RAB_OPERAND_r4000allegrex_mp_vs_transpose:
case RAB_OPERAND_r4000allegrex_mt_vs_transpose:
case RAB_OPERAND_r4000allegrex_mq_vs_transpose:
validbits = RAB_INSTR_R4000ALLEGREX_PACK_vs(validbits, ~0);
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ size_t RabbitizerOperandType_process_r4000allegrex_mp_vd(const RabbitizerInstruc
return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_mp_vs_transpose(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
// For whatever reason the transpose just toggles bit 5, no clue why.
const char *reg = RabbitizerRegister_getNameR4000AllegrexM2x2(RAB_INSTR_R4000ALLEGREX_GET_vs(self) ^ 0x20);

RABUTILS_BUFFER_CPY(dst, totalSize, reg);

return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_mt_vs(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
Expand Down Expand Up @@ -242,6 +254,17 @@ size_t RabbitizerOperandType_process_r4000allegrex_mt_vd(const RabbitizerInstruc
return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_mt_vs_transpose(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameR4000AllegrexM3x3(RAB_INSTR_R4000ALLEGREX_GET_vs(self) ^ 0x20);

RABUTILS_BUFFER_CPY(dst, totalSize, reg);

return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_mq_vs(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
Expand Down Expand Up @@ -275,6 +298,17 @@ size_t RabbitizerOperandType_process_r4000allegrex_mq_vd(const RabbitizerInstruc
return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_mq_vs_transpose(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
const char *reg = RabbitizerRegister_getNameR4000AllegrexM4x4(RAB_INSTR_R4000ALLEGREX_GET_vs(self) ^ 0x20);

RABUTILS_BUFFER_CPY(dst, totalSize, reg);

return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_cop2cs(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
Expand Down
6 changes: 3 additions & 3 deletions tables/tables/instr_id/r4000allegrex/r4000allegrex_vfpu6.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ vmmul.p

RABBITIZER_DEF_INSTR_ID_ALTNAME(
r4000allegrex, 0x00 << 2 | 0x1, vmmul_p, vmmul.p,
.operands={RAB_OPERAND_r4000allegrex_mp_vd, RAB_OPERAND_r4000allegrex_mp_vs, RAB_OPERAND_r4000allegrex_mp_vt},
.operands={RAB_OPERAND_r4000allegrex_mp_vd, RAB_OPERAND_r4000allegrex_mp_vs_transpose, RAB_OPERAND_r4000allegrex_mp_vt},
.instrType=RABBITIZER_INSTR_TYPE_R
) // Multiply Pair x Pair Matrix

Expand All @@ -36,7 +36,7 @@ vmmul.t

RABBITIZER_DEF_INSTR_ID_ALTNAME(
r4000allegrex, 0x00 << 2 | 0x2, vmmul_t, vmmul.t,
.operands={RAB_OPERAND_r4000allegrex_mt_vd, RAB_OPERAND_r4000allegrex_mt_vs, RAB_OPERAND_r4000allegrex_mt_vt},
.operands={RAB_OPERAND_r4000allegrex_mt_vd, RAB_OPERAND_r4000allegrex_mt_vs_transpose, RAB_OPERAND_r4000allegrex_mt_vt},
.instrType=RABBITIZER_INSTR_TYPE_R
) // Multiply Triple x Triple Matrix

Expand All @@ -49,7 +49,7 @@ vmmul.q

RABBITIZER_DEF_INSTR_ID_ALTNAME(
r4000allegrex, 0x00 << 2 | 0x3, vmmul_q, vmmul.q,
.operands={RAB_OPERAND_r4000allegrex_mq_vd, RAB_OPERAND_r4000allegrex_mq_vs, RAB_OPERAND_r4000allegrex_mq_vt},
.operands={RAB_OPERAND_r4000allegrex_mq_vd, RAB_OPERAND_r4000allegrex_mq_vs_transpose, RAB_OPERAND_r4000allegrex_mq_vt},
.instrType=RABBITIZER_INSTR_TYPE_R
) // Multiply Quad x Quad Matrix

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@
RAB_DEF_OPERAND(r4000allegrex, mp_vs)
RAB_DEF_OPERAND(r4000allegrex, mp_vt)
RAB_DEF_OPERAND(r4000allegrex, mp_vd)
RAB_DEF_OPERAND(r4000allegrex, mp_vs_transpose)

// matrix triple
RAB_DEF_OPERAND(r4000allegrex, mt_vs)
RAB_DEF_OPERAND(r4000allegrex, mt_vt)
RAB_DEF_OPERAND(r4000allegrex, mt_vd)
RAB_DEF_OPERAND(r4000allegrex, mt_vs_transpose)

// matrix quad
RAB_DEF_OPERAND(r4000allegrex, mq_vs)
RAB_DEF_OPERAND(r4000allegrex, mq_vt)
RAB_DEF_OPERAND(r4000allegrex, mq_vd)
RAB_DEF_OPERAND(r4000allegrex, mq_vs_transpose)

RAB_DEF_OPERAND(r4000allegrex, cop2cs)
RAB_DEF_OPERAND(r4000allegrex, cop2cd)
Expand Down

0 comments on commit dadad6b

Please sign in to comment.