On 10/29/2026 9:22 AM, Philippe Mathieu-Daudé wrote: > Build the 12 per-opcode bit-count tests as a single executable, > test_msa_bit_count.c, to reduce the number of test binaries. > Each opcode reports one TAP line. > > Prefix the per-instruction summary of test_utils_128.h with '# ' > so TAP parsers treat it as a comment. > > Signed-off-by: Philippe Mathieu-Daudé <[email protected]> > --- > tests/tcg/mips/include/test_utils_128.h | 2 +- > tests/tcg/mips/test_msa_bit_count.c | 103 ++++++++++++++++++++++++ > tests/tcg/mips/meson.build | 12 --- > tests/tcg/mips64/meson.build | 6 +- > tests/tcg/mipsel/meson.build | 6 +- > 5 files changed, 114 insertions(+), 15 deletions(-) > create mode 100644 tests/tcg/mips/test_msa_bit_count.c > > diff --git a/tests/tcg/mips/include/test_utils_128.h > b/tests/tcg/mips/include/test_utils_128.h > index 0dd38684cf33..9ba877d84b5c 100644 > --- a/tests/tcg/mips/include/test_utils_128.h > +++ b/tests/tcg/mips/include/test_utils_128.h > @@ -59,7 +59,7 @@ static inline int32_t check_results_128(const char > *isa_ase_name, > uint32_t pass_count = 0; > uint32_t fail_count = 0; > > - printf("| %-10s \t| %-20s\t| %-16s \t|", > + printf("# %-10s \t| %-20s\t| %-16s \t|", > isa_ase_name, group_name, instruction_name); > for (i = 0; i < test_count; i++) { > if ((b128_result[2 * i] == b128_expect[2 * i]) && > diff --git a/tests/tcg/mips/test_msa_bit_count.c > b/tests/tcg/mips/test_msa_bit_count.c > new file mode 100644 > index 000000000000..dacfb619f8fc > --- /dev/null > +++ b/tests/tcg/mips/test_msa_bit_count.c > @@ -0,0 +1,103 @@ > +/* > + * MIPS MSA tests: Bit Count instructions > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > + > +#define main test_msa_nloc_b > +#include "user/ase/msa/bit-count/test_msa_nloc_b.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nloc_d > +#include "user/ase/msa/bit-count/test_msa_nloc_d.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nloc_h > +#include "user/ase/msa/bit-count/test_msa_nloc_h.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nloc_w > +#include "user/ase/msa/bit-count/test_msa_nloc_w.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nlzc_b > +#include "user/ase/msa/bit-count/test_msa_nlzc_b.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nlzc_d > +#include "user/ase/msa/bit-count/test_msa_nlzc_d.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nlzc_h > +#include "user/ase/msa/bit-count/test_msa_nlzc_h.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_nlzc_w > +#include "user/ase/msa/bit-count/test_msa_nlzc_w.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_pcnt_b > +#include "user/ase/msa/bit-count/test_msa_pcnt_b.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_pcnt_d > +#include "user/ase/msa/bit-count/test_msa_pcnt_d.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_pcnt_h > +#include "user/ase/msa/bit-count/test_msa_pcnt_h.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > +#define main test_msa_pcnt_w > +#include "user/ase/msa/bit-count/test_msa_pcnt_w.c" > +#undef main > +#undef TEST_COUNT_TOTAL > + > + > +static const struct { > + const char *name; > + int32_t (*fn)(void); > +} msa_tests[] = { > + { "nloc.b", test_msa_nloc_b }, > + { "nloc.d", test_msa_nloc_d }, > + { "nloc.h", test_msa_nloc_h }, > + { "nloc.w", test_msa_nloc_w }, > + { "nlzc.b", test_msa_nlzc_b }, > + { "nlzc.d", test_msa_nlzc_d }, > + { "nlzc.h", test_msa_nlzc_h }, > + { "nlzc.w", test_msa_nlzc_w }, > + { "pcnt.b", test_msa_pcnt_b }, > + { "pcnt.d", test_msa_pcnt_d }, > + { "pcnt.h", test_msa_pcnt_h }, > + { "pcnt.w", test_msa_pcnt_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, > + "Bit Count", 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 88d598a4f89b..40984e9b4fcf 100644 > --- a/tests/tcg/mips/meson.build > +++ b/tests/tcg/mips/meson.build > @@ -93,18 +93,6 @@ tests_mips_msa = [ > '../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/bit-count/test_msa_pcnt_h.c', > - '../mips/user/ase/msa/bit-count/test_msa_pcnt_b.c', > - '../mips/user/ase/msa/bit-count/test_msa_nloc_h.c', > - '../mips/user/ase/msa/bit-count/test_msa_pcnt_w.c', > - '../mips/user/ase/msa/bit-count/test_msa_nlzc_h.c', > - '../mips/user/ase/msa/bit-count/test_msa_pcnt_d.c', > - '../mips/user/ase/msa/bit-count/test_msa_nloc_d.c', > - '../mips/user/ase/msa/bit-count/test_msa_nloc_w.c', > - '../mips/user/ase/msa/bit-count/test_msa_nloc_b.c', > - '../mips/user/ase/msa/bit-count/test_msa_nlzc_d.c', > - '../mips/user/ase/msa/bit-count/test_msa_nlzc_w.c', > - '../mips/user/ase/msa/bit-count/test_msa_nlzc_b.c', > '../mips/user/ase/msa/int-add/test_msa_addv_d.c', > '../mips/user/ase/msa/int-add/test_msa_adds_a_h.c', > '../mips/user/ase/msa/int-add/test_msa_add_a_h.c', > diff --git a/tests/tcg/mips64/meson.build b/tests/tcg/mips64/meson.build > index 894f8e9e23e1..bcc02d955436 100644 > --- a/tests/tcg/mips64/meson.build > +++ b/tests/tcg/mips64/meson.build > @@ -39,7 +39,11 @@ foreach src: tests_mips64r6 > tests += {src: {'cflags': '-march=mips64r6', 'protocol': 'tap'}} > endforeach > > -foreach src: tests_mips_msa > +tests_mips_msa_groups = [ > + '../mips/test_msa_bit_count.c', > +] > + > +foreach src: tests_mips_msa + tests_mips_msa_groups > tests += { > src: { > 'cflags': ['-march=mips64r6', '-mmsa'], > diff --git a/tests/tcg/mipsel/meson.build b/tests/tcg/mipsel/meson.build > index 9e446eed0f6e..8b4e665634ab 100644 > --- a/tests/tcg/mipsel/meson.build > +++ b/tests/tcg/mipsel/meson.build > @@ -40,7 +40,11 @@ endif > > tests = [] > > -foreach src: tests_mips_msa > +tests_mips_msa_groups = [ > + '../mips/test_msa_bit_count.c', > +] > +
For this, and all MSA tests, any reason to duplicate this array between mips64 and mipsel? I can hear the "self-contained" meson.build argument, but in this case, it really feels like duplication. Regards, Pierrick
