Skip to content

Commit

Permalink
placeholders for rp and wp operands
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 21, 2024
1 parent 450acd1 commit 9cb018f
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 51 deletions.
60 changes: 25 additions & 35 deletions asdf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,82 @@ tests/c/instruction_checks/r3000gte_disasm.c: 0 errors out of 65 entries. 100.00

tests/c/instruction_checks/r4000allegrex_disasm.c: 0 errors out of 73 entries. 100.00% correct.

Error on word '0xDC000000'. Expected 'vpfxs X, X, X, X', got 'vpfxs , , , '
Error on word '0xDC000001'. Expected 'vpfxs Y, X, X, X', got 'vpfxs X, X, X, Y'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC000001'. Expected 'vpfxs Y, X, X, X', got 'vpfxs , , , '
Error on word '0xDC000010'. Expected 'vpfxs X, X, Y, X', got 'vpfxs X, X, X, -X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC000010'. Expected 'vpfxs X, X, Y, X', got 'vpfxs , , , '
Error on word '0xDC000100'. Expected 'vpfxs |X|, X, X, X', got 'vpfxs X, X, |X|, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC000100'. Expected 'vpfxs |X|, X, X, X', got 'vpfxs , , , '
Error on word '0xDC001000'. Expected 'vpfxs 0, X, X, X', got 'vpfxs X, Y, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC001000'. Expected 'vpfxs 0, X, X, X', got 'vpfxs , , , '
Error on word '0xDC010000'. Expected 'vpfxs -X, X, X, X', got 'vpfxs X, -X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC010000'. Expected 'vpfxs -X, X, X, X', got 'vpfxs , , , '
Error on word '0xDC100000'. Expected 'vpfxs X, X, X, X', got 'vpfxs |X|, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC100000'. Expected 'vpfxs X, X, X, X', got 'vpfxs , , , '
Error on word '0xDC800000'. Expected 'vpfxs X, X, X, X', got 'vpfxs 32, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDC800000'. Expected 'vpfxs X, X, X, X', got 'vpfxs , , , '
Error on word '0xDCF00000'. Expected 'vpfxs X, X, X, X', got 'vpfxs 60, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDCF00000'. Expected 'vpfxs X, X, X, X', got 'vpfxs , , , '
Error on word '0xDD000001'. Expected 'vpfxt Y, X, X, X', got 'vpfxt X, X, X, Y'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD000000'. Expected 'vpfxt X, X, X, X', got 'vpfxt , , , '
Error on word '0xDD000010'. Expected 'vpfxt X, X, Y, X', got 'vpfxt X, X, X, -X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD000001'. Expected 'vpfxt Y, X, X, X', got 'vpfxt , , , '
Error on word '0xDD000100'. Expected 'vpfxt |X|, X, X, X', got 'vpfxt X, X, |X|, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD000010'. Expected 'vpfxt X, X, Y, X', got 'vpfxt , , , '
Error on word '0xDD001000'. Expected 'vpfxt 0, X, X, X', got 'vpfxt X, Y, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD000100'. Expected 'vpfxt |X|, X, X, X', got 'vpfxt , , , '
Error on word '0xDD010000'. Expected 'vpfxt -X, X, X, X', got 'vpfxt X, -X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD001000'. Expected 'vpfxt 0, X, X, X', got 'vpfxt , , , '
Error on word '0xDD100000'. Expected 'vpfxt X, X, X, X', got 'vpfxt |X|, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD010000'. Expected 'vpfxt -X, X, X, X', got 'vpfxt , , , '
Error on word '0xDD800000'. Expected 'vpfxt X, X, X, X', got 'vpfxt 32, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD100000'. Expected 'vpfxt X, X, X, X', got 'vpfxt , , , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDD800000'. Expected 'vpfxt X, X, X, X', got 'vpfxt , , , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDDF00000'. Expected 'vpfxt X, X, X, X', got 'vpfxt , , , '
Error on word '0xDDF00000'. Expected 'vpfxt X, X, X, X', got 'vpfxt 60, X, X, X'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'
Expand All @@ -99,42 +89,42 @@ Error on word '0xDE000000'. Expected 'vpfxd , , ,', got 'vpfxd , , ,
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE000001'. Expected 'vpfxd 0, , ,', got 'vpfxd , , , '
Error on word '0xDE000001'. Expected 'vpfxd 0, , ,', got 'vpfxd , , , 0'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE000010'. Expected 'vpfxd , ,0 ,', got 'vpfxd , , , '
Error on word '0xDE000010'. Expected 'vpfxd , ,0 ,', got 'vpfxd , , , 16'
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE000100'. Expected 'vpfxd M, , ,', got 'vpfxd , , , '
Error on word '0xDE000100'. Expected 'vpfxd M, , ,', got 'vpfxd , , 4, '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE001000'. Expected 'vpfxd , , ,', got 'vpfxd , , , '
Error on word '0xDE001000'. Expected 'vpfxd , , ,', got 'vpfxd , 0, , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE010000'. Expected 'vpfxd , , ,', got 'vpfxd , , , '
Error on word '0xDE010000'. Expected 'vpfxd , , ,', got 'vpfxd , 16, , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE100000'. Expected 'vpfxd , , ,', got 'vpfxd , , , '
Error on word '0xDE100000'. Expected 'vpfxd , , ,', got 'vpfxd 4, , , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDE800000'. Expected 'vpfxd , , ,', got 'vpfxd , , , '
Error on word '0xDE800000'. Expected 'vpfxd , , ,', got 'vpfxd 32, , , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'

