Build the 8 per-opcode multiply tests as a single executable,
test_mips64r6_multiply.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 tests/tcg/mips64/test_mips64r6_multiply.c | 74 +++++++++++++++++++++++
 tests/tcg/mips64/meson.build              |  9 +--
 2 files changed, 75 insertions(+), 8 deletions(-)
 create mode 100644 tests/tcg/mips64/test_mips64r6_multiply.c

diff --git a/tests/tcg/mips64/test_mips64r6_multiply.c 
b/tests/tcg/mips64/test_mips64r6_multiply.c
new file mode 100644
index 000000000000..8ee9d064da55
--- /dev/null
+++ b/tests/tcg/mips64/test_mips64r6_multiply.c
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* MIPS64R6 tests: multiply */
+
+#define main test_mips64r6_mul
+#include "test_mips64r6_mul.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_muh
+#include "test_mips64r6_muh.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_mulu
+#include "test_mips64r6_mulu.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_muhu
+#include "test_mips64r6_muhu.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dmul
+#include "test_mips64r6_dmul.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dmuh
+#include "test_mips64r6_dmuh.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dmulu
+#include "test_mips64r6_dmulu.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_mips64r6_dmuhu
+#include "test_mips64r6_dmuhu.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} r6_tests[] = {
+    { "mul", test_mips64r6_mul },
+    { "muh", test_mips64r6_muh },
+    { "mulu", test_mips64r6_mulu },
+    { "muhu", test_mips64r6_muhu },
+    { "dmul", test_mips64r6_dmul },
+    { "dmuh", test_mips64r6_dmuh },
+    { "dmulu", test_mips64r6_dmulu },
+    { "dmuhu", test_mips64r6_dmuhu },
+};
+
+int main(void)
+{
+    unsigned count = sizeof(r6_tests) / sizeof(r6_tests[0]);
+    int fail = 0;
+    unsigned i;
+
+    printf("TAP version 14\n1..%u\n", count);
+    for (i = 0; i < count; i++) {
+        int r = r6_tests[i].fn();
+
+        printf("%s %u - MIPS64R6 multiply %s\n", r ? "not ok" : "ok", i + 1,
+               r6_tests[i].name);
+        fail |= r;
+    }
+
+    return fail ? 1 : 0;
+}
diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build
index 657a1c4d5cc9..d356689e54bf 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -31,17 +31,10 @@ tests_mips64r6 = [
   '../mips64/test_mips64r6_bitops.c',
   '../mips64/test_mips64r6_crc.c',
   '../mips64/test_mips64r6_logic.c',
-  '../mips64/test_mips64r6_dmuh.c',
-  '../mips64/test_mips64r6_dmuhu.c',
-  '../mips64/test_mips64r6_dmul.c',
-  '../mips64/test_mips64r6_dmulu.c',
+  '../mips64/test_mips64r6_multiply.c',
   '../mips64/test_mips64r6_dsllv.c',
   '../mips64/test_mips64r6_dsrav.c',
   '../mips64/test_mips64r6_dsrlv.c',
-  '../mips64/test_mips64r6_muh.c',
-  '../mips64/test_mips64r6_muhu.c',
-  '../mips64/test_mips64r6_mul.c',
-  '../mips64/test_mips64r6_mulu.c',
   '../mips64/test_mips64r6_sllv.c',
   '../mips64/test_mips64r6_srav.c',
   '../mips64/test_mips64r6_srlv.c',
-- 
2.55.0


Reply via email to