diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc index 15b219081b..b2c1c9d74b 100644 --- a/src/x64/assembler-x64.cc +++ b/src/x64/assembler-x64.cc @@ -3898,6 +3898,7 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, emit_sse_operand(dst, src2); } + void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2) { DCHECK(IsEnabled(AVX)); @@ -3907,14 +3908,6 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, emit_sse_operand(dst, src2); } -void Assembler::vps(byte op, const Operand& dst, XMMRegister src1, - XMMRegister src2) { - DCHECK(IsEnabled(AVX)); - EnsureSpace ensure_space(this); - emit_vex_prefix(src2, src1, dst, kL128, kNone, k0F, kWIG); - emit(op); - emit_sse_operand(src2, dst); -} void Assembler::vpd(byte op, XMMRegister dst, XMMRegister src1, XMMRegister src2) { diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index 0c81c8f3a6..4365c23931 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -1533,10 +1533,10 @@ class Assembler : public AssemblerBase { void vmovaps(XMMRegister dst, XMMRegister src) { vps(0x28, dst, xmm0, src); } void vmovups(XMMRegister dst, XMMRegister src) { vps(0x10, dst, xmm0, src); } void vmovups(XMMRegister dst, const Operand& src) { - vps(0x11, dst, xmm0, src); + vps(0x10, dst, xmm0, src); } void vmovups(const Operand& dst, XMMRegister src) { - vps(0x11, dst, xmm0, src); + vps(0x11, src, xmm0, dst); } void vmovapd(XMMRegister dst, XMMRegister src) { vpd(0x28, dst, xmm0, src); } void vmovmskpd(Register dst, XMMRegister src) { @@ -1546,7 +1546,6 @@ class Assembler : public AssemblerBase { void vps(byte op, XMMRegister dst, XMMRegister src1, XMMRegister src2); void vps(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); - void vps(byte op, const Operand& dst, XMMRegister src1, XMMRegister src2); void vpd(byte op, XMMRegister dst, XMMRegister src1, XMMRegister src2); void vpd(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); diff --git a/test/cctest/test-assembler-x64.cc b/test/cctest/test-assembler-x64.cc index 00d36097d0..36f1b30df9 100644 --- a/test/cctest/test-assembler-x64.cc +++ b/test/cctest/test-assembler-x64.cc @@ -2316,4 +2316,40 @@ TEST(AssemblerX64PslldWithXmm15) { CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result); } +typedef float (*F9)(float x, float y); +TEST(AssemblerX64vmovups) { + CcTest::InitializeVM(); + if (!CpuFeatures::IsSupported(AVX)) return; + + Isolate* isolate = reinterpret_cast(CcTest::isolate()); + HandleScope scope(isolate); + v8::internal::byte buffer[256]; + MacroAssembler assm(isolate, buffer, sizeof(buffer), + v8::internal::CodeObjectRequired::kYes); + { + CpuFeatureScope avx_scope(&assm, AVX); + __ shufps(xmm0, xmm0, 0x0); // brocast first argument + __ shufps(xmm1, xmm1, 0x0); // brocast second argument + // copy xmm1 to xmm0 through the stack to test the "vmovups reg, mem". + __ subq(rsp, Immediate(kSimd128Size)); + __ vmovups(Operand(rsp, 0), xmm1); + __ vmovups(xmm0, Operand(rsp, 0)); + __ addq(rsp, Immediate(kSimd128Size)); + + __ ret(0); + } + + CodeDesc desc; + assm.GetCode(&desc); + Handle code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle()); +#ifdef OBJECT_PRINT + OFStream os(stdout); + code->Print(os); +#endif + + F9 f = FUNCTION_CAST(code->entry()); + CHECK_EQ(-1.5, f(1.5, -1.5)); +} + #undef __