Check that POP counts the bits of the low 32 bits only, unlike DPOP.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
tests/tcg/mips64/octeon-insns.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/tcg/mips64/octeon-insns.c b/tests/tcg/mips64/octeon-insns.c
index 2c4fe8f58875..ff399507f1d4 100644
--- a/tests/tcg/mips64/octeon-insns.c
+++ b/tests/tcg/mips64/octeon-insns.c
@@ -48,6 +48,21 @@ static uint64_t octeon_dmul(uint64_t rs, uint64_t rt)
return rd;
}
+static uint64_t octeon_pop(uint64_t rs)
+{
+ uint64_t rd;
+
+ asm volatile(
+ "move $8, %[rs]\n\t"
+ ".word 0x7100502c\n\t" /* pop $10, $8 */
+ "move %[rd], $10\n\t"
+ : [rd] "=r" (rd)
+ : [rs] "r" (rs)
+ : "$8", "$10");
+
+ return rd;
+}
+
static uint64_t octeon_dpop(uint64_t rs)
{
uint64_t rd;
@@ -397,6 +412,9 @@ int main(void)
printf("TAP version 14\n");
CHECK(octeon_baddu(0x123, 0x0f0) == 0x13);
CHECK(octeon_dmul(0x12345678, 0x10) == 0x123456780);
+ CHECK(octeon_pop(0) == 0);
+ CHECK(octeon_pop(0xf0f0f0f0) == 16);
+ CHECK(octeon_pop(0xffffffff00000001ULL) == 1); /* low 32 bits only */
CHECK(octeon_dpop(0xf0f0f0f0f0f0f0f0ULL) == 32);
CHECK(octeon_seq(0xabc, 0xabc) == 1);
CHECK(octeon_seq(0xabc, 0xdef) == 0);
--
2.55.0