Commit 27e420cfe3 for qemu.org
commit 27e420cfe322987335513490bdc4d0de9c48bd9a
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Thu Oct 29 11:18:19 2026 +0100
tests/tcg/mipsel: Test MIPS32R6 SELEQZ and SELNEZ
Test SEL[EQ/NE]Z.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030182546.2508-9-philmd@oss.qualcomm.com>
diff --git a/tests/tcg/mips/include/wrappers_mips32r6.h b/tests/tcg/mips/include/wrappers_mips32r6.h
index 316aa69ef5..aaa8afcae9 100644
--- a/tests/tcg/mips/include/wrappers_mips32r6.h
+++ b/tests/tcg/mips/include/wrappers_mips32r6.h
@@ -58,4 +58,7 @@ DO_MIPS32R6__RD__RS_RT(NOR, nor)
DO_MIPS32R6__RD__RS_RT(OR, or)
DO_MIPS32R6__RD__RS_RT(XOR, xor)
+DO_MIPS32R6__RD__RS_RT(SELEQZ, seleqz)
+DO_MIPS32R6__RD__RS_RT(SELNEZ, selnez)
+
#endif
diff --git a/tests/tcg/mipsel/test_mips32r6_logic.c b/tests/tcg/mipsel/test_mips32r6_logic.c
index 4d6d8bb0f5..8b0cef0f6d 100644
--- a/tests/tcg/mipsel/test_mips32r6_logic.c
+++ b/tests/tcg/mipsel/test_mips32r6_logic.c
@@ -20,6 +20,9 @@ static uint32_t ref_and(uint32_t a, uint32_t b) { return a & b; }
static uint32_t ref_nor(uint32_t a, uint32_t b) { return ~(a | b); }
static uint32_t ref_or(uint32_t a, uint32_t b) { return a | b; }
static uint32_t ref_xor(uint32_t a, uint32_t b) { return a ^ b; }
+/* SELEQZ/SELNEZ select rs, or zero, depending on rt. */
+static uint32_t ref_seleqz(uint32_t a, uint32_t b) { return b == 0 ? a : 0; }
+static uint32_t ref_selnez(uint32_t a, uint32_t b) { return b != 0 ? a : 0; }
static int check_op(const char *name, binary_op_32 op, ref_op_32 ref,
const uint32_t *input, size_t count)
@@ -58,6 +61,8 @@ int main(void)
run("NOR", do_mips32r6_NOR, ref_nor);
run("OR", do_mips32r6_OR, ref_or);
run("XOR", do_mips32r6_XOR, ref_xor);
+ run("SELEQZ", do_mips32r6_SELEQZ, ref_seleqz);
+ run("SELNEZ", do_mips32r6_SELNEZ, ref_selnez);
return tap_done();
}