diff options
author | MITSUNARI Shigeo <[email protected]> | 2023-12-26 13:38:18 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2023-12-26 13:38:18 +0900 |
commit | 5438fc69dbc0ee92a1536e4f8572c45070390df9 (patch) | |
tree | da94073429e7aaae27fdaabab95b054b2a2f8a72 | |
parent | f17cb9d6b94c44e0c7f2b569b0e360c416e628d5 (diff) | |
parent | ee26c094ed0e2a20ca5514ea26587614d0d582ca (diff) | |
download | xbyak-5438fc69dbc0ee92a1536e4f8572c45070390df9.tar.gz xbyak-5438fc69dbc0ee92a1536e4f8572c45070390df9.zip |
Merge branch 'dev'v7.03
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | doc/changelog.md | 1 | ||||
-rw-r--r-- | doc/usage.md | 10 | ||||
-rw-r--r-- | gen/gen_code.cpp | 8 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | readme.md | 2 | ||||
-rw-r--r-- | readme.txt | 3 | ||||
-rw-r--r-- | sample/Makefile | 10 | ||||
-rw-r--r-- | sample/ccmp.cpp | 68 | ||||
-rw-r--r-- | sample/zero_upper.cpp | 48 | ||||
-rw-r--r-- | xbyak/xbyak.h | 2 | ||||
-rw-r--r-- | xbyak/xbyak_mnemonic.h | 226 |
12 files changed, 259 insertions, 123 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e61de1f..182a5de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(xbyak LANGUAGES CXX VERSION 7.02) +project(xbyak LANGUAGES CXX VERSION 7.03) file(GLOB headers xbyak/*.h) diff --git a/doc/changelog.md b/doc/changelog.md index aec29a4..df966c9 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -1,5 +1,6 @@ # History +* 2023/Dec/26 ver 7.03 set the default value of dfv to 0 * 2023/Dec/20 ver 7.02 SHA* support APX * 2023/Dec/19 ver 7.01 support AESKLE, WIDE_KL, KEYLOCKER, KEYLOCKER_WIDE, detection of APX10/APX * 2023/Dec/01 ver 7.00 support APX diff --git a/doc/usage.md b/doc/usage.md index e0ecccc..0911b91 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -145,6 +145,16 @@ vpdpbusd(xm0, xm1, xm2); // VEX encoding - `imul(ax|T_zu, cx, 0x1234);` // Set ND=ZU - `imul(ax|T_zu|T_nf, cx, 0x1234);` // Set ND=ZU and EVEX.NF=1 - `setb(r31b|T_zu);` // same as set(r31b); movzx(r31, r31b); + - See [sample/zero_upper.cpp](../sample/zero_upper.cpp) + +### ccmpSCC and ctestSCC + +- ccmpSCC(op1, op2, dfv = 0); // eflags = eflags == SCC ? cmp(op1, op2) : dfv +- ctestSCC(op1, op2, dfv = 0); // eflags = eflags == SCC ? test(op1, op2) : dfv +- SCC means source condition code such as z, a, gt. +- See [sample/ccmp.cpp](../sample/ccmp.cpp) +- Specify the union of T_of(=8), T_sf(=4), T_zf(=2), or T_cf(=1) for dfv. + ## Label Two kinds of Label are supported. (String literal and Label class). diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp index d1a0bd7..13b9ab6 100644 --- a/gen/gen_code.cpp +++ b/gen/gen_code.cpp @@ -635,10 +635,10 @@ void put() // ccmpscc // true if SCC = 0b1010, false if SCC = 0b1011 (see APX Architecture Specification p.266) const char *s = p->ext == 10 ? "t" : p->ext == 11 ? "f" : p->name; - printf("void ccmp%s(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, %d); }\n", s, p->ext); - printf("void ccmp%s(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, %d); }\n", s, p->ext); - printf("void ctest%s(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, %d); }\n", s, p->ext); - printf("void ctest%s(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, %d); }\n", s, p->ext); + printf("void ccmp%s(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, %d); }\n", s, p->ext); + printf("void ccmp%s(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, %d); }\n", s, p->ext); + printf("void ctest%s(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, %d); }\n", s, p->ext); + printf("void ctest%s(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, %d); }\n", s, p->ext); } } { diff --git a/meson.build b/meson.build index edc97cd..abe46f8 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ project( 'xbyak', 'cpp', - version: '7.02', + version: '7.03', license: 'BSD-3-Clause', default_options: 'b_ndebug=if-release' ) @@ -1,5 +1,5 @@ -# Xbyak 7.02 [![Badge Build]][Build Status] +# Xbyak 7.03 [![Badge Build]][Build Status] *A C++ JIT assembler for x86 (IA32), x64 (AMD64, x86-64)* @@ -1,5 +1,5 @@ - C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.02
+ C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 7.03
-----------------------------------------------------------------------------
◎概要
@@ -404,6 +404,7 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から -----------------------------------------------------------------------------
◎履歴
+2023/12/26 ver 7.03 dfvのデフォルト値を0に設定
2023/12/20 ver 7.02 SHA*のAPX対応
2023/12/19 ver 7.01 AESKLE, WIDE_KL, KEYLOCKER, KEYLOCKER_WIDE対応 APX10/APX判定対応
2023/12/01 ver 7.00 APX対応
diff --git a/sample/Makefile b/sample/Makefile index 62c7dcf..2010f69 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -30,7 +30,7 @@ else endif ifeq ($(BIT),64) -TARGET += test64 bf64 memfunc64 test_util64 jmp_table64 +TARGET += test64 bf64 memfunc64 test_util64 jmp_table64 zero_upper ccmp ifeq ($(BOOST_EXIST),1) TARGET += calc64 #calc2_64 endif @@ -103,6 +103,14 @@ profiler: profiler.cpp ../xbyak/xbyak_util.h $(CXX) $(CFLAGS) profiler.cpp -o $@ profiler-vtune: profiler.cpp ../xbyak/xbyak_util.h $(CXX) $(CFLAGS) profiler.cpp -o $@ -DXBYAK_USE_VTUNE -I /opt/intel/vtune_amplifier/include/ -L /opt/intel/vtune_amplifier/lib64 -ljitprofiling -ldl +zero_upper: zero_upper.cpp $(XBYAK_INC) + $(CXX) $(CFLAGS) zero_upper.cpp -o $@ +test_zero_upper: zero_upper + sde -future -- ./zero_upper +ccmp: ccmp.cpp $(XBYAK_INC) + $(CXX) $(CFLAGS) ccmp.cpp -o $@ +test_ccmp: ccmp + sde -future -- ./ccmp clean: rm -rf $(TARGET) profiler profiler-vtune diff --git a/sample/ccmp.cpp b/sample/ccmp.cpp new file mode 100644 index 0000000..622d3d1 --- /dev/null +++ b/sample/ccmp.cpp @@ -0,0 +1,68 @@ +/* + An example of ccmp + > g++ ccmp.cpp -I ../xbyak + > sde -future -- ./a.out +*/ +#include <stdio.h> +#include <xbyak/xbyak.h> +#include <xbyak/xbyak_util.h> + +using namespace Xbyak; + +struct Code1 : Xbyak::CodeGenerator { + Code1() + { + Xbyak::util::StackFrame sf(this, 2); + const auto& p1 = sf.p[0]; + const auto& p2 = sf.p[1]; + int dfv = 0; + cmp(p1, 3); + ctesta(p2, 1, dfv); // eflags = (p1 > 3) ? (p2 & 1) : dfv; + setz(al|T_zu); + } +}; + +struct Code2 : Xbyak::CodeGenerator { + Code2() + { + Xbyak::util::StackFrame sf(this, 3); + const auto& p1 = sf.p[0]; + const auto& p2 = sf.p[1]; + const auto& p3 = sf.p[2]; + int dfv = 0; + cmp(p1, 1); + ccmpe(p2, 2, dfv); // eflags = p1==1 ? p2==2 : dfv; + ccmpe(p3, 3, dfv); // eflags = (p1==1 && p2==2) ? p3==3 : dfv; + setz(al|T_zu); // p1==1 && p2==2 && p3==3 + } +}; + + +int main() + try +{ + { + puts("(p1 > 3) && ((p2 & 1) == 0)"); + Code1 c; + auto f = c.getCode<int (*)(int, int)>(); + for (int p1 = 2; p1 < 5; p1++) { + for (int p2 = 0; p2 < 3; p2++) { + printf("p1=%d p2=%d ret=%d (%d)\n", p1, p2, f(p1, p2), p1 > 3 && ((p2&1) == 0)); + } + } + } + { + puts("p1 == 1 && p2 == 2 && p3 == 3"); + Code2 c; + auto f = c.getCode<int (*)(int, int, int)>(); + for (int p1 = 0; p1 < 3; p1++) { + for (int p2 = 1; p2 < 4; p2++) { + for (int p3 = 2; p3 < 5; p3++) { + printf("p1=%d p2=%d p3=%d ret=%d (%d)\n", p1, p2, p3, f(p1, p2, p3), p1==1 && p2==2 && p3==3); + } + } + } + } +} catch (std::exception& e) { + printf("ERR %s\n", e.what()); +} diff --git a/sample/zero_upper.cpp b/sample/zero_upper.cpp new file mode 100644 index 0000000..46dcca9 --- /dev/null +++ b/sample/zero_upper.cpp @@ -0,0 +1,48 @@ +/* + An example of T_zu (zero upper) flag + > g++ zero_upper.cpp -I ../xbyak + > sde -future -- ./a.out +*/ +#include <stdio.h> +#include <xbyak/xbyak.h> + +using namespace Xbyak; + +struct Code : Xbyak::CodeGenerator { + Code(int mode) + { + mov(eax, 0x12345678); + cmp(eax, eax); // ZF=1 + switch (mode) { + case 0: // imul + puts("imul"); + imul(ax,ax, 0x1234); + break; + case 1: // imul+zu + puts("imul+zu"); + imul(ax|T_zu, ax, 0x1234); + break; + case 2: // setz + puts("setz"); + setz(al); + break; + case 3: // setz+zu + puts("setz+zu"); + setz(al|T_zu); + break; + } + ret(); + } +}; + +int main() + try +{ + for (int mode = 0; mode < 4; mode++) { + Code c(mode); + auto f = c.getCode<int (*)()>(); + printf("ret=%08x\n", f()); + } +} catch (std::exception& e) { + printf("ERR %s\n", e.what()); +} diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index c99e809..7c20b13 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -155,7 +155,7 @@ namespace Xbyak { enum { DEFAULT_MAX_CODE_SIZE = 4096, - VERSION = 0x7020 /* 0xABCD = A.BC(.D) */ + VERSION = 0x7030 /* 0xABCD = A.BC(.D) */ }; #ifndef MIE_INTEGER_TYPE_DEFINED diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index d863d46..5392492 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -1,4 +1,4 @@ -const char *getVersionString() const { return "7.02"; } +const char *getVersionString() const { return "7.03"; } void aadd(const Address& addr, const Reg32e ®) { opMR(addr, reg, T_0F38, 0x0FC); } void aand(const Address& addr, const Reg32e ®) { opMR(addr, reg, T_0F38 | T_66, 0x0FC); } void adc(const Operand& op, uint32_t imm) { opOI(op, imm, 0x10, 2); } @@ -66,62 +66,62 @@ void bts(const Operand& op, const Reg& reg) { opRO(reg, op, T_0F, 0xAB, op.isREG void bts(const Operand& op, uint8_t imm) { opRext(op, 16|i32e, 5, T_0F, 0xba, false, 1); db(imm); } void bzhi(const Reg32e& r1, const Operand& op, const Reg32e& r2) { opRRO(r1, r2, op, T_APX|T_0F38|T_NF, 0xf5); } void cbw() { db(0x66); db(0x98); } -void ccmpa(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 7); } -void ccmpa(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 7); } -void ccmpae(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 3); } -void ccmpae(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 3); } -void ccmpb(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 2); } -void ccmpb(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 2); } -void ccmpbe(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 6); } -void ccmpbe(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 6); } -void ccmpc(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 2); } -void ccmpc(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 2); } -void ccmpe(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 4); } -void ccmpe(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 4); } -void ccmpf(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 11); } -void ccmpf(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 11); } -void ccmpg(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 15); } -void ccmpg(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 15); } -void ccmpge(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 13); } -void ccmpge(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 13); } -void ccmpl(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 12); } -void ccmpl(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 12); } -void ccmple(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 14); } -void ccmple(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 14); } -void ccmpna(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 6); } -void ccmpna(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 6); } -void ccmpnae(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 2); } -void ccmpnae(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 2); } -void ccmpnb(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 3); } -void ccmpnb(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 3); } -void ccmpnbe(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 7); } -void ccmpnbe(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 7); } -void ccmpnc(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 3); } -void ccmpnc(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 3); } -void ccmpne(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 5); } -void ccmpne(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 5); } -void ccmpng(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 14); } -void ccmpng(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 14); } -void ccmpnge(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 12); } -void ccmpnge(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 12); } -void ccmpnl(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 13); } -void ccmpnl(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 13); } -void ccmpnle(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 15); } -void ccmpnle(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 15); } -void ccmpno(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 1); } -void ccmpno(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 1); } -void ccmpns(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 9); } -void ccmpns(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 9); } -void ccmpnz(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 5); } -void ccmpnz(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 5); } -void ccmpo(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 0); } -void ccmpo(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 0); } -void ccmps(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 8); } -void ccmps(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 8); } -void ccmpt(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 10); } -void ccmpt(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 10); } -void ccmpz(const Operand& op, int imm, int dfv) { opCcmpi(op, imm, dfv, 4); } -void ccmpz(const Operand& op1, const Operand& op2, int dfv) { opCcmp(op1, op2, dfv, 0x38, 4); } +void ccmpa(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 7); } +void ccmpa(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 7); } +void ccmpae(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 3); } +void ccmpae(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 3); } +void ccmpb(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 2); } +void ccmpb(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 2); } +void ccmpbe(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 6); } +void ccmpbe(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 6); } +void ccmpc(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 2); } +void ccmpc(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 2); } +void ccmpe(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 4); } +void ccmpe(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 4); } +void ccmpf(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 11); } +void ccmpf(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 11); } +void ccmpg(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 15); } +void ccmpg(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 15); } +void ccmpge(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 13); } +void ccmpge(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 13); } +void ccmpl(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 12); } +void ccmpl(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 12); } +void ccmple(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 14); } +void ccmple(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 14); } +void ccmpna(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 6); } +void ccmpna(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 6); } +void ccmpnae(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 2); } +void ccmpnae(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 2); } +void ccmpnb(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 3); } +void ccmpnb(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 3); } +void ccmpnbe(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 7); } +void ccmpnbe(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 7); } +void ccmpnc(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 3); } +void ccmpnc(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 3); } +void ccmpne(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 5); } +void ccmpne(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 5); } +void ccmpng(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 14); } +void ccmpng(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 14); } +void ccmpnge(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 12); } +void ccmpnge(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 12); } +void ccmpnl(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 13); } +void ccmpnl(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 13); } +void ccmpnle(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 15); } +void ccmpnle(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 15); } +void ccmpno(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 1); } +void ccmpno(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 1); } +void ccmpns(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 9); } +void ccmpns(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 9); } +void ccmpnz(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 5); } +void ccmpnz(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 5); } +void ccmpo(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 0); } +void ccmpo(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 0); } +void ccmps(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 8); } +void ccmps(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 8); } +void ccmpt(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 10); } +void ccmpt(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 10); } +void ccmpz(const Operand& op, int imm, int dfv = 0) { opCcmpi(op, imm, dfv, 4); } +void ccmpz(const Operand& op1, const Operand& op2, int dfv = 0) { opCcmp(op1, op2, dfv, 0x38, 4); } void cdq() { db(0x99); } void cfcmovb(const Operand& op1, const Operand& op2) { opCfcmov(Reg(), op1, op2, 0x42); } void cfcmovb(const Reg& d, const Reg& r, const Operand& op) { opCfcmov(d|T_nf, op, r, 0x42); } @@ -271,62 +271,62 @@ void comisd(const Xmm& xmm, const Operand& op) { opSSE(xmm, op, T_66|T_0F, 0x2F, void comiss(const Xmm& xmm, const Operand& op) { opSSE(xmm, op, T_0F, 0x2F, isXMM_XMMorMEM); } void cpuid() { db(0x0F); db(0xA2); } void crc32(const Reg32e& r, const Operand& op) { if (!((r.isBit(32) && op.isBit(8|16|32)) || (r.isBit(64) && op.isBit(8|64)))) XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER) int code = 0xF0 | (op.isBit(8) ? 0 : 1); uint64_t type = op.isBit(16) ? T_66:0; if (opROO(Reg(), op, static_cast<const Reg&>(r), T_APX|type, code)) return; opRO(r, op, T_F2|T_0F38|type, code); } -void ctesta(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 7); } -void ctesta(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 7); } -void ctestae(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 3); } -void ctestae(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 3); } -void ctestb(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 2); } -void ctestb(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 2); } -void ctestbe(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 6); } -void ctestbe(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 6); } -void ctestc(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 2); } -void ctestc(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 2); } -void cteste(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 4); } -void cteste(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 4); } -void ctestf(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 11); } -void ctestf(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 11); } -void ctestg(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 15); } -void ctestg(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 15); } -void ctestge(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 13); } -void ctestge(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 13); } -void ctestl(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 12); } -void ctestl(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 12); } -void ctestle(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 14); } -void ctestle(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 14); } -void ctestna(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 6); } -void ctestna(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 6); } -void ctestnae(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 2); } -void ctestnae(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 2); } -void ctestnb(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 3); } -void ctestnb(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 3); } -void ctestnbe(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 7); } -void ctestnbe(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 7); } -void ctestnc(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 3); } -void ctestnc(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 3); } -void ctestne(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 5); } -void ctestne(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 5); } -void ctestng(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 14); } -void ctestng(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 14); } -void ctestnge(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 12); } -void ctestnge(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 12); } -void ctestnl(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 13); } -void ctestnl(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 13); } -void ctestnle(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 15); } -void ctestnle(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 15); } -void ctestno(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 1); } -void ctestno(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 1); } -void ctestns(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 9); } -void ctestns(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 9); } -void ctestnz(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 5); } -void ctestnz(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 5); } -void ctesto(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 0); } -void ctesto(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 0); } -void ctests(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 8); } -void ctests(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 8); } -void ctestt(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 10); } -void ctestt(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 10); } -void ctestz(const Operand& op, const Reg& r, int dfv) { opCcmp(op, r, dfv, 0x84, 4); } -void ctestz(const Operand& op, int imm, int dfv) { opTesti(op, imm, dfv, 4); } +void ctesta(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 7); } +void ctesta(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 7); } +void ctestae(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 3); } +void ctestae(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 3); } +void ctestb(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 2); } +void ctestb(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 2); } +void ctestbe(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 6); } +void ctestbe(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 6); } +void ctestc(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 2); } +void ctestc(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 2); } +void cteste(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 4); } +void cteste(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 4); } +void ctestf(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 11); } +void ctestf(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 11); } +void ctestg(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 15); } +void ctestg(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 15); } +void ctestge(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 13); } +void ctestge(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 13); } +void ctestl(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 12); } +void ctestl(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 12); } +void ctestle(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 14); } +void ctestle(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 14); } +void ctestna(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 6); } +void ctestna(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 6); } +void ctestnae(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 2); } +void ctestnae(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 2); } +void ctestnb(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 3); } +void ctestnb(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 3); } +void ctestnbe(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 7); } +void ctestnbe(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 7); } +void ctestnc(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 3); } +void ctestnc(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 3); } +void ctestne(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 5); } +void ctestne(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 5); } +void ctestng(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 14); } +void ctestng(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 14); } +void ctestnge(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 12); } +void ctestnge(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 12); } +void ctestnl(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 13); } +void ctestnl(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 13); } +void ctestnle(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 15); } +void ctestnle(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 15); } +void ctestno(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 1); } +void ctestno(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 1); } +void ctestns(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 9); } +void ctestns(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 9); } +void ctestnz(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 5); } +void ctestnz(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 5); } +void ctesto(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 0); } +void ctesto(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 0); } +void ctests(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 8); } +void ctests(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 8); } +void ctestt(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 10); } +void ctestt(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 10); } +void ctestz(const Operand& op, const Reg& r, int dfv = 0) { opCcmp(op, r, dfv, 0x84, 4); } +void ctestz(const Operand& op, int imm, int dfv = 0) { opTesti(op, imm, dfv, 4); } void cvtdq2pd(const Xmm& xmm, const Operand& op) { opSSE(xmm, op, T_F3|T_0F, 0xE6, isXMM_XMMorMEM); } void cvtdq2ps(const Xmm& xmm, const Operand& op) { opSSE(xmm, op, T_0F, 0x5B, isXMM_XMMorMEM); } void cvtpd2dq(const Xmm& xmm, const Operand& op) { opSSE(xmm, op, T_F2|T_0F, 0xE6, isXMM_XMMorMEM); } |