add bt, bts, btr, btc

This commit is contained in:
MITSUNARI Shigeo 2014-05-30 21:38:07 +09:00
parent 6336756580
commit df27af3e4e
6 changed files with 48 additions and 4 deletions

View file

@ -634,6 +634,23 @@ void put()
printf("void %s(const Operand& op) { opIncDec(op, 0x%02X, %d); }\n", p->name, p->code, p->ext);
}
}
{
const struct Tbl {
uint8 code;
uint8 ext;
const char *name;
} tbl[] = {
{ 0xa3, 4, "bt" },
{ 0xab, 5, "bts" },
{ 0xb3, 6, "btr" },
{ 0xbb, 7, "btc" },
};
for (int i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const Tbl *p = &tbl[i];
printf("void %s(const Operand& op, const Reg& reg) { opModRM(reg, op, op.isREG(16|32|64) && op.getBit() == reg.getBit(), op.isMEM(), 0x0f, 0x%02x); }\n", p->name, p->code);
printf("void %s(const Operand& op, uint8 imm) { opR_ModM(op, 16|32|64, %d, 0x0f, 0xba); db(imm); }\n", p->name, p->ext);
}
}
{
const struct Tbl {
uint8 code;

View file

@ -1,5 +1,5 @@
Xbyak 4.60 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
Xbyak 4.61 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
=============
Abstract
@ -269,6 +269,7 @@ The header files under xbyak/ are independent of cybozulib.
History
-------------
* 2014/May/30 ver 4.61 support bt, bts, btr, btc
* 2014/May/28 ver 4.60 support vcvtph2ps, vcvtps2ph
* 2014/Apr/11 ver 4.52 add detection of rdrand
* 2014/Mar/25 ver 4.51 remove state information of unreferenced labels

View file

@ -1,5 +1,5 @@
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.60
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.61
-----------------------------------------------------------------------------
◎概要
@ -285,6 +285,7 @@ cybozulibは単体テストでのみ利用されていて、xbyak/ディレク
-----------------------------------------------------------------------------
◎履歴
2014/05/30 ver 4.61 bt, bts, btr, btcのサポート
2014/05/28 ver 4.60 vcvtph2ps, vcvtps2phのサポート
2014/04/11 ver 4.52 rdrandの判定追加
2014/03/25 ver 4.51 参照されなくなったラベルの状態を削除する

View file

@ -829,6 +829,22 @@ class Test {
put(p, REG8|REG8_3|AL, IMM|NEG8);
}
}
void putBt() const
{
static const char tbl[][16] = {
"bt",
"bts",
"btr",
"btc",
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const char *p = tbl[i];
put(p, MEM|REG16, REG16);
put(p, MEM|REG32, REG32);
put(p, MEM|REG64, REG64);
put(p, MEM16|REG16, IMM);
}
}
void putRorM() const
{
static const char tbl[][16] = {
@ -2121,6 +2137,7 @@ public:
#else
putSIMPLE();
putReg1();
putBt();
putRorM();
separateFunc();
putPushPop();

View file

@ -91,7 +91,7 @@ namespace Xbyak {
enum {
DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x4600 /* 0xABCD = A.BC(D) */
VERSION = 0x4610 /* 0xABCD = A.BC(D) */
};
#ifndef MIE_INTEGER_TYPE_DEFINED

View file

@ -1,4 +1,4 @@
const char *getVersionString() const { return "4.60"; }
const char *getVersionString() const { return "4.61"; }
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); }
@ -441,6 +441,14 @@ void xor(const Operand& op, uint32 imm) { opRM_I(op, imm, 0x30, 6); }
#endif
void dec(const Operand& op) { opIncDec(op, 0x48, 1); }
void inc(const Operand& op) { opIncDec(op, 0x40, 0); }
void bt(const Operand& op, const Reg& reg) { opModRM(reg, op, op.isREG(16|32|64) && op.getBit() == reg.getBit(), op.isMEM(), 0x0f, 0xa3); }
void bt(const Operand& op, uint8 imm) { opR_ModM(op, 16|32|64, 4, 0x0f, 0xba); db(imm); }
void bts(const Operand& op, const Reg& reg) { opModRM(reg, op, op.isREG(16|32|64) && op.getBit() == reg.getBit(), op.isMEM(), 0x0f, 0xab); }
void bts(const Operand& op, uint8 imm) { opR_ModM(op, 16|32|64, 5, 0x0f, 0xba); db(imm); }
void btr(const Operand& op, const Reg& reg) { opModRM(reg, op, op.isREG(16|32|64) && op.getBit() == reg.getBit(), op.isMEM(), 0x0f, 0xb3); }
void btr(const Operand& op, uint8 imm) { opR_ModM(op, 16|32|64, 6, 0x0f, 0xba); db(imm); }
void btc(const Operand& op, const Reg& reg) { opModRM(reg, op, op.isREG(16|32|64) && op.getBit() == reg.getBit(), op.isMEM(), 0x0f, 0xbb); }
void btc(const Operand& op, uint8 imm) { opR_ModM(op, 16|32|64, 7, 0x0f, 0xba); db(imm); }
void div(const Operand& op) { opR_ModM(op, 0, 6, 0xF6); }
void idiv(const Operand& op) { opR_ModM(op, 0, 7, 0xF6); }
void imul(const Operand& op) { opR_ModM(op, 0, 5, 0xF6); }