Skip to content

Commit

Permalink
add test of adc/add/and_/cmp/or_/sbb/sub/xor_
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Oct 15, 2023
1 parent f7d3c17 commit a95bd9c
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/apx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,50 @@

using namespace Xbyak;

CYBOZU_TEST_AUTO(reg_rm)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
adc(r17, ptr [rax]);
adc(ptr [r18], rdx);
adc(r30, rcx);
add(r17, ptr [rax]);
add(ptr [r18], rdx);
add(r30, rcx);
and_(r17, ptr [rax]);
and_(ptr [r18], rdx);
and_(r30, rcx);
cmp(r17, ptr [rax]);
cmp(ptr [r18], rdx);
cmp(r30, rcx);
or_(r17, ptr [rax]);
or_(ptr [r18], rdx);
or_(r30, rcx);
sbb(r17, ptr [rax]);
sbb(ptr [r18], rdx);
sbb(r30, rcx);
sub(r17, ptr [rax]);
sub(ptr [r18], rdx);
sub(r30, rcx);
xor_(r17, ptr [rax]);
xor_(ptr [r18], rdx);
xor_(r30, rcx);
}
} c;
const uint8_t tbl[] = {
0xd5, 0x48, 0x13, 0x08, 0xd5, 0x18, 0x11, 0x12, 0xd5, 0x19, 0x11, 0xce, 0xd5, 0x48, 0x03, 0x08,
0xd5, 0x18, 0x01, 0x12, 0xd5, 0x19, 0x01, 0xce, 0xd5, 0x48, 0x23, 0x08, 0xd5, 0x18, 0x21, 0x12,
0xd5, 0x19, 0x21, 0xce, 0xd5, 0x48, 0x3b, 0x08, 0xd5, 0x18, 0x39, 0x12, 0xd5, 0x19, 0x39, 0xce,
0xd5, 0x48, 0x0b, 0x08, 0xd5, 0x18, 0x09, 0x12, 0xd5, 0x19, 0x09, 0xce, 0xd5, 0x48, 0x1b, 0x08,
0xd5, 0x18, 0x19, 0x12, 0xd5, 0x19, 0x19, 0xce, 0xd5, 0x48, 0x2b, 0x08, 0xd5, 0x18, 0x29, 0x12,
0xd5, 0x19, 0x29, 0xce, 0xd5, 0x48, 0x33, 0x08, 0xd5, 0x18, 0x31, 0x12, 0xd5, 0x19, 0x31, 0xce,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

CYBOZU_TEST_AUTO(reg64)
{
struct Code : Xbyak::CodeGenerator {
Expand Down

0 comments on commit a95bd9c

Please sign in to comment.