Skip to content

Commit

Permalink
add tests of div
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Nov 15, 2023
1 parent 1d7e2a6 commit 045ef31
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/apx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,37 @@ CYBOZU_TEST_AUTO(inc_dec)
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

CYBOZU_TEST_AUTO(div)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
div(r20b);
div(r20d);
div(r20w);
div(r20);
div(r20|T_nf);
div(eax|T_nf);
div(byte [r20+r30*1]);
div(word [r20+r30*1]);
div(dword [r20+r30*1]);
div(qword [r20+r30*1]);
}
} c;
const uint8_t tbl[] = {
0x62, 0xfc, 0x7c, 0x08, 0xf6, 0xf4,
0x62, 0xfc, 0x7c, 0x08, 0xf7, 0xf4,
0x62, 0xfc, 0x7d, 0x08, 0xf7, 0xf4,
0x62, 0xfc, 0xfc, 0x08, 0xf7, 0xf4,
0x62, 0xfc, 0xfc, 0x0c, 0xf7, 0xf4, // r20|T_nf
0x62, 0xf4, 0x7c, 0x0c, 0xf7, 0xf0, // eax|T_nf
0x62, 0xbc, 0x78, 0x08, 0xf6, 0x34, 0x34,
0x62, 0xbc, 0x79, 0x08, 0xf7, 0x34, 0x34,
0x62, 0xbc, 0x78, 0x08, 0xf7, 0x34, 0x34,
0x62, 0xbc, 0xf8, 0x08, 0xf7, 0x34, 0x34,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

0 comments on commit 045ef31

Please sign in to comment.