Index: src/ia32/lithium-codegen-ia32.cc |
=================================================================== |
--- src/ia32/lithium-codegen-ia32.cc (revision 14205) |
+++ src/ia32/lithium-codegen-ia32.cc (working copy) |
@@ -2018,6 +2018,35 @@ |
break; |
case Token::DIV: |
__ divsd(left, right); |
+ // Don't delete this mov. It may improve performance on some CPUs, |
+ // when there is a mulsd depending on the result |
+ { |
+ bool has_dependent_mul = false; |
+ HValue* value = instr->hydrogen_value(); |
+ for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
+ HValue* use = it.value(); |
+ if (!use->IsMul()) continue; |
+ LArithmeticD* lmul = NULL; |
+ for (int i = use->block()->first_instruction_index(); |
+ i <= use->block()->last_instruction_index(); i++) { |
+ LInstruction* luse = chunk_->instructions()->at(i); |
+ if (luse->hydrogen_value() == use) { |
+ ASSERT(luse->IsArithmeticD()); |
+ lmul = reinterpret_cast<LArithmeticD*>(luse); |
+ ASSERT(lmul->op() == Token::MUL); |
+ break; |
+ } |
+ } |
+ if (lmul->left()->Equals(instr->left()) || |
+ lmul->right()->Equals(instr->left())) { |
+ has_dependent_mul = true; |
+ break; |
+ } |
+ } |
+ if (has_dependent_mul) { |
+ __ movaps(left, left); |
+ } |
+ } |
break; |
case Token::MOD: { |
// Pass two doubles as arguments on the stack. |