Error on word '0xDEF00000'. Expected 'vpfxd , , ,', got 'vpfxd , , , '
Error on word '0xDEF00000'. Expected 'vpfxd , , ,', got 'vpfxd 60, , , '
File: tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
InstrIdType: 'R4000ALLEGREX_VFPU5'
gnuMode 'true'
Expand All @@ -159,5 +149,5 @@ Error on word '0xDFC0F000'. Expected 'vfim.s S002, -8192.0', got 'vfim.s
InstrIdType: 'R4000ALLEGREX_VFPU5_FMT3'
gnuMode 'true'

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

Original file line number Diff line number Diff line change
Expand Up @@ -1001,13 +1001,54 @@ size_t RabbitizerOperandType_process_r4000allegrex_q_vrot_code(const RabbitizerI
return totalSize;
}

static const char *const source_target_prefix_instruction_formats[32] = {
[0] = "X", //
[1] = "Y", //
[2] = "Z", //
[3] = "W", //
[4] = "|X|", //
[5] = "|Y|", //
[6] = "|Z|", //
[7] = "|W|", //
[8] = "0", //
[9] = "1", //
[10] = "2", //
[11] = "1/2", //
[12] = "3", //
[13] = "1/3", //
[14] = "1/4", //
[15] = "1/6", //
[16] = "-X", //
[17] = "-Y", //
[18] = "-Z", //
[19] = "-W", //
[20] = "-|X|", //
[21] = "-|Y|", //
[22] = "-|Z|", //
[23] = "-|W|", //
[24] = "-0", //
[25] = "-1", //
[26] = "-2", //
[27] = "-1/2", //
[28] = "-3", //
[29] = "-1/3", //
[30] = "-1/4", //
[31] = "-1/6", //
};

size_t RabbitizerOperandType_process_r4000allegrex_rpx(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_rpx(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(source_target_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, source_target_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1016,9 +1057,15 @@ size_t RabbitizerOperandType_process_r4000allegrex_rpy(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_rpy(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(source_target_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, source_target_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1027,9 +1074,15 @@ size_t RabbitizerOperandType_process_r4000allegrex_rpz(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_rpz(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(source_target_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, source_target_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1038,20 +1091,39 @@ size_t RabbitizerOperandType_process_r4000allegrex_rpw(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_rpw(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(source_target_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, source_target_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}

static const char *const destination_prefix_instruction_formats[] = {
[0] = "", //
[1] = "0", //
[2] = "1", //
[3] = "M", //
};

size_t RabbitizerOperandType_process_r4000allegrex_wpx(const RabbitizerInstruction *self, char *dst,
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_wpx(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(destination_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, destination_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1060,9 +1132,15 @@ size_t RabbitizerOperandType_process_r4000allegrex_wpy(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_wpy(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(destination_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, destination_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1071,9 +1149,15 @@ size_t RabbitizerOperandType_process_r4000allegrex_wpz(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_wpz(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(destination_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, destination_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}
Expand All @@ -1082,9 +1166,15 @@ size_t RabbitizerOperandType_process_r4000allegrex_wpw(const RabbitizerInstructi
UNUSED const char *immOverride,
UNUSED size_t immOverrideLength) {
size_t totalSize = 0;
uint32_t temp = RAB_INSTR_R4000ALLEGREX_GET_wpw(self);

(void)self;
(void)dst;
if (temp < ARRAY_COUNT(destination_prefix_instruction_formats)) {
RABUTILS_BUFFER_CPY(dst, totalSize, destination_prefix_instruction_formats[temp]);
} else {
// Workaround to avoid crashing.
// TODO: Add some logic to disassemble as a .word if this happens
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", temp);
}

return totalSize;
}

0 comments on commit 9cb018f

Please sign in to comment.