fix wrong addressing for xmm2

This commit is contained in:
MITSUNARI Shigeo 2015-04-23 09:21:00 +09:00
parent 2158b53871
commit c81d6d8311
3 changed files with 21 additions and 21 deletions

View file

@ -951,9 +951,11 @@ CYBOZU_TEST_AUTO(rip)
db(a[1], 4);
L("@@");
mov(eax, ptr [rip + label1]); // a[0]
add(eax, ptr [rip + label1+4]); // a[1]
add(eax, ptr [rip + label2-8+2+6]); // b[0]
add(eax, ptr [rip + 16+label2-12]); // b[1]
mov(ecx, ptr [rip + label1+4]); // a[1]
mov(edx, ptr [rip + label2-8+2+6]); // b[0]
add(ecx, ptr [rip + 16+label2-12]); // b[1]
add(eax, ecx);
add(eax, edx);
ret();
L(label2);
db(b[0], 4);

View file

@ -454,6 +454,15 @@ class Test {
#ifdef XBYAK64
put("jmp", "ptr[(void*)0x12345678]", "[0x12345678]");
put("call", "ptr[(void*)0x12345678]", "[0x12345678]");
if (isXbyak_) {
puts("{ Label label0;");
puts("L(label0);");
puts("pshufb (xmm14, ptr [rip+label0]); dump();");
puts("}");
} else {
puts("label0:");
puts("pshufb xmm14, [rel label0]");
}
#ifdef USE_YASM
put("jmp", "ptr[rip + 0x12345678]", "[rip+0x12345678]");
put("call", "ptr[rip + 0x12345678]", "[rip+0x12345678]");

View file

@ -842,19 +842,6 @@ public:
, isYMM_(isYMM)
{
}
Address(uint32 sizeBit, const Label *label, uint64 disp)
: Operand(0, MEM, sizeBit)
, size_(0)
, rex_(0)
, disp_(disp)
, label_(label)
, isOnlyDisp_(false)
, is64bitDisp_(false)
, is32bit_(false)
, isVsib_(false)
, isYMM_(false)
{
}
void db(int code)
{
if (size_ >= sizeof(top_)) throw Error(ERR_CODE_IS_TOO_BIG);
@ -876,6 +863,7 @@ public:
uint8 getRex() const { verify(); return rex_; }
bool is64bitDisp() const { verify(); return is64bitDisp_; } // for moffset
void setRex(uint8 rex) { rex_ = rex; }
void setLabel(const Label* label) { label_ = label; }
const Label* getLabel() const { return label_; }
};
@ -947,10 +935,13 @@ public:
}
Address operator[](const RegRip& addr) const
{
if (addr.label_) return Address(bit_, addr.label_, addr.disp_);
Address frame(bit_, true, addr.disp_, false);
frame.db(0x05);
frame.dd(inner::VerifyInInt32(addr.disp_));
if (addr.label_) {
frame.setLabel(addr.label_);
} else {
frame.dd(inner::VerifyInInt32(addr.disp_));
}
return frame;
}
#endif
@ -1368,11 +1359,9 @@ private:
}
void opAddr(const Address &addr)
{
db(addr.getCode(), static_cast<int>(addr.getSize()));
if (addr.getLabel()) { // [rip + Label]
db(0x05);
putL_inner(*addr.getLabel(), true, addr.getDisp());
} else {
db(addr.getCode(), static_cast<int>(addr.getSize()));
}
}
/* preCode is for SSSE3/SSE4 */