Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 425083003: Use (more) xor on FP register to load it with 0.0. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 } else { 1572 } else {
1573 ASSERT(source.IsConstant()); 1573 ASSERT(source.IsConstant());
1574 const Object& constant = source.constant(); 1574 const Object& constant = source.constant();
1575 if (destination.IsRegister()) { 1575 if (destination.IsRegister()) {
1576 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) { 1576 if (constant.IsSmi() && (Smi::Cast(constant).Value() == 0)) {
1577 __ xorq(destination.reg(), destination.reg()); 1577 __ xorq(destination.reg(), destination.reg());
1578 } else { 1578 } else {
1579 __ LoadObject(destination.reg(), constant, PP); 1579 __ LoadObject(destination.reg(), constant, PP);
1580 } 1580 }
1581 } else if (destination.IsFpuRegister()) { 1581 } else if (destination.IsFpuRegister()) {
1582 __ LoadObject(TMP, constant, PP); 1582 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) {
1583 __ movsd(destination.fpu_reg(), 1583 __ xorps(destination.fpu_reg(), destination.fpu_reg());
1584 FieldAddress(TMP, Double::value_offset())); 1584 } else {
1585 __ LoadObject(TMP, constant, PP);
1586 __ movsd(destination.fpu_reg(),
1587 FieldAddress(TMP, Double::value_offset()));
1588 }
1585 } else if (destination.IsDoubleStackSlot()) { 1589 } else if (destination.IsDoubleStackSlot()) {
1586 __ LoadObject(TMP, constant, PP); 1590 if (Utils::DoublesBitEqual(Double::Cast(constant).value(), 0.0)) {
1587 __ movsd(XMM0, FieldAddress(TMP, Double::value_offset())); 1591 __ xorps(XMM0, XMM0);
1592 } else {
1593 __ LoadObject(TMP, constant, PP);
1594 __ movsd(XMM0, FieldAddress(TMP, Double::value_offset()));
1595 }
1588 __ movsd(destination.ToStackSlotAddress(), XMM0); 1596 __ movsd(destination.ToStackSlotAddress(), XMM0);
1589 } else { 1597 } else {
1590 ASSERT(destination.IsStackSlot()); 1598 ASSERT(destination.IsStackSlot());
1591 StoreObject(destination.ToStackSlotAddress(), constant); 1599 StoreObject(destination.ToStackSlotAddress(), constant);
1592 } 1600 }
1593 } 1601 }
1594 1602
1595 move->Eliminate(); 1603 move->Eliminate();
1596 } 1604 }
1597 1605
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 __ movups(reg, Address(RSP, 0)); 1734 __ movups(reg, Address(RSP, 0));
1727 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1735 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1728 } 1736 }
1729 1737
1730 1738
1731 #undef __ 1739 #undef __
1732 1740
1733 } // namespace dart 1741 } // namespace dart
1734 1742
1735 #endif // defined TARGET_ARCH_X64 1743 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698