Skip to content

Commit

Permalink
Implement vrot code operand
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 21, 2024
1 parent ea911ff commit 450acd1
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 23 deletions.
20 changes: 19 additions & 1 deletion adsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,22 @@ def do_vmmul():
print(f" .word 0x{VFPU6:08X} | 0x{i << 23:08X} | 0x{VT:08X} | 0x{t << 15:08X} | 0x{VS:08X} | 0x{p << 7:08X} | 0x{VD:08X}")
func_end("vmmul_test")

do_vmmul()
def do_vrot():
func_start("vrot_test")
print(" # vrot")

VS = vs(0)
VD = vd(31)

i = 7
k = 1

for p in range(1 << 1):
for t in range(1 << 1):
if p == 0 and t == 0:
continue
for j in range(1 << 5):
print(f" .word 0x{VFPU6:08X} | 0x{k<<21:08X} | 0x{i << 23:08X} | 0x{j<<16:08X} | 0x{t << 15:08X} | 0x{VS:08X} | 0x{p << 7:08X} | 0x{VD:08X}")
func_end("vrot_test")

do_vrot()
17 changes: 1 addition & 16 deletions asdf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,5 @@ Error on word '0xDFC0F000'. Expected 'vfim.s S002, -8192.0', got 'vfim.s
InstrIdType: 'R4000ALLEGREX_VFPU5_FMT3'
gnuMode 'true'

Error on word '0xF3A010C0'. Expected 'vrot.p C002, S400, [C,S]', got 'vrot.p C002, S400, '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU6_FMT7'
gnuMode 'true'

Error on word '0xF3A09040'. Expected 'vrot.t C001, S400, [C,S,S]', got 'vrot.t C001, S400, '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU6_FMT7'
gnuMode 'true'

Error on word '0xF3A090C0'. Expected 'vrot.q C002, S400, [C,S,S,S]', got 'vrot.q C002, S400, '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU6_FMT7'
gnuMode 'true'

tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: 34 errors out of 5322 entries. 99.36% correct.
tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c: 31 errors out of 5322 entries. 99.42% correct.

Original file line number Diff line number Diff line change
Expand Up @@ -869,32 +869,134 @@ size_t RabbitizerOperandType_process_r4000allegrex_float16(const RabbitizerInstr
size_t RabbitizerOperandType_process_r4000allegrex_p_vrot_code(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
static const char *const mnemonics[32] = {
[0] = "[C,S]", //
[1] = "[S,C]", //
[2] = "[S,0]", //
[3] = "[S,0]", //
[4] = "[C,S]", //
[5] = "[S,C]", //
[6] = "[0,S]", //
[7] = "[0,S]", //
[8] = "[C,0]", //
[9] = "[0,C]", //
[10] = "[S,S]", //
[11] = "[0,0]", //
[12] = "[C,0]", //
[13] = "[0,C]", //
[14] = "[0,0]", //
[15] = "[S,S]", //
[16] = "[C,-S]", //
[17] = "[-S,C]", //
[18] = "[-S,0]", //
[19] = "[-S,0]", //
[20] = "[C,-S]", //
[21] = "[-S,C]", //
[22] = "[0,-S]", //
[23] = "[0,-S]", //
[24] = "[C,0]", //
[25] = "[0,C]", //
[26] = "[-S,-S]", //
[27] = "[0,0]", //
[28] = "[C,0]", //
[29] = "[0,C]", //
[30] = "[0,0]", //
[31] = "[-S,-S]", //
};
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_vrot_code(self);

(void)self;
(void)dst;
RABUTILS_BUFFER_CPY(dst, totalSize, mnemonics[temp]);

return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_t_vrot_code(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
static const char *const mnemonics[32] = {
[0] = "[C,S,S]", //
[1] = "[S,C,0]", //
[2] = "[S,0,C]", //
[3] = "[S,0,0]", //
[4] = "[C,S,0]", //
[5] = "[S,C,S]", //
[6] = "[0,S,C]", //
[7] = "[0,S,0]", //
[8] = "[C,0,S]", //
[9] = "[0,C,S]", //
[10] = "[S,S,C]", //
[11] = "[0,0,S]", //
[12] = "[C,0,0]", //
[13] = "[0,C,0]", //
[14] = "[0,0,C]", //
[15] = "[S,S,S]", //
[16] = "[C,-S,-S]", //
[17] = "[-S,C,0]", //
[18] = "[-S,0,C]", //
[19] = "[-S,0,0]", //
[20] = "[C,-S,0]", //
[21] = "[-S,C,-S]", //
[22] = "[0,-S,C]", //
[23] = "[0,-S,0]", //
[24] = "[C,0,-S]", //
[25] = "[0,C,-S]", //
[26] = "[-S,-S,C]", //
[27] = "[0,0,-S]", //
[28] = "[C,0,0]", //
[29] = "[0,C,0]", //
[30] = "[0,0,C]", //
[31] = "[-S,-S,-S]", //
};
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_vrot_code(self);

(void)self;
(void)dst;
RABUTILS_BUFFER_CPY(dst, totalSize, mnemonics[temp]);

return totalSize;
}

size_t RabbitizerOperandType_process_r4000allegrex_q_vrot_code(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
static const char *const mnemonics[32] = {
[0] = "[C,S,S,S]", //
[1] = "[S,C,0,0]", //
[2] = "[S,0,C,0]", //
[3] = "[S,0,0,C]", //
[4] = "[C,S,0,0]", //
[5] = "[S,C,S,S]", //
[6] = "[0,S,C,0]", //
[7] = "[0,S,0,C]", //
[8] = "[C,0,S,0]", //
[9] = "[0,C,S,0]", //
[10] = "[S,S,C,S]", //
[11] = "[0,0,S,C]", //
[12] = "[C,0,0,S]", //
[13] = "[0,C,0,S]", //
[14] = "[0,0,C,S]", //
[15] = "[S,S,S,C]", //
[16] = "[C,-S,-S,-S]", //
[17] = "[-S,C,0,0]", //
[18] = "[-S,0,C,0]", //
[19] = "[-S,0,0,C]", //
[20] = "[C,-S,0,0]", //
[21] = "[-S,C,-S,-S]", //
[22] = "[0,-S,C,0]", //
[23] = "[0,-S,0,C]", //
[24] = "[C,0,-S,0]", //
[25] = "[0,C,-S,0]", //
[26] = "[-S,-S,C,-S]", //
[27] = "[0,0,-S,C]", //
[28] = "[C,0,0,-S]", //
[29] = "[0,C,0,-S]", //
[30] = "[0,0,C,-S]", //
[31] = "[-S,-S,-S,C]", //
};
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_vrot_code(self);

(void)self;
(void)dst;
RABUTILS_BUFFER_CPY(dst, totalSize, mnemonics[temp]);

return totalSize;
}
Expand Down

0 comments on commit 450acd1

Please sign in to comment.