Skip to content

Commit

Permalink
add cfcmov tests
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Nov 29, 2023
1 parent e2d9685 commit 98ce73b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions test/apx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,41 @@ CYBOZU_TEST_AUTO(cfcmov)
cfcmovb(r20w, r30w, ptr [r9]);
cfcmovb(r20d, r30d, ptr [r9]);
cfcmovb(r20, r30, ptr [r9]);

// all
cfcmovo(r20, r21, r22);
cfcmovo(r20, r21, ptr [r22]);
cfcmovno(r20, r21, r22);
cfcmovno(r20, r21, ptr [r22]);
cfcmovb(r20, r21, r22);
cfcmovb(r20, r21, ptr [r22]);
cfcmovnb(r20, r21, r22);
cfcmovnb(r20, r21, ptr [r22]);
cfcmovz(r20, r21, r22);
cfcmovz(r20, r21, ptr [r22]);
cfcmovnz(r20, r21, r22);
cfcmovnz(r20, r21, ptr [r22]);
cfcmovbe(r20, r21, r22);
cfcmovbe(r20, r21, ptr [r22]);
cfcmovnbe(r20, r21, r22);
cfcmovnbe(r20, r21, ptr [r22]);
cfcmovs(r20, r21, r22);
cfcmovs(r20, r21, ptr [r22]);
cfcmovns(r20, r21, r22);
cfcmovns(r20, r21, ptr [r22]);
cfcmovp(r20, r21, r22);
cfcmovp(r20, r21, ptr [r22]);
cfcmovnp(r20, r21, r22);
cfcmovnp(r20, r21, ptr [r22]);
cfcmovl(r20, r21, r22);
cfcmovl(r20, r21, ptr [r22]);
cfcmovnl(r20, r21, r22);
cfcmovnl(r20, r21, ptr [r22]);
cfcmovle(r20, r21, r22);
cfcmovle(r20, r21, ptr [r22]);
cfcmovnle(r20, r21, r22);
cfcmovnle(r20, r21, ptr [r22]);

}
} c;
const uint8_t tbl[] = {
Expand All @@ -1630,6 +1665,19 @@ CYBOZU_TEST_AUTO(cfcmov)
0x62, 0x44, 0x7c, 0x08, 0x42, 0x31, 0x62, 0x44, 0xfc, 0x08, 0x42, 0x31, 0x62, 0x4c, 0x5d, 0x14,
0x42, 0xf7, 0x62, 0x4c, 0x5c, 0x14, 0x42, 0xf7, 0x62, 0x4c, 0xdc, 0x14, 0x42, 0xf7, 0x62, 0x44,
0x5d, 0x14, 0x42, 0x31, 0x62, 0x44, 0x5c, 0x14, 0x42, 0x31, 0x62, 0x44, 0xdc, 0x14, 0x42, 0x31,
// all
0x62, 0xec, 0xdc, 0x14, 0x40, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x40, 0x2e, 0x62, 0xec, 0xdc, 0x14,
0x41, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x41, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x42, 0xee, 0x62, 0xec,
0xdc, 0x14, 0x42, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x43, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x43, 0x2e,
0x62, 0xec, 0xdc, 0x14, 0x44, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x44, 0x2e, 0x62, 0xec, 0xdc, 0x14,
0x45, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x45, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x46, 0xee, 0x62, 0xec,
0xdc, 0x14, 0x46, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x47, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x47, 0x2e,
0x62, 0xec, 0xdc, 0x14, 0x48, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x48, 0x2e, 0x62, 0xec, 0xdc, 0x14,
0x49, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x49, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x4a, 0xee, 0x62, 0xec,
0xdc, 0x14, 0x4a, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x4b, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x4b, 0x2e,
0x62, 0xec, 0xdc, 0x14, 0x4c, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x4c, 0x2e, 0x62, 0xec, 0xdc, 0x14,
0x4d, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x4d, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x4e, 0xee, 0x62, 0xec,
0xdc, 0x14, 0x4e, 0x2e, 0x62, 0xec, 0xdc, 0x14, 0x4f, 0xee, 0x62, 0xec, 0xdc, 0x14, 0x4f, 0x2e,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
Expand Down
2 changes: 1 addition & 1 deletion xbyak/xbyak.h
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ class CodeGenerator : public CodeArray {
uint64_t type = dBit > 0 ? (T_MUST_EVEX|T_NF) : T_MUST_EVEX;
opROO(d, op2, op1, type, code);
} else {
opROO(d, op1, static_cast<const Reg&>(op2)|T_nf, T_MUST_EVEX|T_NF, 0x42);
opROO(d, op1, static_cast<const Reg&>(op2)|T_nf, T_MUST_EVEX|T_NF, code);
}
}
#ifdef XBYAK64
Expand Down

0 comments on commit 98ce73b

Please sign in to comment.