Skip to content

Commit

Permalink
add test of NF
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Nov 9, 2023
1 parent e23f5ad commit 637ad7a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/apx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,48 @@ CYBOZU_TEST_AUTO(r3_2)
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

CYBOZU_TEST_AUTO(NF)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
add(rax, rcx, rdx);
add(rax|T_nf, rcx, rdx);
and_(rax, rcx, rdx);
and_(rax|T_nf, rcx, rdx);
or_(rax, rcx, rdx);
or_(rax|T_nf, rcx, rdx);
sub(rax, rcx, rdx);
sub(rax|T_nf, rcx, rdx);
xor_(rax, rcx, rdx);
xor_(rax|T_nf, rcx, rdx);

add(rax, rcx, 3);
add(rax|T_nf, rcx, 3);
and_(rax, rcx, 3);
and_(rax|T_nf, rcx, 3);
or_(rax, rcx, 3);
or_(rax|T_nf, rcx, 3);
sub(rax, rcx, 3);
sub(rax|T_nf, rcx, 3);
xor_(rax, rcx, 3);
xor_(rax|T_nf, rcx, 3);
}
} c;
const uint8_t tbl[] = {
0x62, 0xf4, 0xfc, 0x18, 0x01, 0xd1, 0x62, 0xf4, 0xfc, 0x1c, 0x01, 0xd1, 0x62, 0xf4, 0xfc, 0x18,
0x21, 0xd1, 0x62, 0xf4, 0xfc, 0x1c, 0x21, 0xd1, 0x62, 0xf4, 0xfc, 0x18, 0x09, 0xd1, 0x62, 0xf4,
0xfc, 0x1c, 0x09, 0xd1, 0x62, 0xf4, 0xfc, 0x18, 0x29, 0xd1, 0x62, 0xf4, 0xfc, 0x1c, 0x29, 0xd1,
0x62, 0xf4, 0xfc, 0x18, 0x31, 0xd1, 0x62, 0xf4, 0xfc, 0x1c, 0x31, 0xd1,

0x62, 0xf4, 0xfc, 0x18, 0x83, 0xc1, 0x03, 0x62, 0xf4, 0xfc, 0x1c, 0x83, 0xc1, 0x03, 0x62, 0xf4,
0xfc, 0x18, 0x83, 0xe1, 0x03, 0x62, 0xf4, 0xfc, 0x1c, 0x83, 0xe1, 0x03, 0x62, 0xf4, 0xfc, 0x18,
0x83, 0xc9, 0x03, 0x62, 0xf4, 0xfc, 0x1c, 0x83, 0xc9, 0x03, 0x62, 0xf4, 0xfc, 0x18, 0x83, 0xe9,
0x03, 0x62, 0xf4, 0xfc, 0x1c, 0x83, 0xe9, 0x03, 0x62, 0xf4, 0xfc, 0x18, 0x83, 0xf1, 0x03, 0x62,
0xf4, 0xfc, 0x1c, 0x83, 0xf1, 0x03,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

0 comments on commit 637ad7a

Please sign in to comment.