add cmpxchg

This commit is contained in:
MITSUNARI Shigeo 2015-01-28 12:04:20 +09:00
parent 151e253a2e
commit 95cf45e874
5 changed files with 23 additions and 8 deletions

View File

@ -1,5 +1,5 @@
Xbyak 4.70 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
Xbyak 4.71 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
=============
Abstract
@ -277,6 +277,7 @@ The header files under xbyak/ are independent of cybozulib.
History
-------------
* 2015/Jar/28 ver 4.71 support cmpxchg
* 2014/Oct/14 ver 4.70 support MmapAllocator
* 2014/Jun/13 ver 4.62 disable warning of VC2014
* 2014/May/30 ver 4.61 support bt, bts, btr, btc

View File

@ -1,5 +1,5 @@
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.70
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.71
-----------------------------------------------------------------------------
◎概要
@ -296,6 +296,7 @@ cybozulibは単体テストでのみ利用されていて、xbyak/ディレク
-----------------------------------------------------------------------------
◎履歴
2015/01/28 ver 4.71 cmpxchgのサポート
2014/10/14 ver 4.70 MmapAllocatorのサポート
2014/06/13 ver 4.62 VC2014で警告抑制
2014/05/30 ver 4.61 bt, bts, btr, btcのサポート

View File

@ -977,10 +977,19 @@ class Test {
#ifdef XBYAK64
put("cmpxchg16b", MEM);
#endif
put("xadd", REG8|MEM, REG8);
put("xadd", REG16|MEM, REG16);
put("xadd", REG32|MEM, REG32);
put("xadd", REG64|MEM, REG64);
{
const char tbl[][8] = {
"xadd",
"cmpxchg"
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const char *p = tbl[i];
put(p, REG8|MEM, REG8);
put(p, REG16|MEM, REG16);
put(p, REG32|MEM, REG32);
put(p, REG64|MEM, REG64);
}
}
put("xchg", AL|REG8, AL|REG8|MEM);
put("xchg", MEM, AL|REG8);

View File

@ -96,7 +96,7 @@ namespace Xbyak {
enum {
DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x4700 /* 0xABCD = A.BC(D) */
VERSION = 0x4710 /* 0xABCD = A.BC(D) */
};
#ifndef MIE_INTEGER_TYPE_DEFINED
@ -1851,6 +1851,10 @@ public:
{
opModRM(reg, op, (op.isREG() && reg.isREG() && op.getBit() == reg.getBit()), op.isMEM(), 0x0F, B11000000 | (reg.isBit(8) ? 0 : 1));
}
void cmpxchg(const Operand& op, const Reg& reg)
{
opModRM(reg, op, (op.isREG() && reg.isREG() && op.getBit() == reg.getBit()), op.isMEM(), 0x0F, 0xb0 | (reg.isBit(8) ? 0 : 1));
}
void xchg(const Operand& op1, const Operand& op2)
{
const Operand *p1 = &op1, *p2 = &op2;

View File

@ -1,4 +1,4 @@
const char *getVersionString() const { return "4.70"; }
const char *getVersionString() const { return "4.71"; }
void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); }
void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }