From 8b81f55c02fc168f63b8689d80ae1d92b21154e2 Mon Sep 17 00:00:00 2001 From: angie Date: Wed, 10 Apr 2024 18:12:52 -0400 Subject: [PATCH] Remove some duplicated tests --- .../instruction_checks/r4000allegrex_disasm.c | 58 ++++++++++++++----- .../r4000allegrex_vfpu_disasm.c | 2 +- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/tests/c/instruction_checks/r4000allegrex_disasm.c b/tests/c/instruction_checks/r4000allegrex_disasm.c index 50a093a8..d2a1cc5d 100644 --- a/tests/c/instruction_checks/r4000allegrex_disasm.c +++ b/tests/c/instruction_checks/r4000allegrex_disasm.c @@ -14,6 +14,22 @@ size_t strlen_null(const char *string) { return strlen(string); } +int strcmp_null(const char *s0, const char *s1) { + if (s0 == s1) { + return 0; + } + + if (s0 == NULL) { + return 1; + } + + if (s1 == NULL) { + return -1; + } + + return strcmp(s0, s1); +} + typedef struct TestEntry { uint32_t word; const char *immOverride; @@ -44,6 +60,7 @@ const TestEntry entries[] = { { 0x7C0410A0, NULL, "wsbh $v0, $a0" }, { 0x7C0410E0, NULL, "wsbw $v0, $a0" }, +#if 0 { 0xBC840000, NULL, "cache IXIN, 0x0($a0)" }, { 0xBC860000, NULL, "cache IXUN, 0x0($a0)" }, { 0xBC880000, NULL, "cache IHIN, 0x0($a0)" }, @@ -58,6 +75,22 @@ const TestEntry entries[] = { { 0xBC9C0000, NULL, "cache DCDEXL, 0x0($a0)" }, { 0xBC9E0000, NULL, "cache DF, 0x0($a0)" }, { 0xBC9F0000, NULL, "cache DFL, 0x0($a0)" }, +#else + { 0xBC840000, NULL, "cache 0x04, 0x0($a0)" }, + { 0xBC860000, NULL, "cache 0x06, 0x0($a0)" }, + { 0xBC880000, NULL, "cache 0x08, 0x0($a0)" }, + { 0xBC8A0000, NULL, "cache 0x0A, 0x0($a0)" }, + { 0xBC8B0000, NULL, "cache 0x0B, 0x0($a0)" }, + { 0xBC940000, NULL, "cache 0x14, 0x0($a0)" }, + { 0xBC960000, NULL, "cache 0x16, 0x0($a0)" }, + { 0xBC980000, NULL, "cache 0x18, 0x0($a0)" }, + { 0xBC990000, NULL, "cache 0x19, 0x0($a0)" }, + { 0xBC9A0000, NULL, "cache 0x1A, 0x0($a0)" }, + { 0xBC9B0000, NULL, "cache 0x1B, 0x0($a0)" }, + { 0xBC9C0000, NULL, "cache 0x1C, 0x0($a0)" }, + { 0xBC9E0000, NULL, "cache 0x1E, 0x0($a0)" }, + { 0xBC9F0000, NULL, "cache 0x1F, 0x0($a0)" }, +#endif { 0x0000000F, NULL, "sync" }, { 0xC0820000, NULL, "ll $v0, 0x0($a0)" }, @@ -67,14 +100,9 @@ const TestEntry entries[] = { { 0xBC810000, NULL, "cache 0x01, 0x0($a0)" }, { 0xBC820000, NULL, "cache 0x02, 0x0($a0)" }, { 0xBC830000, NULL, "cache 0x03, 0x0($a0)" }, - { 0xBC840000, NULL, "cache IXIN, 0x0($a0)" }, { 0xBC850000, NULL, "cache 0x05, 0x0($a0)" }, - { 0xBC860000, NULL, "cache IXUN, 0x0($a0)" }, { 0xBC870000, NULL, "cache 0x07, 0x0($a0)" }, - { 0xBC880000, NULL, "cache IHIN, 0x0($a0)" }, { 0xBC890000, NULL, "cache 0x09, 0x0($a0)" }, - { 0xBC8A0000, NULL, "cache IF, 0x0($a0)" }, - { 0xBC8B0000, NULL, "cache IFL, 0x0($a0)" }, { 0xBC8C0000, NULL, "cache 0x0C, 0x0($a0)" }, { 0xBC8D0000, NULL, "cache 0x0D, 0x0($a0)" }, { 0xBC8E0000, NULL, "cache 0x0E, 0x0($a0)" }, @@ -83,18 +111,9 @@ const TestEntry entries[] = { { 0xBC910000, NULL, "cache 0x11, 0x0($a0)" }, { 0xBC920000, NULL, "cache 0x12, 0x0($a0)" }, { 0xBC930000, NULL, "cache 0x13, 0x0($a0)" }, - { 0xBC940000, NULL, "cache DXWBIN, 0x0($a0)" }, { 0xBC950000, NULL, "cache 0x15, 0x0($a0)" }, - { 0xBC960000, NULL, "cache DXUN, 0x0($a0)" }, { 0xBC970000, NULL, "cache 0x17, 0x0($a0)" }, - { 0xBC980000, NULL, "cache DCDEX, 0x0($a0)" }, - { 0xBC990000, NULL, "cache DHIN, 0x0($a0)" }, - { 0xBC9A0000, NULL, "cache DHWB, 0x0($a0)" }, - { 0xBC9B0000, NULL, "cache DHWBIN, 0x0($a0)" }, - { 0xBC9C0000, NULL, "cache DCDEXL, 0x0($a0)" }, { 0xBC9D0000, NULL, "cache 0x1D, 0x0($a0)" }, - { 0xBC9E0000, NULL, "cache DF, 0x0($a0)" }, - { 0xBC9F0000, NULL, "cache DFL, 0x0($a0)" }, { 0x70000000, NULL, "sleep" }, { 0x000002A8, NULL, "mfie $v0" }, @@ -106,6 +125,17 @@ int main() { int errorCount = 0; size_t i; + for (i = 0; i < ARRAY_COUNT(entries); i++) { + size_t j; + + for (j = i+1; j < ARRAY_COUNT(entries); j++) { + if ((entries[i].word == entries[j].word) && (strcmp_null(entries[i].immOverride, entries[j].immOverride) == 0)) { + fprintf(stderr, "Duplicated entry. Word: '0x%08X'. immOverride: '%s'\n", entries[i].word, entries[i].immOverride); + errorCount++; + } + } + } + for (i = 0; i < ARRAY_COUNT(entries); i++) { const TestEntry *entry = &entries[i]; RabbitizerInstruction instr; diff --git a/tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c b/tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c index 73d3ef76..c30225c2 100644 --- a/tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c +++ b/tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c @@ -1164,7 +1164,7 @@ const TestEntry entries[] = { { 0xF4800040, NULL, "svl.q C000, 0x40($a0)" }, { 0xF4800042, NULL, "svr.q C000, 0x40($a0)" }, - // According to the manual, bit 1 should be zero. The compiler handles it fine, but objdump ignores this bit, do idk + // According to the manual, bit 1 should be zero. The compiler handles it fine, but objdump ignores this bit, so idk { 0xD8800043, NULL, NULL }, { 0xD8810043, NULL, NULL }, { 0xD8820043, NULL, NULL },