Commit ba973128 authored by whesse@chromium.org's avatar whesse@chromium.org

Add ArithmeticD instruction to x64 Crankshaft.

Review URL: http://codereview.chromium.org/6515010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6767 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 34eeb88e
......@@ -978,7 +978,30 @@ void LCodeGen::DoAddI(LAddI* instr) {
void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
Abort("Unimplemented: %s", "DoArithmeticD");
LOperand* left = instr->InputAt(0);
LOperand* right = instr->InputAt(1);
// All operations except MOD are computed in-place.
ASSERT(instr->op() == Token::MOD || left->Equals(instr->result()));
switch (instr->op()) {
case Token::ADD:
__ addsd(ToDoubleRegister(left), ToDoubleRegister(right));
break;
case Token::SUB:
__ subsd(ToDoubleRegister(left), ToDoubleRegister(right));
break;
case Token::MUL:
__ mulsd(ToDoubleRegister(left), ToDoubleRegister(right));
break;
case Token::DIV:
__ divsd(ToDoubleRegister(left), ToDoubleRegister(right));
break;
case Token::MOD:
Abort("Unimplemented: %s", "DoArithmeticD MOD");
break;
default:
UNREACHABLE();
break;
}
}
......@@ -2130,7 +2153,11 @@ void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
ASSERT(input->IsRegister() || input->IsStackSlot());
LOperand* output = instr->result();
ASSERT(output->IsDoubleRegister());
__ cvtlsi2sd(ToDoubleRegister(output), ToOperand(input));
if (input->IsRegister()) {
__ cvtlsi2sd(ToDoubleRegister(output), ToRegister(input));
} else {
__ cvtlsi2sd(ToDoubleRegister(output), ToOperand(input));
}
}
......
......@@ -843,8 +843,16 @@ LInstruction* LChunkBuilder::DoShift(Token::Value op,
LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
HArithmeticBinaryOperation* instr) {
Abort("Unimplemented: %s", "DoArithmeticD");
return NULL;
ASSERT(instr->representation().IsDouble());
ASSERT(instr->left()->representation().IsDouble());
ASSERT(instr->right()->representation().IsDouble());
if (op == Token::MOD) {
Abort("Unimplemented: %s", "DoArithmeticD MOD");
}
LOperand* left = UseRegisterAtStart(instr->left());
LOperand* right = UseRegisterAtStart(instr->right());
LArithmeticD* result = new LArithmeticD(op, left, right);
return DefineSameAsFirst(result);
}
......
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