fix Address::operator==()

This commit is contained in:
MITSUNARI Shigeo 2015-08-10 10:55:07 +09:00
parent 1e208fd202
commit 93aae57298
5 changed files with 31 additions and 5 deletions

View file

@ -1,5 +1,5 @@
Xbyak 4.84 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++ Xbyak 4.85 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
============= =============
Abstract Abstract
@ -277,6 +277,7 @@ The header files under xbyak/ are independent of cybozulib.
History History
------------- -------------
* 2015/Aug/10 ver 4.85 Address::operator==() is not correct(thanks to inolen)
* 2015/Jun/22 ver 4.84 call() support variadic template if available(thanks to randomstuff) * 2015/Jun/22 ver 4.84 call() support variadic template if available(thanks to randomstuff)
* 2015/Jun/16 ver 4.83 support movbe(thanks to benvanik) * 2015/Jun/16 ver 4.83 support movbe(thanks to benvanik)
* 2015/May/24 ver 4.82 support detection of F16C * 2015/May/24 ver 4.82 support detection of F16C

View file

@ -1,5 +1,5 @@
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.84 C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.85
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
◎概要 ◎概要
@ -296,6 +296,7 @@ cybozulibは単体テストでのみ利用されていて、xbyak/ディレク
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
◎履歴 ◎履歴
2015/08/10 ver 4.85 Address::operator==()が間違っている(thanks to inolen)
2015/07/22 ver 4.84 call()がvariadic template対応 2015/07/22 ver 4.84 call()がvariadic template対応
2015/05/24 ver 4.83 mobveサポート(thanks to benvanik) 2015/05/24 ver 4.83 mobveサポート(thanks to benvanik)
2015/05/24 ver 4.82 F16Cが使えるかどうかの判定追加 2015/05/24 ver 4.82 F16Cが使えるかどうかの判定追加

View file

@ -21,3 +21,14 @@ CYBOZU_TEST_AUTO(setSize)
} }
} code; } code;
} }
CYBOZU_TEST_AUTO(compOperand)
{
using namespace Xbyak::util;
CYBOZU_TEST_ASSERT(eax == eax);
CYBOZU_TEST_ASSERT(ecx != xmm0);
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]);
}

View file

@ -100,7 +100,7 @@ namespace Xbyak {
enum { enum {
DEFAULT_MAX_CODE_SIZE = 4096, DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x4840 /* 0xABCD = A.BC(D) */ VERSION = 0x4850 /* 0xABCD = A.BC(D) */
}; };
#ifndef MIE_INTEGER_TYPE_DEFINED #ifndef MIE_INTEGER_TYPE_DEFINED
@ -411,7 +411,8 @@ public:
} }
throw Error(ERR_INTERNAL); throw Error(ERR_INTERNAL);
} }
bool operator==(const Operand& rhs) const { return idx_ == rhs.idx_ && kind_ == rhs.kind_ && bit_ == rhs.bit_; } bool isSameNotInherited(const Operand& rhs) const { return idx_ == rhs.idx_ && kind_ == rhs.kind_ && bit_ == rhs.bit_; }
bool operator==(const Operand& rhs) const;
bool operator!=(const Operand& rhs) const { return !operator==(rhs); } bool operator!=(const Operand& rhs) const { return !operator==(rhs); }
}; };
@ -870,8 +871,20 @@ public:
void setRex(uint8 rex) { rex_ = rex; } void setRex(uint8 rex) { rex_ = rex; }
void setLabel(const Label* label) { label_ = label; } void setLabel(const Label* label) { label_ = label; }
const Label* getLabel() const { return label_; } const Label* getLabel() const { return label_; }
bool operator==(const Address& rhs) const
{
return getBit() == rhs.getBit() && size_ == rhs.size_ && rex_ == rhs.rex_ && disp_ == rhs.disp_ && label_ == rhs.label_ && isOnlyDisp_ == rhs.isOnlyDisp_
&& is64bitDisp_ == rhs.is64bitDisp_ && is32bit_ == rhs.is32bit_ && isVsib_ == rhs.isVsib_ && isYMM_ == rhs.isYMM_;
}
bool operator!=(const Address& rhs) const { return !operator==(rhs); }
}; };
inline bool Operand::operator==(const Operand& rhs) const
{
if (isMEM() && rhs.isMEM()) return static_cast<const Address&>(*this) == static_cast<const Address&>(rhs);
return isSameNotInherited(rhs);
}
class AddressFrame { class AddressFrame {
private: private:
void operator=(const AddressFrame&); void operator=(const AddressFrame&);

View file

@ -1,4 +1,4 @@
const char *getVersionString() const { return "4.84"; } const char *getVersionString() const { return "4.85"; }
void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); } 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 packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); } void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }