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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 262823009: Convert BinadryDoubleOp to MathUnaryInstr double-square if both inputs are the same. Uses less regi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 35712)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -4407,8 +4407,7 @@
LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const {
- if ((kind() == MethodRecognizer::kMathSin) ||
- (kind() == MethodRecognizer::kMathCos)) {
+ if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) {
// Calling convention on x64 uses XMM0 and XMM1 to pass the first two
// double arguments and XMM0 to return the result. Unfortunately
// currently we can't specify these registers because ParallelMoveResolver
@@ -4424,23 +4423,32 @@
summary->set_out(0, Location::FpuRegisterLocation(XMM1));
return summary;
}
- ASSERT(kind() == MethodRecognizer::kMathSqrt);
+ ASSERT((kind() == MathUnaryInstr::kSqrt) ||
+ (kind() == MathUnaryInstr::kDoubleSquare));
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresFpuRegister());
- summary->set_out(0, Location::RequiresFpuRegister());
+ if (kind() == MathUnaryInstr::kDoubleSquare) {
+ summary->set_out(0, Location::SameAsFirstInput());
+ } else {
+ summary->set_out(0, Location::RequiresFpuRegister());
+ }
return summary;
}
void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (kind() == MethodRecognizer::kMathSqrt) {
+ if (kind() == MathUnaryInstr::kSqrt) {
__ sqrtsd(locs()->out(0).fpu_reg(), locs()->in(0).fpu_reg());
+ } else if (kind() == MathUnaryInstr::kDoubleSquare) {
+ XmmRegister value_reg = locs()->in(0).fpu_reg();
+ __ mulsd(value_reg, value_reg);
+ ASSERT(value_reg == locs()->out(0).fpu_reg());
} else {
- ASSERT((kind() == MethodRecognizer::kMathSin) ||
- (kind() == MethodRecognizer::kMathCos));
+ ASSERT((kind() == MathUnaryInstr::kSin) ||
+ (kind() == MathUnaryInstr::kCos));
// Save RSP.
__ movq(locs()->temp(0).reg(), RSP);
__ ReserveAlignedFrameSpace(0);
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698