From 98ce73bb22d124a5c755c442aa083bb685c01e13 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 29 Nov 2023 18:01:30 +0900 Subject: [PATCH] add cfcmov tests --- test/apx.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ xbyak/xbyak.h | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/test/apx.cpp b/test/apx.cpp index 817c760d..b1f2b03e 100644 --- a/test/apx.cpp +++ b/test/apx.cpp @@ -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[] = { @@ -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); diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 9ceb7289..07aa3b3c 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -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(op2)|T_nf, T_MUST_EVEX|T_NF, 0x42); + opROO(d, op1, static_cast(op2)|T_nf, T_MUST_EVEX|T_NF, code); } } #ifdef XBYAK64