Commit a57c62f6 authored by alph's avatar alph Committed by Commit bot

[x64] Emit vmovmskpd when AVX is enabled.

BUG=v8:4406
LOG=N

Review URL: https://codereview.chromium.org/1411023002

Cr-Commit-Position: refs/heads/master@{#31350}
parent 9131cf7e
......@@ -3558,15 +3558,6 @@ void Assembler::vmovq(Register dst, XMMRegister src) {
}
void Assembler::vmovapd(XMMRegister dst, XMMRegister src) {
DCHECK(IsEnabled(AVX));
EnsureSpace ensure_space(this);
emit_vex_prefix(dst, xmm0, src, kL128, k66, k0F, kWIG);
emit(0x28);
emit_sse_operand(dst, src);
}
void Assembler::vsd(byte op, XMMRegister dst, XMMRegister src1,
XMMRegister src2, SIMDPrefix pp, LeadingOpcode m, VexW w) {
DCHECK(IsEnabled(AVX));
......
......@@ -1281,7 +1281,6 @@ class Assembler : public AssemblerBase {
void vmovq(XMMRegister dst, const Operand& src);
void vmovq(Register dst, XMMRegister src);
void vmovapd(XMMRegister dst, XMMRegister src);
void vmovsd(XMMRegister dst, const Operand& src) {
vsd(0x10, dst, xmm0, src);
}
......@@ -1596,6 +1595,12 @@ class Assembler : public AssemblerBase {
void rorxl(Register dst, Register src, byte imm8);
void rorxl(Register dst, const Operand& src, byte imm8);
void vmovapd(XMMRegister dst, XMMRegister src) { vpd(0x28, dst, xmm0, src); }
void vmovmskpd(Register dst, XMMRegister src) {
XMMRegister idst = {dst.code()};
vpd(0x50, idst, xmm0, src);
}
#define PACKED_OP_LIST(V) \
V(and, 0x54) \
V(xor, 0x57)
......
......@@ -1201,6 +1201,10 @@ int DisassemblerX64::AVXInstruction(byte* data) {
AppendToBuffer("vucomisd %s,", NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
break;
case 0x50:
AppendToBuffer("vmovmskpd %s,", NameOfCPURegister(regop));
current += PrintRightXMMOperand(current);
break;
case 0x54:
AppendToBuffer("vandpd %s,%s,", NameOfXMMRegister(regop),
NameOfXMMRegister(vvvv));
......
......@@ -2410,7 +2410,7 @@ void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
__ Xorpd(xmm_scratch, xmm_scratch);
__ ucomisd(xmm_scratch, value);
EmitFalseBranch(instr, not_equal);
__ movmskpd(kScratchRegister, value);
__ Movmskpd(kScratchRegister, value);
__ testl(kScratchRegister, Immediate(1));
EmitBranch(instr, not_zero);
} else {
......@@ -3623,8 +3623,8 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) {
// Check for negative zero.
Label positive_sign;
__ j(above, &positive_sign, Label::kNear);
__ movmskpd(output_reg, input_reg);
__ testq(output_reg, Immediate(1));
__ Movmskpd(output_reg, input_reg);
__ testl(output_reg, Immediate(1));
DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero);
__ Set(output_reg, 0);
__ jmp(&done);
......@@ -4926,8 +4926,8 @@ void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg,
__ Xorpd(xmm_scratch, xmm_scratch);
__ ucomisd(xmm_scratch, result_reg);
__ j(not_equal, &done, Label::kNear);
__ movmskpd(kScratchRegister, result_reg);
__ testq(kScratchRegister, Immediate(1));
__ Movmskpd(kScratchRegister, result_reg);
__ testl(kScratchRegister, Immediate(1));
DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero);
}
__ jmp(&done, Label::kNear);
......@@ -5001,7 +5001,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) {
__ testl(input_reg, input_reg);
__ j(not_zero, done);
__ movmskpd(input_reg, xmm0);
__ Movmskpd(input_reg, xmm0);
__ andl(input_reg, Immediate(1));
DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero);
}
......
......@@ -2619,6 +2619,16 @@ void MacroAssembler::Movq(Register dst, XMMRegister src) {
}
void MacroAssembler::Movmskpd(Register dst, XMMRegister src) {
if (CpuFeatures::IsSupported(AVX)) {
CpuFeatureScope scope(this, AVX);
vmovmskpd(dst, src);
} else {
movmskpd(dst, src);
}
}
void MacroAssembler::Xorpd(XMMRegister dst, XMMRegister src) {
if (CpuFeatures::IsSupported(AVX)) {
CpuFeatureScope scope(this, AVX);
......@@ -3420,7 +3430,7 @@ void MacroAssembler::DoubleToI(Register result_reg, XMMRegister input_reg,
// only have to test if we got -0 as an input.
testl(result_reg, result_reg);
j(not_zero, &done, Label::kNear);
movmskpd(result_reg, input_reg);
Movmskpd(result_reg, input_reg);
// Bit 0 contains the sign of the double in input_reg.
// If input was positive, we are ok and return 0, otherwise
// jump to minus_zero.
......
......@@ -915,6 +915,8 @@ class MacroAssembler: public Assembler {
void Movq(XMMRegister dst, Register src);
void Movq(Register dst, XMMRegister src);
void Movmskpd(Register dst, XMMRegister src);
void Xorpd(XMMRegister dst, XMMRegister src);
// Control Flow
......
......@@ -1400,6 +1400,17 @@ TEST(AssemblerX64AVX_sd) {
__ cmpq(rcx, rdx);
__ j(not_equal, &exit);
// Test vmovmskpd
__ movl(rax, Immediate(12));
__ movq(rdx, V8_INT64_C(0x426D1A94A2000000)); // 1.0e12
__ vmovq(xmm6, rdx);
__ movq(rdx, V8_INT64_C(0xC26D1A94A2000000)); // -1.0e12
__ vmovq(xmm7, rdx);
__ shufps(xmm6, xmm7, 0x44);
__ vmovmskpd(rdx, xmm6);
__ cmpl(rdx, Immediate(2));
__ j(not_equal, &exit);
__ movl(rdx, Immediate(6));
__ vcvtlsi2sd(xmm6, xmm6, rdx);
__ movl(Operand(rsp, 0), Immediate(5));
......
......@@ -518,7 +518,6 @@ TEST(DisasmX64) {
__ vmovq(xmm9, Operand(rbx, rcx, times_4, 10000));
__ vmovq(r9, xmm6);
__ vmovapd(xmm7, xmm0);
__ vmovsd(xmm6, xmm2);
__ vmovsd(xmm9, Operand(rbx, rcx, times_4, 10000));
__ vmovsd(Operand(rbx, rcx, times_4, 10000), xmm0);
......@@ -549,6 +548,9 @@ TEST(DisasmX64) {
__ vcvttsd2siq(rdi, xmm9);
__ vcvttsd2siq(r8, Operand(r9, rbx, times_4, 10000));
__ vmovapd(xmm7, xmm0);
__ vmovmskpd(r9, xmm4);
__ vandps(xmm0, xmm9, xmm2);
__ vandps(xmm9, xmm1, Operand(rbx, rcx, times_4, 10000));
__ vxorps(xmm0, xmm1, xmm9);
......
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