diff options
-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); +} |