Build the 18 per-opcode int-dot-product tests as a single executable,
test_msa_int_dot_product.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_dot_product.c | 139 ++++++++++++++++++++++
 tests/tcg/mips/meson.build                |  18 ---
 tests/tcg/mips64/meson.build              |   1 +
 tests/tcg/mipsel/meson.build              |   1 +
 4 files changed, 141 insertions(+), 18 deletions(-)
 create mode 100644 tests/tcg/mips/test_msa_int_dot_product.c

diff --git a/tests/tcg/mips/test_msa_int_dot_product.c 
b/tests/tcg/mips/test_msa_int_dot_product.c
new file mode 100644
index 000000000000..004fa5f8849c
--- /dev/null
+++ b/tests/tcg/mips/test_msa_int_dot_product.c
@@ -0,0 +1,139 @@
+/*
+ * MIPS MSA tests: Int Dot Product instructions
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#define main test_msa_dotp_s_d
+#include "user/ase/msa/int-dot-product/test_msa_dotp_s_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dotp_s_h
+#include "user/ase/msa/int-dot-product/test_msa_dotp_s_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dotp_s_w
+#include "user/ase/msa/int-dot-product/test_msa_dotp_s_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dotp_u_d
+#include "user/ase/msa/int-dot-product/test_msa_dotp_u_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dotp_u_h
+#include "user/ase/msa/int-dot-product/test_msa_dotp_u_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dotp_u_w
+#include "user/ase/msa/int-dot-product/test_msa_dotp_u_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_s_d
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_s_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_s_h
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_s_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_s_w
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_s_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_u_d
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_u_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_u_h
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_u_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpadd_u_w
+#include "user/ase/msa/int-dot-product/test_msa_dpadd_u_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_s_d
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_s_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_s_h
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_s_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_s_w
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_s_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_u_d
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_u_d.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_u_h
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_u_h.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+#define main test_msa_dpsub_u_w
+#include "user/ase/msa/int-dot-product/test_msa_dpsub_u_w.c"
+#undef main
+#undef TEST_COUNT_TOTAL
+
+
+static const struct {
+    const char *name;
+    int32_t (*fn)(void);
+} msa_tests[] = {
+    { "dotp.s.d", test_msa_dotp_s_d },
+    { "dotp.s.h", test_msa_dotp_s_h },
+    { "dotp.s.w", test_msa_dotp_s_w },
+    { "dotp.u.d", test_msa_dotp_u_d },
+    { "dotp.u.h", test_msa_dotp_u_h },
+    { "dotp.u.w", test_msa_dotp_u_w },
+    { "dpadd.s.d", test_msa_dpadd_s_d },
+    { "dpadd.s.h", test_msa_dpadd_s_h },
+    { "dpadd.s.w", test_msa_dpadd_s_w },
+    { "dpadd.u.d", test_msa_dpadd_u_d },
+    { "dpadd.u.h", test_msa_dpadd_u_h },
+    { "dpadd.u.w", test_msa_dpadd_u_w },
+    { "dpsub.s.d", test_msa_dpsub_s_d },
+    { "dpsub.s.h", test_msa_dpsub_s_h },
+    { "dpsub.s.w", test_msa_dpsub_s_w },
+    { "dpsub.u.d", test_msa_dpsub_u_d },
+    { "dpsub.u.h", test_msa_dpsub_u_h },
+    { "dpsub.u.w", test_msa_dpsub_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 Dot Product", 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 9c4304d49ae2..fade579a822c 100644
--- a/tests/tcg/mips/meson.build
+++ b/tests/tcg/mips/meson.build
@@ -146,22 +146,4 @@ tests_mips_msa = [
   '../mips/user/ase/msa/int-max-min/test_msa_min_s_b.c',
   '../mips/user/ase/msa/int-max-min/test_msa_min_u_w.c',
   '../mips/user/ase/msa/int-max-min/test_msa_max_u_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_s_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_u_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_s_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_s_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_s_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_u_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_s_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_u_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_s_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_u_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_s_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_s_h.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpadd_u_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_s_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_u_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_u_d.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dpsub_u_w.c',
-  '../mips/user/ase/msa/int-dot-product/test_msa_dotp_u_w.c',
 ]
diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build
index 442fdf0981e1..b7daa9d0f014 100644
--- a/tests/tcg/mips64/meson.build
+++ b/tests/tcg/mips64/meson.build
@@ -49,6 +49,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_average.c',
   '../mips/test_msa_int_compare.c',
   '../mips/test_msa_int_div_mod.c',
+  '../mips/test_msa_int_dot_product.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 5435ba39b602..7a0026075567 100644
--- a/tests/tcg/mipsel/meson.build
+++ b/tests/tcg/mipsel/meson.build
@@ -50,6 +50,7 @@ tests_mips_msa_groups = [
   '../mips/test_msa_int_average.c',
   '../mips/test_msa_int_compare.c',
   '../mips/test_msa_int_div_mod.c',
+  '../mips/test_msa_int_dot_product.c',
 ]
 
 foreach src: tests_mips_msa + tests_mips_msa_groups
-- 
2.55.0


Reply via email to