diff options
author | MITSUNARI Shigeo <[email protected]> | 2023-11-20 09:12:04 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2023-11-20 09:12:04 +0900 |
commit | c51c4a6f70e80dbfe5a02e131a972ec14b7f4e52 (patch) | |
tree | a2b75b8df8b9bbcb6b0071eae9ae4e530f422231 /test | |
parent | 2cc22ea1b42bd6c160e622c0e93e00e1e1cf524c (diff) | |
download | xbyak-c51c4a6f70e80dbfe5a02e131a972ec14b7f4e52.tar.gz xbyak-c51c4a6f70e80dbfe5a02e131a972ec14b7f4e52.zip |
add tests of lzcnt and tzcnt
Diffstat (limited to 'test')
-rw-r--r-- | test/apx.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/apx.cpp b/test/apx.cpp index 29a7850..d5ca303 100644 --- a/test/apx.cpp +++ b/test/apx.cpp @@ -930,3 +930,38 @@ CYBOZU_TEST_AUTO(imul_zu) CYBOZU_TEST_EQUAL(c.getSize(), n); CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n); } + +CYBOZU_TEST_AUTO(lzcnt) +{ + struct Code : Xbyak::CodeGenerator { + Code() + { + lzcnt(r16w, r17w); + lzcnt(r16d, r17d); + lzcnt(r16, r17); + lzcnt(r16|T_nf, r17); + lzcnt(rax|T_nf, rcx); + lzcnt(rax, ptr [r18]); + + tzcnt(r16w, r17w); + tzcnt(r16d, r17d); + tzcnt(r16, r17); + tzcnt(r16|T_nf, r17); + tzcnt(rax|T_nf, rcx); + tzcnt(rax, ptr [r18]); + } + } c; + const uint8_t tbl[] = { + // lzcnt + 0x62, 0xec, 0x7d, 0x08, 0xf5, 0xc1, 0x62, 0xec, 0x7c, 0x08, 0xf5, 0xc1, 0x62, 0xec, 0xfc, 0x08, + 0xf5, 0xc1, 0x62, 0xec, 0xfc, 0x0c, 0xf5, 0xc1, 0x62, 0xf4, 0xfc, 0x0c, 0xf5, 0xc1, 0x62, 0xfc, + 0xfc, 0x08, 0xf5, 0x02, + // tzcnt + 0x62, 0xec, 0x7d, 0x08, 0xf4, 0xc1, 0x62, 0xec, 0x7c, 0x08, 0xf4, 0xc1, 0x62, 0xec, 0xfc, 0x08, + 0xf4, 0xc1, 0x62, 0xec, 0xfc, 0x0c, 0xf4, 0xc1, 0x62, 0xf4, 0xfc, 0x0c, 0xf4, 0xc1, 0x62, 0xfc, + 0xfc, 0x08, 0xf4, 0x02, + }; + const size_t n = sizeof(tbl); + CYBOZU_TEST_EQUAL(c.getSize(), n); + CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n); +} |