diff --git a/src/codegen/ia32/macro-assembler-ia32.cc b/src/codegen/ia32/macro-assembler-ia32.cc index 3985017120..4b31f78920 100644 --- a/src/codegen/ia32/macro-assembler-ia32.cc +++ b/src/codegen/ia32/macro-assembler-ia32.cc @@ -799,7 +799,11 @@ void TurboAssembler::I64x2SConvertI32x4High(XMMRegister dst, XMMRegister src) { vpmovsxdq(dst, dst); } else { CpuFeatureScope sse_scope(this, SSE4_1); - pshufd(dst, src, 0xEE); + if (dst == src) { + movhlps(dst, src); + } else { + pshufd(dst, src, 0xEE); + } pmovsxdq(dst, dst); } } @@ -811,9 +815,11 @@ void TurboAssembler::I64x2UConvertI32x4High(XMMRegister dst, XMMRegister src, vpxor(scratch, scratch, scratch); vpunpckhdq(dst, src, scratch); } else { - CpuFeatureScope sse_scope(this, SSE4_1); - pshufd(dst, src, 0xEE); - pmovzxdq(dst, dst); + if (dst != src) { + movaps(dst, src); + } + xorps(scratch, scratch); + punpckhdq(dst, scratch); } } diff --git a/src/codegen/x64/macro-assembler-x64.cc b/src/codegen/x64/macro-assembler-x64.cc index 9be5bb4e7a..d60b482f26 100644 --- a/src/codegen/x64/macro-assembler-x64.cc +++ b/src/codegen/x64/macro-assembler-x64.cc @@ -2227,7 +2227,11 @@ void TurboAssembler::I64x2SConvertI32x4High(XMMRegister dst, XMMRegister src) { vpmovsxdq(dst, dst); } else { CpuFeatureScope sse_scope(this, SSE4_1); - pshufd(dst, src, 0xEE); + if (dst == src) { + movhlps(dst, src); + } else { + pshufd(dst, src, 0xEE); + } pmovsxdq(dst, dst); } } @@ -2238,9 +2242,11 @@ void TurboAssembler::I64x2UConvertI32x4High(XMMRegister dst, XMMRegister src) { vpxor(kScratchDoubleReg, kScratchDoubleReg, kScratchDoubleReg); vpunpckhdq(dst, src, kScratchDoubleReg); } else { - CpuFeatureScope sse_scope(this, SSE4_1); - pshufd(dst, src, 0xEE); - pmovzxdq(dst, dst); + if (dst != src) { + movaps(dst, src); + } + xorps(kScratchDoubleReg, kScratchDoubleReg); + punpckhdq(dst, kScratchDoubleReg); } }