diff options
author | MITSUNARI Shigeo <[email protected]> | 2015-08-16 06:49:44 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2015-08-16 06:49:44 +0900 |
commit | f03bbc298d20c4831b7bfb23ea9378b84349a9ea (patch) | |
tree | 28acda3f1cf95317e557d7463869ffb5bf9e76ea | |
parent | 93aae57298703ad4525abbfbfa5ee4be048d3c3d (diff) | |
download | xbyak-f03bbc298d20c4831b7bfb23ea9378b84349a9ea.tar.gz xbyak-f03bbc298d20c4831b7bfb23ea9378b84349a9ea.zip |
check imm of mov(Operand, imm)
-rw-r--r-- | test/misc.cpp | 21 | ||||
-rw-r--r-- | xbyak/xbyak.h | 3 | ||||
-rw-r--r-- | xbyak/xbyak_mnemonic.h | 2 |
3 files changed, 22 insertions, 4 deletions
diff --git a/test/misc.cpp b/test/misc.cpp index 9b33497..7b5c887 100644 --- a/test/misc.cpp +++ b/test/misc.cpp @@ -30,5 +30,22 @@ CYBOZU_TEST_AUTO(compOperand) CYBOZU_TEST_ASSERT(ptr[eax] == ptr[eax]); CYBOZU_TEST_ASSERT(dword[eax] != ptr[eax]); CYBOZU_TEST_ASSERT(ptr[eax] != ptr[eax+3]); - CYBOZU_TEST_ASSERT(ptr[eax] != ptr[eax+3]); -}
\ No newline at end of file +} + +#ifdef XBYAK64 +CYBOZU_TEST_AUTO(mov_const) +{ + struct Code : Xbyak::CodeGenerator { + Code() + { + CYBOZU_TEST_NO_EXCEPTION(mov(dword[eax], -1)); + CYBOZU_TEST_NO_EXCEPTION(mov(dword[eax], 0x7fffffff)); + CYBOZU_TEST_NO_EXCEPTION(mov(dword[eax], -0x7fffffff)); + CYBOZU_TEST_NO_EXCEPTION(mov(dword[eax], 0xabcd1234)); + CYBOZU_TEST_NO_EXCEPTION(mov(dword[eax], 0xffffffff)); + CYBOZU_TEST_EXCEPTION(mov(dword[eax], 0x100000000ull), Xbyak::Error); + CYBOZU_TEST_EXCEPTION(mov(dword[eax], -0x80000000ull), Xbyak::Error); + } + } code; +} +#endif diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 13242b2..84eb27f 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -100,7 +100,7 @@ namespace Xbyak { enum { DEFAULT_MAX_CODE_SIZE = 4096, - VERSION = 0x4850 /* 0xABCD = A.BC(D) */ + VERSION = 0x4851 /* 0xABCD = A.BC(D) */ }; #ifndef MIE_INTEGER_TYPE_DEFINED @@ -1866,6 +1866,7 @@ public: } else if (op.isMEM()) { opModM(static_cast<const Address&>(op), Reg(0, Operand::REG, op.getBit()), B11000110); int size = op.getBit() / 8; if (size > 4) size = 4; + if (0xffffffff < imm && imm <= ~uint64(0x7fffffffu)) throw Error(ERR_OFFSET_IS_TOO_BIG); db(static_cast<uint32>(imm), size); } else { throw Error(ERR_BAD_COMBINATION); diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index 6f3bdb5..23d85d7 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -1,4 +1,4 @@ -const char *getVersionString() const { return "4.85"; } +const char *getVersionString() const { return "4.851"; } 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); } |