aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-05-09 12:41:38 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2024-05-10 15:45:14 +0200
commitff5b5739f97d08d9ca984ec8016b54487a76401b (patch)
tree868ea5d8a1aec99d35c5ae76ca239c3bdaf2fa0e /tests/tcg
parentfe01af5d47d4cf7fdf90c54d43f784e5068c8d72 (diff)
tests/tcg: cover lzcnt/tzcnt/popcnt
Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/tcg')
-rw-r--r--tests/tcg/i386/test-i386.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c
index 864c4e620d..ce3bf74b5a 100644
--- a/tests/tcg/i386/test-i386.c
+++ b/tests/tcg/i386/test-i386.c
@@ -715,6 +715,30 @@ void test_mul(void)
printf("%-10s A=" FMTLX " R=" FMTLX " %ld\n", #op, val, res, resz);\
}
+void test_xcnt(void)
+{
+ TEST_BSX(tzcntw, "w", 0);
+ TEST_BSX(tzcntw, "w", 0x12340128);
+ TEST_BSX(lzcntw, "w", 0);
+ TEST_BSX(lzcntw, "w", 0x12340128);
+ TEST_BSX(popcntw, "w", 0);
+ TEST_BSX(popcntw, "w", 0x12340128);
+ TEST_BSX(tzcntl, "k", 0);
+ TEST_BSX(tzcntl, "k", 0x00340128);
+ TEST_BSX(lzcntl, "k", 0);
+ TEST_BSX(lzcntl, "k", 0x00340128);
+ TEST_BSX(popcntl, "k", 0);
+ TEST_BSX(popcntl, "k", 0x00340128);
+#if defined(__x86_64__)
+ TEST_BSX(tzcntq, "", 0);
+ TEST_BSX(tzcntq, "", 0x003401281234);
+ TEST_BSX(lzcntq, "", 0);
+ TEST_BSX(lzcntq, "", 0x003401281234);
+ TEST_BSX(popcntq, "", 0);
+ TEST_BSX(popcntq, "", 0x003401281234);
+#endif
+}
+
void test_bsx(void)
{
TEST_BSX(bsrw, "w", 0);
@@ -2162,6 +2186,7 @@ int main(int argc, char **argv)
func();
}
test_bsx();
+ test_xcnt();
test_mul();
test_jcc();
test_loop();