From ef2598d2c7dd8197771b97fb8fcd3b51d63b9d83 Mon Sep 17 00:00:00 2001 From: Angie Date: Mon, 15 Jul 2024 16:05:53 -0400 Subject: [PATCH] Fix `pmfhl` and `pmthl` missing the `.fmt` specifier --- CHANGELOG.md | 4 ++ .../generated/InstrIdType_enum_class.hpp | 2 + .../include/generated/UniqueId_enum_class.hpp | 8 +++- .../InstrDescriptor_Descriptors_array.h | 8 +++- include/generated/InstrIdType_Names_array.h | 2 + include/generated/InstrIdType_enum.h | 2 + include/generated/InstrId_Names_array.h | 8 +++- include/generated/InstrId_enum.h | 8 +++- rabbitizer/InstrId.pyi | 8 +++- rabbitizer/InstrIdType.pyi | 2 + rust/src/instr_id_enum.rs | 8 +++- rust/src/instr_id_type_enum.rs | 2 + ...bbitizerInstructionR5900_ProcessUniqueId.c | 29 +++++++++++ .../instr_id/RabbitizerInstrId_r5900.inc | 2 + tables/tables/instr_id/r5900/r5900_mmi.inc | 22 +++------ .../tables/instr_id/r5900/r5900_mmi_pmfhl.inc | 48 +++++++++++++++++++ .../tables/instr_id/r5900/r5900_mmi_pmthl.inc | 24 ++++++++++ .../instr_id_types/InstrIdType_r5900.inc | 2 + tests/c/instruction_checks/r5900_disasm.c | 24 ++++++++++ tests/run_instruction_checks.sh | 1 + 20 files changed, 187 insertions(+), 27 deletions(-) create mode 100644 tables/tables/instr_id/r5900/r5900_mmi_pmfhl.inc create mode 100644 tables/tables/instr_id/r5900/r5900_mmi_pmthl.inc create mode 100644 tests/c/instruction_checks/r5900_disasm.c diff --git a/CHANGELOG.md b/CHANGELOG.md index eaa969e0..1185b2b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implement the `rfe` ("Restore From Exception") instruction. +### Fixed + +- Fix `pmfhl` and `pmthl` missing the `.fmt` specifier. + ## [1.11.1] - 2024-07-12 ### Added diff --git a/cplusplus/include/generated/InstrIdType_enum_class.hpp b/cplusplus/include/generated/InstrIdType_enum_class.hpp index 2453c441..a9a3e836 100644 --- a/cplusplus/include/generated/InstrIdType_enum_class.hpp +++ b/cplusplus/include/generated/InstrIdType_enum_class.hpp @@ -103,6 +103,8 @@ enum class IdType { R5900_MMI_1, R5900_MMI_2, R5900_MMI_3, + R5900_MMI_PMFHL, + R5900_MMI_PMTHL, ALL_MAX, }; diff --git a/cplusplus/include/generated/UniqueId_enum_class.hpp b/cplusplus/include/generated/UniqueId_enum_class.hpp index 5b15ddb0..a95e9f47 100644 --- a/cplusplus/include/generated/UniqueId_enum_class.hpp +++ b/cplusplus/include/generated/UniqueId_enum_class.hpp @@ -799,8 +799,6 @@ enum class UniqueId { r5900_divu1, r5900_madd1, r5900_maddu1, - r5900_pmfhl, - r5900_pmthl, r5900_psllh, r5900_psrlh, r5900_psrah, @@ -885,6 +883,12 @@ enum class UniqueId { r5900_pexch, r5900_pcpyh, r5900_pexcw, + r5900_pmfhl_lw, + r5900_pmfhl_uw, + r5900_pmfhl_slw, + r5900_pmfhl_lh, + r5900_pmfhl_sh, + r5900_pmthl_lw, r5900_ei, r5900_di, r5900_c1__sqrt_s, diff --git a/include/generated/InstrDescriptor_Descriptors_array.h b/include/generated/InstrDescriptor_Descriptors_array.h index ce9fa5d8..53d21a7f 100644 --- a/include/generated/InstrDescriptor_Descriptors_array.h +++ b/include/generated/InstrDescriptor_Descriptors_array.h @@ -799,8 +799,6 @@ const RabbitizerInstrDescriptor RabbitizerInstrDescriptor_Descriptors[] = { [RABBITIZER_INSTR_ID_r5900_divu1] = { .operands={RAB_OPERAND_cpu_zero, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_rt}, .readsRs=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_madd1] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_rt}, .modifiesRd=true, .readsRs=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_maddu1] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rs, RAB_OPERAND_cpu_rt}, .modifiesRd=true, .readsRs=true, .readsRt=true }, - [RABBITIZER_INSTR_ID_r5900_pmfhl] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, - [RABBITIZER_INSTR_ID_r5900_pmthl] = { .operands={RAB_OPERAND_cpu_rs}, .readsRs=true }, [RABBITIZER_INSTR_ID_r5900_psllh] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_sa}, .modifiesRd=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_psrlh] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_sa}, .modifiesRd=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_psrah] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_sa}, .modifiesRd=true, .readsRt=true }, @@ -885,6 +883,12 @@ const RabbitizerInstrDescriptor RabbitizerInstrDescriptor_Descriptors[] = { [RABBITIZER_INSTR_ID_r5900_pexch] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt}, .modifiesRd=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_pcpyh] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt}, .modifiesRd=true, .readsRt=true }, [RABBITIZER_INSTR_ID_r5900_pexcw] = { .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt}, .modifiesRd=true, .readsRt=true }, + [RABBITIZER_INSTR_ID_r5900_pmfhl_lw] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, + [RABBITIZER_INSTR_ID_r5900_pmfhl_uw] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, + [RABBITIZER_INSTR_ID_r5900_pmfhl_slw] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, + [RABBITIZER_INSTR_ID_r5900_pmfhl_lh] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, + [RABBITIZER_INSTR_ID_r5900_pmfhl_sh] = { .operands={RAB_OPERAND_cpu_rd}, .modifiesRd=true }, + [RABBITIZER_INSTR_ID_r5900_pmthl_lw] = { .operands={RAB_OPERAND_cpu_rs}, .readsRs=true }, [RABBITIZER_INSTR_ID_r5900_ei] = { .operands={0} }, [RABBITIZER_INSTR_ID_r5900_di] = { .operands={0} }, [RABBITIZER_INSTR_ID_r5900_c1__sqrt_s] = { .operands={RAB_OPERAND_cpu_copraw} }, diff --git a/include/generated/InstrIdType_Names_array.h b/include/generated/InstrIdType_Names_array.h index 574a9b82..06b0fa88 100644 --- a/include/generated/InstrIdType_Names_array.h +++ b/include/generated/InstrIdType_Names_array.h @@ -103,6 +103,8 @@ const char *RabInstrIdType_Names[] = { [RAB_INSTR_ID_TYPE_R5900_MMI_1] = "R5900" "_" "MMI_1", [RAB_INSTR_ID_TYPE_R5900_MMI_2] = "R5900" "_" "MMI_2", [RAB_INSTR_ID_TYPE_R5900_MMI_3] = "R5900" "_" "MMI_3", + [RAB_INSTR_ID_TYPE_R5900_MMI_PMFHL] = "R5900" "_" "MMI_PMFHL", + [RAB_INSTR_ID_TYPE_R5900_MMI_PMTHL] = "R5900" "_" "MMI_PMTHL", [RAB_INSTR_ID_TYPE_ALL_MAX] = "ALL" "_" "MAX", }; diff --git a/include/generated/InstrIdType_enum.h b/include/generated/InstrIdType_enum.h index 04a21191..aee529e6 100644 --- a/include/generated/InstrIdType_enum.h +++ b/include/generated/InstrIdType_enum.h @@ -103,6 +103,8 @@ typedef enum RabInstrIdType { RAB_INSTR_ID_TYPE_R5900_MMI_1, RAB_INSTR_ID_TYPE_R5900_MMI_2, RAB_INSTR_ID_TYPE_R5900_MMI_3, + RAB_INSTR_ID_TYPE_R5900_MMI_PMFHL, + RAB_INSTR_ID_TYPE_R5900_MMI_PMTHL, RAB_INSTR_ID_TYPE_ALL_MAX, } RabInstrIdType; diff --git a/include/generated/InstrId_Names_array.h b/include/generated/InstrId_Names_array.h index 97f0dddc..49f6aae0 100644 --- a/include/generated/InstrId_Names_array.h +++ b/include/generated/InstrId_Names_array.h @@ -799,8 +799,6 @@ const char *RabbitizerInstrId_Names[] = { [RABBITIZER_INSTR_ID_r5900_divu1] = "divu1", [RABBITIZER_INSTR_ID_r5900_madd1] = "madd1", [RABBITIZER_INSTR_ID_r5900_maddu1] = "maddu1", - [RABBITIZER_INSTR_ID_r5900_pmfhl] = "pmfhl", - [RABBITIZER_INSTR_ID_r5900_pmthl] = "pmthl", [RABBITIZER_INSTR_ID_r5900_psllh] = "psllh", [RABBITIZER_INSTR_ID_r5900_psrlh] = "psrlh", [RABBITIZER_INSTR_ID_r5900_psrah] = "psrah", @@ -885,6 +883,12 @@ const char *RabbitizerInstrId_Names[] = { [RABBITIZER_INSTR_ID_r5900_pexch] = "pexch", [RABBITIZER_INSTR_ID_r5900_pcpyh] = "pcpyh", [RABBITIZER_INSTR_ID_r5900_pexcw] = "pexcw", + [RABBITIZER_INSTR_ID_r5900_pmfhl_lw] = "pmfhl.lw", + [RABBITIZER_INSTR_ID_r5900_pmfhl_uw] = "pmfhl.uw", + [RABBITIZER_INSTR_ID_r5900_pmfhl_slw] = "pmfhl.slw", + [RABBITIZER_INSTR_ID_r5900_pmfhl_lh] = "pmfhl.lh", + [RABBITIZER_INSTR_ID_r5900_pmfhl_sh] = "pmfhl.sh", + [RABBITIZER_INSTR_ID_r5900_pmthl_lw] = "pmthl.lw", [RABBITIZER_INSTR_ID_r5900_ei] = "ei", [RABBITIZER_INSTR_ID_r5900_di] = "di", [RABBITIZER_INSTR_ID_r5900_c1__sqrt_s] = "c1", diff --git a/include/generated/InstrId_enum.h b/include/generated/InstrId_enum.h index 6e3f42be..6cba5e72 100644 --- a/include/generated/InstrId_enum.h +++ b/include/generated/InstrId_enum.h @@ -799,8 +799,6 @@ typedef enum RabbitizerInstrId { RABBITIZER_INSTR_ID_r5900_divu1, RABBITIZER_INSTR_ID_r5900_madd1, RABBITIZER_INSTR_ID_r5900_maddu1, - RABBITIZER_INSTR_ID_r5900_pmfhl, - RABBITIZER_INSTR_ID_r5900_pmthl, RABBITIZER_INSTR_ID_r5900_psllh, RABBITIZER_INSTR_ID_r5900_psrlh, RABBITIZER_INSTR_ID_r5900_psrah, @@ -885,6 +883,12 @@ typedef enum RabbitizerInstrId { RABBITIZER_INSTR_ID_r5900_pexch, RABBITIZER_INSTR_ID_r5900_pcpyh, RABBITIZER_INSTR_ID_r5900_pexcw, + RABBITIZER_INSTR_ID_r5900_pmfhl_lw, + RABBITIZER_INSTR_ID_r5900_pmfhl_uw, + RABBITIZER_INSTR_ID_r5900_pmfhl_slw, + RABBITIZER_INSTR_ID_r5900_pmfhl_lh, + RABBITIZER_INSTR_ID_r5900_pmfhl_sh, + RABBITIZER_INSTR_ID_r5900_pmthl_lw, RABBITIZER_INSTR_ID_r5900_ei, RABBITIZER_INSTR_ID_r5900_di, RABBITIZER_INSTR_ID_r5900_c1__sqrt_s, diff --git a/rabbitizer/InstrId.pyi b/rabbitizer/InstrId.pyi index e35d6ebc..40ea29bf 100644 --- a/rabbitizer/InstrId.pyi +++ b/rabbitizer/InstrId.pyi @@ -720,8 +720,6 @@ class InstrId: r5900_divu1: Enum r5900_madd1: Enum r5900_maddu1: Enum - r5900_pmfhl: Enum - r5900_pmthl: Enum r5900_psllh: Enum r5900_psrlh: Enum r5900_psrah: Enum @@ -806,6 +804,12 @@ class InstrId: r5900_pexch: Enum r5900_pcpyh: Enum r5900_pexcw: Enum + r5900_pmfhl_lw: Enum + r5900_pmfhl_uw: Enum + r5900_pmfhl_slw: Enum + r5900_pmfhl_lh: Enum + r5900_pmfhl_sh: Enum + r5900_pmthl_lw: Enum r5900_ei: Enum r5900_di: Enum r5900_c1__sqrt_s: Enum diff --git a/rabbitizer/InstrIdType.pyi b/rabbitizer/InstrIdType.pyi index f818c97d..54e3a006 100644 --- a/rabbitizer/InstrIdType.pyi +++ b/rabbitizer/InstrIdType.pyi @@ -104,4 +104,6 @@ class InstrIdType: R5900_MMI_1: Enum R5900_MMI_2: Enum R5900_MMI_3: Enum + R5900_MMI_PMFHL: Enum + R5900_MMI_PMTHL: Enum ALL_MAX: Enum diff --git a/rust/src/instr_id_enum.rs b/rust/src/instr_id_enum.rs index 6100f97d..b60978d0 100644 --- a/rust/src/instr_id_enum.rs +++ b/rust/src/instr_id_enum.rs @@ -799,8 +799,6 @@ pub enum InstrId { r5900_divu1, r5900_madd1, r5900_maddu1, - r5900_pmfhl, - r5900_pmthl, r5900_psllh, r5900_psrlh, r5900_psrah, @@ -885,6 +883,12 @@ pub enum InstrId { r5900_pexch, r5900_pcpyh, r5900_pexcw, + r5900_pmfhl_lw, + r5900_pmfhl_uw, + r5900_pmfhl_slw, + r5900_pmfhl_lh, + r5900_pmfhl_sh, + r5900_pmthl_lw, r5900_ei, r5900_di, r5900_c1__sqrt_s, diff --git a/rust/src/instr_id_type_enum.rs b/rust/src/instr_id_type_enum.rs index baa8b6bf..fcbe4900 100644 --- a/rust/src/instr_id_type_enum.rs +++ b/rust/src/instr_id_type_enum.rs @@ -103,5 +103,7 @@ pub enum InstrIdType { R5900_MMI_1, R5900_MMI_2, R5900_MMI_3, + R5900_MMI_PMFHL, + R5900_MMI_PMTHL, ALL_MAX, } diff --git a/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c b/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c index e9d07af5..d7f003cd 100644 --- a/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c +++ b/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c @@ -286,6 +286,28 @@ void RabbitizerInstructionR5900_processUniqueId_MMI_3(RabbitizerInstruction *sel } } +void RabbitizerInstructionR5900_processUniqueId_MMI_PMFHL(RabbitizerInstruction *self) { + uint32_t function = RAB_INSTR_R5900_GET_mmi_function(self); + + self->_mandatorybits = RAB_INSTR_R5900_PACK_mmi_function(self->_mandatorybits, function); + self->instrIdType = RAB_INSTR_ID_TYPE_R5900_MMI_PMFHL; + + switch (function) { +#include "tables/instr_id/r5900/r5900_mmi_pmfhl.inc" + } +} + +void RabbitizerInstructionR5900_processUniqueId_MMI_PMTHL(RabbitizerInstruction *self) { + uint32_t function = RAB_INSTR_R5900_GET_mmi_function(self); + + self->_mandatorybits = RAB_INSTR_R5900_PACK_mmi_function(self->_mandatorybits, function); + self->instrIdType = RAB_INSTR_ID_TYPE_R5900_MMI_PMTHL; + + switch (function) { +#include "tables/instr_id/r5900/r5900_mmi_pmthl.inc" + } +} + void RabbitizerInstructionR5900_processUniqueId_MMI(RabbitizerInstruction *self) { uint32_t function = RAB_INSTR_GET_function(self); @@ -307,6 +329,13 @@ void RabbitizerInstructionR5900_processUniqueId_MMI(RabbitizerInstruction *self) case 0x29: RabbitizerInstructionR5900_processUniqueId_MMI_3(self); break; + + case 0x30: + RabbitizerInstructionR5900_processUniqueId_MMI_PMFHL(self); + break; + case 0x31: + RabbitizerInstructionR5900_processUniqueId_MMI_PMTHL(self); + break; } self->descriptor = &RabbitizerInstrDescriptor_Descriptors[self->uniqueId]; diff --git a/tables/tables/instr_id/RabbitizerInstrId_r5900.inc b/tables/tables/instr_id/RabbitizerInstrId_r5900.inc index f9203488..3a85e544 100644 --- a/tables/tables/instr_id/RabbitizerInstrId_r5900.inc +++ b/tables/tables/instr_id/RabbitizerInstrId_r5900.inc @@ -16,6 +16,8 @@ #include "r5900/r5900_mmi_1.inc" #include "r5900/r5900_mmi_2.inc" #include "r5900/r5900_mmi_3.inc" + #include "r5900/r5900_mmi_pmfhl.inc" + #include "r5900/r5900_mmi_pmthl.inc" #include "r5900/r5900_cop0_tlb.inc" diff --git a/tables/tables/instr_id/r5900/r5900_mmi.inc b/tables/tables/instr_id/r5900/r5900_mmi.inc index 32668337..d26ba137 100644 --- a/tables/tables/instr_id/r5900/r5900_mmi.inc +++ b/tables/tables/instr_id/r5900/r5900_mmi.inc @@ -12,11 +12,15 @@ 011 | MULT1 | MULTU1| DIV1 | DIVU1 | --- | --- | --- | --- | 100 | MADD1 | MADDU1| --- | --- | --- | --- | --- | --- | 101 | *3 | *4 | --- | --- | --- | --- | --- | --- | -110 | PMFHL | PMTHL | --- | --- | PSLLH | --- | PSRLH | PSRAH | +110 | *5 | *6 | --- | --- | PSLLH | --- | PSRLH | PSRAH | 111 | --- | --- | --- | --- | PSLLW | --- | PSRLW | PSRAW | hi |-------|-------|-------|-------|-------|-------|-------|-------| - *1 = MMI0 list *2 = MMI2 list - *3 = MMI1 list *4 = MMI3 list + *1 = MMI0 list + *2 = MMI2 list + *3 = MMI1 list + *4 = MMI3 list + *5 = PMFHL list + *6 = PMTHL list */ RABBITIZER_DEF_INSTR_ID( @@ -103,18 +107,6 @@ .readsRt=true ) // Multiply-ADD Unsigned word pipeline 1 - // TODO: check this two instruction, it is supposed to have an extra .fmt - RABBITIZER_DEF_INSTR_ID( - r5900, 0x30, pmfhl, - .operands={RAB_OPERAND_cpu_rd}, - .modifiesRd=true - ) // Parallel Move From Hi/Lo register - RABBITIZER_DEF_INSTR_ID( - r5900, 0x31, pmthl, - .operands={RAB_OPERAND_cpu_rs}, - .readsRs=true - ) // Parallel Move To Hi/Lo register - RABBITIZER_DEF_INSTR_ID( r5900, 0x34, psllh, .operands={RAB_OPERAND_cpu_rd, RAB_OPERAND_cpu_rt, RAB_OPERAND_cpu_sa}, diff --git a/tables/tables/instr_id/r5900/r5900_mmi_pmfhl.inc b/tables/tables/instr_id/r5900/r5900_mmi_pmfhl.inc new file mode 100644 index 00000000..12599a91 --- /dev/null +++ b/tables/tables/instr_id/r5900/r5900_mmi_pmfhl.inc @@ -0,0 +1,48 @@ +/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ +/* SPDX-License-Identifier: MIT */ + +/* + 31---------26------------------------------10------6-5----------0 + |0 1 1 1 0 0| | fmt |1 1 0 0 0 0| + ------6----------------------------------------5----------6------ + |-------00------|-------01------|-------10------|-------11------| +000 | PMFHL.LW | PMFHL.UW | PMFHL.SLW | PMFHL.LH | +001 | PMFHL.SH | --- | --- | --- | +010 | --- | --- | --- | --- | +011 | --- | --- | --- | --- | +100 | --- | --- | --- | --- | +101 | --- | --- | --- | --- | +110 | --- | --- | --- | --- | +111 | --- | --- | --- | --- | + hi |---------------|---------------|---------------|---------------| +*/ + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x00, pmfhl_lw, pmfhl.lw, + .operands={RAB_OPERAND_cpu_rd}, + .modifiesRd=true + ) // Parallel Move From Hi/Lo register + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x01, pmfhl_uw, pmfhl.uw, + .operands={RAB_OPERAND_cpu_rd}, + .modifiesRd=true + ) // Parallel Move From Hi/Lo register + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x02, pmfhl_slw, pmfhl.slw, + .operands={RAB_OPERAND_cpu_rd}, + .modifiesRd=true + ) // Parallel Move From Hi/Lo register + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x03, pmfhl_lh, pmfhl.lh, + .operands={RAB_OPERAND_cpu_rd}, + .modifiesRd=true + ) // Parallel Move From Hi/Lo register + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x04, pmfhl_sh, pmfhl.sh, + .operands={RAB_OPERAND_cpu_rd}, + .modifiesRd=true + ) // Parallel Move From Hi/Lo register diff --git a/tables/tables/instr_id/r5900/r5900_mmi_pmthl.inc b/tables/tables/instr_id/r5900/r5900_mmi_pmthl.inc new file mode 100644 index 00000000..5c3b0bd4 --- /dev/null +++ b/tables/tables/instr_id/r5900/r5900_mmi_pmthl.inc @@ -0,0 +1,24 @@ +/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ +/* SPDX-License-Identifier: MIT */ + +/* + 31---------26------------------------------10------6-5----------0 + |0 1 1 1 0 0| | fmt |1 1 0 0 0 1| + ------6----------------------------------------5----------6------ + |-------00------|-------01------|-------10------|-------11------| +000 | PMTHL.LW | --- | --- | --- | +001 | --- | --- | --- | --- | +010 | --- | --- | --- | --- | +011 | --- | --- | --- | --- | +100 | --- | --- | --- | --- | +101 | --- | --- | --- | --- | +110 | --- | --- | --- | --- | +111 | --- | --- | --- | --- | + hi |---------------|---------------|---------------|---------------| +*/ + + RABBITIZER_DEF_INSTR_ID_ALTNAME( + r5900, 0x00, pmthl_lw, pmthl.lw, + .operands={RAB_OPERAND_cpu_rs}, + .readsRs=true + ) // Parallel Move To Hi/Lo register diff --git a/tables/tables/instr_id_types/InstrIdType_r5900.inc b/tables/tables/instr_id_types/InstrIdType_r5900.inc index c331d88b..027eaaa4 100644 --- a/tables/tables/instr_id_types/InstrIdType_r5900.inc +++ b/tables/tables/instr_id_types/InstrIdType_r5900.inc @@ -25,3 +25,5 @@ RABBITIZER_DEF_INSTR_ID_TYPE(R5900, MMI_1) RABBITIZER_DEF_INSTR_ID_TYPE(R5900, MMI_2) RABBITIZER_DEF_INSTR_ID_TYPE(R5900, MMI_3) + RABBITIZER_DEF_INSTR_ID_TYPE(R5900, MMI_PMFHL) + RABBITIZER_DEF_INSTR_ID_TYPE(R5900, MMI_PMTHL) diff --git a/tests/c/instruction_checks/r5900_disasm.c b/tests/c/instruction_checks/r5900_disasm.c new file mode 100644 index 00000000..9197af72 --- /dev/null +++ b/tests/c/instruction_checks/r5900_disasm.c @@ -0,0 +1,24 @@ +/* SPDX-FileCopyrightText: © 2024 Decompollaborate */ +/* SPDX-License-Identifier: MIT */ + +#include "rabbitizer.h" + +#include +#include +#include + +#include "expected_disasm_utils.h" + +#define TEST_ENTRY_C(word, imm, expected) TEST_ENTRY(RABBITIZER_INSTRCAT_R5900, word, imm, expected,) + +// TODO: fill +const TestEntry test_entries[] = { + TEST_ENTRY_C(0x70001030, NULL, "pmfhl.lw $v0"), + TEST_ENTRY_C(0x70001070, NULL, "pmfhl.uw $v0"), + TEST_ENTRY_C(0x700010B0, NULL, "pmfhl.slw $v0"), + TEST_ENTRY_C(0x700010F0, NULL, "pmfhl.lh $v0"), + TEST_ENTRY_C(0x70001130, NULL, "pmfhl.sh $v0"), + TEST_ENTRY_C(0x70000031, NULL, "pmthl.lw $zero"), +}; + +size_t test_entries_len = ARRAY_COUNT(test_entries); diff --git a/tests/run_instruction_checks.sh b/tests/run_instruction_checks.sh index cb57d5cf..b6e44f4e 100755 --- a/tests/run_instruction_checks.sh +++ b/tests/run_instruction_checks.sh @@ -12,3 +12,4 @@ set -e ./build/tests/c/instruction_checks/r4000allegrex_vfpu_disasm.elf ./build/tests/c/instruction_checks/r5900_trunc_cvt.elf ./build/tests/c/instruction_checks/r5900_vcallms.elf +./build/tests/c/instruction_checks/r5900_disasm.elf