Build the 16 per-opcode int-div-mod tests as a single executable,
test_msa_int_div_mod.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 tests/tcg/mips/test_msa_int_div_mod.c | 127 ++++++++++++++++++++++++++
 tests/tcg/mips/meson.build            |  16 ----
 tests/tcg/mips64/meson.build          |   1 +
 tests/tcg/mipsel/meson.build          |   1 +
 4 files changed, 129 insertions(+), 16 deletions(-)
 create mode 100644 tests/tcg/mips/test_msa_int_div_mod.c

diff --git a/tests/tcg/mips/test_msa_int_div_mod.c 
b/tests/tcg/mips/test_msa_int_div_mod.c
new file mode 100644
index 000000000000..31ca37efec56
--- /dev/null
+++ b/tests/tcg/mips/test_msa_int_div_mod.c
@@ -0,0 +1,127 @@
+/*
+ * MIPS MSA tests: Int Divide and Modulo instructions
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#define main test_msa_div_s_b
+#include "user/ase/msa/int-divide/test_msa_div_s_b.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_s_d
+#include "user/ase/msa/int-divide/test_msa_div_s_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_s_h
+#include "user/ase/msa/int-divide/test_msa_div_s_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_s_w
+#include "user/ase/msa/int-divide/test_msa_div_s_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_u_b
+#include "user/ase/msa/int-divide/test_msa_div_u_b.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_u_d
+#include "user/ase/msa/int-divide/test_msa_div_u_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_u_h
+#include "user/ase/msa/int-divide/test_msa_div_u_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_div_u_w
+#include "user/ase/msa/int-divide/test_msa_div_u_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_s_b
+#include "user/ase/msa/int-modulo/test_msa_mod_s_b.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_s_d
+#include "user/ase/msa/int-modulo/test_msa_mod_s_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_s_h
+#include "user/ase/msa/int-modulo/test_msa_mod_s_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_s_w
+#include "user/ase/msa/int-modulo/test_msa_mod_s_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_u_b
+#include "user/ase/msa/int-modulo/test_msa_mod_u_b.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_u_d
+#include "user/ase/msa/int-modulo/test_msa_mod_u_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_u_h
+#include "user/ase/msa/int-modulo/test_msa_mod_u_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_mod_u_w
+#include "user/ase/msa/int-modulo/test_msa_mod_u_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} msa_tests[] = {
+    { "div.s.b", test_msa_div_s_b },
+    { "div.s.d", test_msa_div_s_d },
+    { "div.s.h", test_msa_div_s_h },
+    { "div.s.w", test_msa_div_s_w },
+    { "div.u.b", test_msa_div_u_b },
+    { "div.u.d", test_msa_div_u_d },
+    { "div.u.h", test_msa_div_u_h },
+    { "div.u.w", test_msa_div_u_w },
+    { "mod.s.b", test_msa_mod_s_b },
+    { "mod.s.d", test_msa_mod_s_d },
+    { "mod.s.h", test_msa_mod_s_h },
+    { "mod.s.w", test_msa_mod_s_w },
+    { "mod.u.b", test_msa_mod_u_b },
+    { "mod.u.d", test_msa_mod_u_d },
+    { "mod.u.h", test_msa_mod_u_h },
+    { "mod.u.w", test_msa_mod_u_w },
+};
+
+int main(void)
+{
+    int fail = 0;
+    unsigned i;
+
+    printf("TAP version 14\n"
+           "1..%u\n",
+           (unsigned)(sizeof(msa_tests) / sizeof(msa_tests[0])));
+    for (i = 0; i < sizeof(msa_tests) / sizeof(msa_tests[0]); i++) {
+        int r = msa_tests[i].fn();
+
+        printf("%s %u - MSA %s %s\n", r ? "not ok" : "ok", i + 1,
+               "Int Divide and Modulo", msa_tests[i].name);
+        fail |= r;
+    }
+
+    return fail ? 1 : 0;
+}
diff --git a/tests/tcg/mips/meson.build b/tests/tcg/mips/meson.build
index 34ea7d1a7bf7..9c4304d49ae2 100644
--- a/tests/tcg/mips/meson.build
+++ b/tests/tcg/mips/meson.build
@@ -23,14 +23,6 @@ if 'qemu-mips' in emulators
 endif
 
 tests_mips_msa = [
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_s_b.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_u_d.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_s_d.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_s_w.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_s_h.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_u_b.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_u_h.c',
-  '../mips/user/ase/msa/int-modulo/test_msa_mod_u_w.c',
   '../mips/user/ase/msa/int-subtract/test_msa_asub_s_w.c',
   '../mips/user/ase/msa/int-subtract/test_msa_hsub_u_d.c',
   '../mips/user/ase/msa/int-subtract/test_msa_hsub_s_w.c',
@@ -77,14 +69,6 @@ tests_mips_msa = [
   '../mips/user/ase/msa/int-multiply/test_msa_mulv_h.c',
   '../mips/user/ase/msa/int-multiply/test_msa_mulv_d.c',
   '../mips/user/ase/msa/int-multiply/test_msa_maddv_h.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_s_b.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_u_b.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_s_d.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_s_h.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_s_w.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_u_w.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_u_h.c',
-  '../mips/user/ase/msa/int-divide/test_msa_div_u_d.c',
   '../mips/user/ase/msa/interleave/test_msa_ilvr_b.c',
   '../mips/user/ase/msa/interleave/test_msa_ilvr_d.c',
   '../mips/user/ase/msa/interleave/test_msa_ilvod_b.c',
diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build
index e896658e66fd..442fdf0981e1 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -48,6 +48,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_add.c',
   '../mips/test_msa_int_average.c',
   '../mips/test_msa_int_compare.c',
+  '../mips/test_msa_int_div_mod.c',
 ]
 
 foreach src: tests_mips_msa + tests_mips_msa_groups
diff --git a/tests/tcg/mipsel/meson.build b/tests/tcg/mipsel/meson.build
index c4c9d2e77cb8..5435ba39b602 100644
--- a/tests/tcg/mipsel/meson.build
+++ b/tests/tcg/mipsel/meson.build
@@ -49,6 +49,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_add.c',
   '../mips/test_msa_int_average.c',
   '../mips/test_msa_int_compare.c',
+  '../mips/test_msa_int_div_mod.c',
 ]
 
 foreach src: tests_mips_msa + tests_mips_msa_groups
-- 
2.55.0


Reply via email to