Build the 5 per-opcode logic tests as a single executable,
test_msa_logic.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_logic.c | 61 +++++++++++++++++++++++++++++++++
 tests/tcg/mips/meson.build      |  5 ---
 tests/tcg/mips64/meson.build    |  1 +
 tests/tcg/mipsel/meson.build    |  1 +
 4 files changed, 63 insertions(+), 5 deletions(-)
 create mode 100644 tests/tcg/mips/test_msa_logic.c

diff --git a/tests/tcg/mips/test_msa_logic.c b/tests/tcg/mips/test_msa_logic.c
new file mode 100644
index 000000000000..a9c45f1e98ad
--- /dev/null
+++ b/tests/tcg/mips/test_msa_logic.c
@@ -0,0 +1,61 @@
+/*
+ * MIPS MSA tests: Logic and Move instructions
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#define main test_msa_and_v
+#include "user/ase/msa/logic/test_msa_and_v.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_nor_v
+#include "user/ase/msa/logic/test_msa_nor_v.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_or_v
+#include "user/ase/msa/logic/test_msa_or_v.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_xor_v
+#include "user/ase/msa/logic/test_msa_xor_v.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_move_v
+#include "user/ase/msa/move/test_msa_move_v.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} msa_tests[] = {
+    { "and.v", test_msa_and_v },
+    { "nor.v", test_msa_nor_v },
+    { "or.v", test_msa_or_v },
+    { "xor.v", test_msa_xor_v },
+    { "move.v", test_msa_move_v },
+};
+
+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,
+               "Logic and Move", 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 135e6297e4de..843031f6c0b8 100644
--- a/tests/tcg/mips/meson.build
+++ b/tests/tcg/mips/meson.build
@@ -55,9 +55,4 @@ tests_mips_msa = [
   '../mips/user/ase/msa/shift/test_msa_srar_w.c',
   '../mips/user/ase/msa/shift/test_msa_srlr_b.c',
   '../mips/user/ase/msa/shift/test_msa_srlr_w.c',
-  '../mips/user/ase/msa/logic/test_msa_or_v.c',
-  '../mips/user/ase/msa/logic/test_msa_nor_v.c',
-  '../mips/user/ase/msa/logic/test_msa_and_v.c',
-  '../mips/user/ase/msa/logic/test_msa_xor_v.c',
-  '../mips/user/ase/msa/move/test_msa_move_v.c',
 ]
diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build
index 67858c5a23f2..fffbda7750ac 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -54,6 +54,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_multiply.c',
   '../mips/test_msa_int_subtract.c',
   '../mips/test_msa_interleave.c',
+  '../mips/test_msa_logic.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 5c0a89197089..7ba88b2aac29 100644
--- a/tests/tcg/mipsel/meson.build
+++ b/tests/tcg/mipsel/meson.build
@@ -55,6 +55,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_multiply.c',
   '../mips/test_msa_int_subtract.c',
   '../mips/test_msa_interleave.c',
+  '../mips/test_msa_logic.c',
 ]
 
 foreach src: tests_mips_msa + tests_mips_msa_groups
-- 
2.55.0


Reply via email to