diff --git a/src/compiler.cpp b/src/compiler.cpp index fbdd80b372..311d4a288c 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -2320,13 +2320,17 @@ acceptMatch(Context* c, Site* s, Read*, const SiteMask& mask) Site* pickSourceSite(Context* c, Read* read, Site* target = 0, - unsigned* cost = 0, uint8_t typeMask = ~0, + unsigned* cost = 0, SiteMask* extraMask = 0, bool intersectRead = true, bool includeBuddies = true, bool includeNextWord = true, bool (*accept)(Context*, Site*, Read*, const SiteMask&) = acceptMatch) { - SiteMask mask(typeMask, ~0, AnyFrameIndex); + SiteMask mask; + + if (extraMask) { + mask = intersect(mask, *extraMask); + } if (intersectRead) { read->intersect(&mask); @@ -2477,7 +2481,7 @@ pickSiteOrMove(Context* c, Read* read, bool intersectRead, bool includeNextWord, unsigned registerReserveCount = 0) { Site* s = pickSourceSite - (c, read, 0, 0, ~0, intersectRead, true, includeNextWord); + (c, read, 0, 0, 0, intersectRead, true, includeNextWord); if (s) { return s; @@ -3594,7 +3598,7 @@ pickSiteOrMove(Context* c, Value* src, Value* dst, Site* nextWord, if (nextWord) { s = pickMatchOrMove(c, read, nextWord, index, false); } else { - s = pickSourceSite(c, read, 0, 0, ~0, false, true, true); + s = pickSourceSite(c, read, 0, 0, 0, false, true, true); if (s == 0 or s->isVolatile(c)) { s = maybeMove(c, read, false, true); @@ -5270,13 +5274,14 @@ resolveSourceSites(Context* c, Event* e, SiteRecordList* frozen, Site** sites) Read* r = live(v); if (r and sites[el.localIndex] == 0) { - const uint32_t mask = (1 << RegisterOperand) | (1 << MemoryOperand); + SiteMask mask((1 << RegisterOperand) | (1 << MemoryOperand), + c->arch->generalRegisterMask(), AnyFrameIndex); Site* s = pickSourceSite - (c, r, 0, 0, mask, true, false, true, acceptForResolve); + (c, r, 0, 0, &mask, true, false, true, acceptForResolve); if (s == 0) { s = pickSourceSite - (c, r, 0, 0, mask, false, false, true, acceptForResolve); + (c, r, 0, 0, &mask, false, false, true, acceptForResolve); } if (s) { @@ -5307,15 +5312,16 @@ resolveTargetSites(Context* c, Event* e, SiteRecordList* frozen, Site** sites) Read* r = live(v); if (r and sites[el.localIndex] == 0) { - const uint32_t mask = (1 << RegisterOperand) | (1 << MemoryOperand); + SiteMask mask((1 << RegisterOperand) | (1 << MemoryOperand), + c->arch->generalRegisterMask(), AnyFrameIndex); Site* s = pickSourceSite - (c, r, 0, 0, mask, true, true, true, acceptForResolve); + (c, r, 0, 0, &mask, true, true, true, acceptForResolve); if (s == 0) { s = pickSourceSite - (c, r, 0, 0, mask, false, true, true, acceptForResolve); + (c, r, 0, 0, &mask, false, true, true, acceptForResolve); if (s == 0) { - s = maybeMove(c, r, false, true, ResolveRegisterReserveCount); + s = maybeMove(c, v, mask, false, true, ResolveRegisterReserveCount); } } diff --git a/src/x86.cpp b/src/x86.cpp index 530333c1d6..8ca7b9d614 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -978,12 +978,12 @@ sseMoveRR(Context* c, unsigned aSize, Assembler::Register* a, opcode(c, 0xf3); maybeRex(c, 4, a, b); opcode(c, 0x0f, 0x10); - modrm(c, 0xc0, b, a); + modrm(c, 0xc0, a, b); } else { opcode(c, 0xf2); - maybeRex(c, 4, a, b); + maybeRex(c, 8, a, b); opcode(c, 0x0f, 0x10); - modrm(c, 0xc0, b, a); + modrm(c, 0xc0, a, b); } } else if (floatReg(a)) { opcode(c, 0x66); @@ -1118,7 +1118,6 @@ sseMoveMR(Context* c, unsigned aSize, Assembler::Memory* a, unsigned bSize UNUSED, Assembler::Register* b) { assert(c, aSize >= 4); - assert(c, aSize == bSize); if (BytesPerWord == 4 and aSize == 8) { opcode(c, 0xf3);