Commit 2e6628c4 authored by weiliang.lin's avatar weiliang.lin Committed by Commit bot

[x64] fixed "vmovups reg, mem"

BUG=

Review-Url: https://codereview.chromium.org/2158923002
Cr-Commit-Position: refs/heads/master@{#37846}
parent 4d0c8c77
...@@ -3898,6 +3898,7 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, ...@@ -3898,6 +3898,7 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1,
emit_sse_operand(dst, src2); emit_sse_operand(dst, src2);
} }
void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1,
const Operand& src2) { const Operand& src2) {
DCHECK(IsEnabled(AVX)); DCHECK(IsEnabled(AVX));
...@@ -3907,14 +3908,6 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1, ...@@ -3907,14 +3908,6 @@ void Assembler::vps(byte op, XMMRegister dst, XMMRegister src1,
emit_sse_operand(dst, src2); 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, void Assembler::vpd(byte op, XMMRegister dst, XMMRegister src1,
XMMRegister src2) { XMMRegister src2) {
......
...@@ -1533,10 +1533,10 @@ class Assembler : public AssemblerBase { ...@@ -1533,10 +1533,10 @@ class Assembler : public AssemblerBase {
void vmovaps(XMMRegister dst, XMMRegister src) { vps(0x28, dst, xmm0, src); } 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, XMMRegister src) { vps(0x10, dst, xmm0, src); }
void vmovups(XMMRegister dst, const Operand& 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) { 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 vmovapd(XMMRegister dst, XMMRegister src) { vpd(0x28, dst, xmm0, src); }
void vmovmskpd(Register dst, XMMRegister src) { void vmovmskpd(Register dst, XMMRegister src) {
...@@ -1546,7 +1546,6 @@ class Assembler : public AssemblerBase { ...@@ -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, XMMRegister src2);
void vps(byte op, XMMRegister dst, XMMRegister src1, const Operand& 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, XMMRegister src2);
void vpd(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2); void vpd(byte op, XMMRegister dst, XMMRegister src1, const Operand& src2);
......
...@@ -2316,4 +2316,40 @@ TEST(AssemblerX64PslldWithXmm15) { ...@@ -2316,4 +2316,40 @@ TEST(AssemblerX64PslldWithXmm15) {
CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result); 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<Isolate*>(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> code = isolate->factory()->NewCode(
desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
#ifdef OBJECT_PRINT
OFStream os(stdout);
code->Print(os);
#endif
F9 f = FUNCTION_CAST<F9>(code->entry());
CHECK_EQ(-1.5, f(1.5, -1.5));
}
#undef __ #undef __
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment