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]> Reviewed-by: Pierrick Bouvier <[email protected]> --- tests/tcg/mips/include/test_utils_128.h | 2 +- tests/tcg/mips/test_msa_bit_count.c | 99 +++++++++++++++++++++++++ tests/tcg/mips/meson.build | 17 ++--- tests/tcg/mips64/meson.build | 2 +- tests/tcg/mipsel/meson.build | 2 +- 5 files changed, 107 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..7f965bc9ec4d --- /dev/null +++ b/tests/tcg/mips/test_msa_bit_count.c @@ -0,0 +1,99 @@ +/* + * MIPS MSA tests: Bit Count instructions + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "../include/tap.h" + +#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) +{ + unsigned i; + + TAP_START(); + for (i = 0; i < sizeof(msa_tests) / sizeof(msa_tests[0]); i++) { + tap_report(!msa_tests[i].fn(), "MSA %s %s", + "Bit Count", msa_tests[i].name); + } + + return tap_done(); +} diff --git a/tests/tcg/mips/meson.build b/tests/tcg/mips/meson.build index 88d598a4f89b..88ec44520377 100644 --- a/tests/tcg/mips/meson.build +++ b/tests/tcg/mips/meson.build @@ -1,5 +1,10 @@ tests = [] +# MSA tests shared by the mipsel and mips64 targets +tests_mips_msa_groups = [ + '../mips/test_msa_bit_count.c', +] + tests += tcg_tests['multiarch-linux-user']['tests'] tests += { @@ -93,18 +98,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..ebb4006e7eb5 100644 --- a/tests/tcg/mips64/meson.build +++ b/tests/tcg/mips64/meson.build @@ -39,7 +39,7 @@ foreach src: tests_mips64r6 tests += {src: {'cflags': '-march=mips64r6', 'protocol': 'tap'}} endforeach -foreach src: tests_mips_msa +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..edb59a25454b 100644 --- a/tests/tcg/mipsel/meson.build +++ b/tests/tcg/mipsel/meson.build @@ -40,7 +40,7 @@ endif tests = [] -foreach src: tests_mips_msa +foreach src: tests_mips_msa + tests_mips_msa_groups tests += { src: { 'cflags': ['-mabi=32', '-march=mips32r5', '-mmsa', '-mno-odd-spreg', -- 2.55.0
