EmitZeroExtendLongToQuad: Do not rely on register allocator to zero extend 64->128
This commit is contained in:
parent
f4f774f9f6
commit
b2d99eddc6
2 changed files with 10 additions and 5 deletions
|
@ -1196,8 +1196,10 @@ void EmitX64::EmitZeroExtendWordToLong(EmitContext& ctx, IR::Inst* inst) {
|
||||||
void EmitX64::EmitZeroExtendLongToQuad(EmitContext& ctx, IR::Inst* inst) {
|
void EmitX64::EmitZeroExtendLongToQuad(EmitContext& ctx, IR::Inst* inst) {
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
if (args[0].IsInGpr()) {
|
if (args[0].IsInGpr()) {
|
||||||
// We let the register allocator automatically zero extend this when necessary
|
Xbyak::Reg64 source = ctx.reg_alloc.UseGpr(args[0]);
|
||||||
ctx.reg_alloc.DefineValue(inst, args[0]);
|
Xbyak::Xmm result = ctx.reg_alloc.ScratchXmm();
|
||||||
|
code->movq(result, source);
|
||||||
|
ctx.reg_alloc.DefineValue(inst, result);
|
||||||
} else {
|
} else {
|
||||||
Xbyak::Xmm result = ctx.reg_alloc.UseScratchXmm(args[0]);
|
Xbyak::Xmm result = ctx.reg_alloc.UseScratchXmm(args[0]);
|
||||||
code->movq(result, result);
|
code->movq(result, result);
|
||||||
|
|
|
@ -558,19 +558,22 @@ void RegAlloc::EmitMove(HostLoc to, HostLoc from) {
|
||||||
if (HostLocIsXMM(to) && HostLocIsXMM(from)) {
|
if (HostLocIsXMM(to) && HostLocIsXMM(from)) {
|
||||||
code->movaps(HostLocToXmm(to), HostLocToXmm(from));
|
code->movaps(HostLocToXmm(to), HostLocToXmm(from));
|
||||||
} else if (HostLocIsGPR(to) && HostLocIsGPR(from)) {
|
} else if (HostLocIsGPR(to) && HostLocIsGPR(from)) {
|
||||||
if (bit_width >= 64) {
|
ASSERT(bit_width != 128);
|
||||||
|
if (bit_width == 64) {
|
||||||
code->mov(HostLocToReg64(to), HostLocToReg64(from));
|
code->mov(HostLocToReg64(to), HostLocToReg64(from));
|
||||||
} else {
|
} else {
|
||||||
code->mov(HostLocToReg64(to).cvt32(), HostLocToReg64(from).cvt32());
|
code->mov(HostLocToReg64(to).cvt32(), HostLocToReg64(from).cvt32());
|
||||||
}
|
}
|
||||||
} else if (HostLocIsXMM(to) && HostLocIsGPR(from)) {
|
} else if (HostLocIsXMM(to) && HostLocIsGPR(from)) {
|
||||||
if (bit_width >= 64) {
|
ASSERT(bit_width != 128);
|
||||||
|
if (bit_width == 64) {
|
||||||
code->movq(HostLocToXmm(to), HostLocToReg64(from));
|
code->movq(HostLocToXmm(to), HostLocToReg64(from));
|
||||||
} else {
|
} else {
|
||||||
code->movd(HostLocToXmm(to), HostLocToReg64(from).cvt32());
|
code->movd(HostLocToXmm(to), HostLocToReg64(from).cvt32());
|
||||||
}
|
}
|
||||||
} else if (HostLocIsGPR(to) && HostLocIsXMM(from)) {
|
} else if (HostLocIsGPR(to) && HostLocIsXMM(from)) {
|
||||||
if (bit_width >= 64) {
|
ASSERT(bit_width != 128);
|
||||||
|
if (bit_width == 64) {
|
||||||
code->movq(HostLocToReg64(to), HostLocToXmm(from));
|
code->movq(HostLocToReg64(to), HostLocToXmm(from));
|
||||||
} else {
|
} else {
|
||||||
code->movd(HostLocToReg64(to).cvt32(), HostLocToXmm(from));
|
code->movd(HostLocToReg64(to).cvt32(), HostLocToXmm(from));
|
||||||
|
|
Loading…
Reference in a new issue