Introduce orps for IA32/X64

BUG=
R=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0fd7c2a7
......@@ -2059,6 +2059,22 @@ void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
}
void Assembler::andps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x54);
emit_sse_operand(dst, src);
}
void Assembler::orps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x56);
emit_sse_operand(dst, src);
}
void Assembler::xorps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
......@@ -2344,14 +2360,6 @@ void Assembler::extractps(Register dst, XMMRegister src, byte imm8) {
}
void Assembler::andps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x54);
emit_sse_operand(dst, src);
}
void Assembler::pand(XMMRegister dst, XMMRegister src) {
ASSERT(IsEnabled(SSE2));
EnsureSpace ensure_space(this);
......
......@@ -1020,6 +1020,7 @@ class Assembler : public AssemblerBase {
// SSE instructions
void andps(XMMRegister dst, XMMRegister src);
void xorps(XMMRegister dst, XMMRegister src);
void orps(XMMRegister dst, XMMRegister src);
// SSE2 instructions
void cvttss2si(Register dst, const Operand& src);
......
......@@ -1110,7 +1110,7 @@ void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
__ pshufd(input, input, static_cast<uint8_t>(0xe1)); // Order: 11 10 00 01
__ movsd(double_scratch, Operand::StaticArray(
temp2, times_8, ExternalReference::math_exp_log_table()));
__ por(input, double_scratch);
__ orps(input, double_scratch);
__ mulsd(result, input);
__ bind(&done);
}
......
......@@ -1050,6 +1050,14 @@ int DisassemblerIA32::InstructionDecode(v8::internal::Vector<char> out_buffer,
NameOfXMMRegister(regop),
NameOfXMMRegister(rm));
data++;
} else if (f0byte == 0x56) {
data += 2;
int mod, regop, rm;
get_modrm(*data, &mod, &regop, &rm);
AppendToBuffer("orps %s,%s",
NameOfXMMRegister(regop),
NameOfXMMRegister(rm));
data++;
} else if (f0byte == 0x57) {
data += 2;
int mod, regop, rm;
......
......@@ -1958,7 +1958,7 @@ void LCodeGen::DoConstantD(LConstantD* instr) {
XMMRegister xmm_scratch = double_scratch0();
__ Set(temp, Immediate(lower));
__ movd(xmm_scratch, Operand(temp));
__ por(res, xmm_scratch);
__ orps(res, xmm_scratch);
}
}
}
......@@ -2184,7 +2184,7 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
__ ucomisd(left_reg, left_reg); // NaN check.
__ j(parity_even, &return_left, Label::kNear); // left == NaN.
__ bind(&return_right);
__ movsd(left_reg, right_reg);
__ movaps(left_reg, right_reg);
__ bind(&return_left);
}
......@@ -3995,7 +3995,7 @@ void LCodeGen::DoMathRound(LMathRound* instr) {
// CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then
// compare and compensate.
__ movsd(input_temp, input_reg); // Do not alter input_reg.
__ movaps(input_temp, input_reg); // Do not alter input_reg.
__ subsd(input_temp, xmm_scratch);
__ cvttsd2si(output_reg, Operand(input_temp));
// Catch minint due to overflow, and to prevent overflow when compensating.
......
......@@ -488,7 +488,7 @@ void LGapResolver::EmitSwap(int index) {
cgen_->ToOperand(source->IsDoubleRegister() ? destination : source);
__ movsd(xmm0, other);
__ movsd(other, reg);
__ movsd(reg, Operand(xmm0));
__ movaps(reg, xmm0);
} else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) {
CpuFeatureScope scope(cgen_->masm(), SSE2);
// Double-width memory-to-memory. Spill on demand to use a general
......
......@@ -2487,6 +2487,24 @@ void Assembler::andps(XMMRegister dst, XMMRegister src) {
}
void Assembler::orps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x56);
emit_sse_operand(dst, src);
}
void Assembler::xorps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x57);
emit_sse_operand(dst, src);
}
// SSE 2 operations.
void Assembler::movd(XMMRegister dst, Register src) {
......@@ -2918,15 +2936,6 @@ void Assembler::xorpd(XMMRegister dst, XMMRegister src) {
}
void Assembler::xorps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x57);
emit_sse_operand(dst, src);
}
void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF2);
......
......@@ -1355,8 +1355,9 @@ class Assembler : public AssemblerBase {
void cvttss2si(Register dst, XMMRegister src);
void cvtlsi2ss(XMMRegister dst, Register src);
void xorps(XMMRegister dst, XMMRegister src);
void andps(XMMRegister dst, XMMRegister src);
void orps(XMMRegister dst, XMMRegister src);
void xorps(XMMRegister dst, XMMRegister src);
void movmskps(Register dst, XMMRegister src);
......
......@@ -1261,12 +1261,19 @@ int DisassemblerX64::TwoByteOpcodeInstruction(byte* data) {
current += PrintOperands(idesc.mnem, idesc.op_order_, current);
} else if (opcode == 0x54) {
// xorps xmm, xmm/m128
// andps xmm, xmm/m128
int mod, regop, rm;
get_modrm(*current, &mod, &regop, &rm);
AppendToBuffer("andps %s,", NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else if (opcode == 0x56) {
// orps xmm, xmm/m128
int mod, regop, rm;
get_modrm(*current, &mod, &regop, &rm);
AppendToBuffer("orps %s,", NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else if (opcode == 0x57) {
// xorps xmm, xmm/m128
int mod, regop, rm;
......
......@@ -1771,7 +1771,7 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
__ j(not_equal, &return_left, Label::kNear); // left == right != 0.
// At this point, both left and right are either 0 or -0.
if (operation == HMathMinMax::kMathMin) {
__ orpd(left_reg, right_reg);
__ orps(left_reg, right_reg);
} else {
// Since we operate on +0 and/or -0, addsd and andsd have the same effect.
__ addsd(left_reg, right_reg);
......@@ -1782,7 +1782,7 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
__ ucomisd(left_reg, left_reg); // NaN check.
__ j(parity_even, &return_left, Label::kNear);
__ bind(&return_right);
__ movsd(left_reg, right_reg);
__ movaps(left_reg, right_reg);
__ bind(&return_left);
}
......
......@@ -305,7 +305,7 @@ void LGapResolver::EmitSwap(int index) {
Operand other_operand = cgen_->ToOperand(other);
__ movsd(xmm0, other_operand);
__ movsd(other_operand, reg);
__ movsd(reg, xmm0);
__ movaps(reg, xmm0);
} else {
// No other combinations are possible.
......
......@@ -371,6 +371,7 @@ TEST(DisasmIa320) {
__ cmpltsd(xmm0, xmm1);
__ andps(xmm0, xmm1);
__ orps(xmm0, xmm1);
__ andpd(xmm0, xmm1);
__ psllq(xmm0, 17);
__ psllq(xmm0, xmm1);
......
......@@ -343,6 +343,8 @@ TEST(DisasmX64) {
__ movaps(xmm0, xmm1);
__ andps(xmm0, xmm1);
__ orps(xmm0, xmm1);
__ xorps(xmm0, xmm1);
}
// SSE 2 instructions
{
......
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