Revision: 6860
Author: [email protected]
Date: Mon Feb 21 02:30:25 2011
Log: ARM: Implement DoMathRound in the lithium code generator.
Review URL: http://codereview.chromium.org/6519051
http://code.google.com/p/v8/source/detail?r=6860
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Fri Feb 18 04:06:52 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Mon Feb 21 02:30:25 2011
@@ -1204,8 +1204,7 @@
case kMathSqrt:
return DefineSameAsFirst(result);
case kMathRound:
- Abort("MathRound LUnaryMathOperation not implemented");
- return NULL;
+ return AssignEnvironment(DefineAsRegister(result));
case kMathPowHalf:
Abort("MathPowHalf LUnaryMathOperation not implemented");
return NULL;
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Feb 17
07:25:38 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Feb 21
02:30:25 2011
@@ -2607,6 +2607,30 @@
DeoptimizeIf(ne, instr->environment());
__ bind(&done);
}
+
+
+void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
+ DoubleRegister input = ToDoubleRegister(instr->InputAt(0));
+ Register result = ToRegister(instr->result());
+ Register scratch1 = scratch0();
+ Register scratch2 = result;
+ EmitVFPTruncate(kRoundToNearest,
+ double_scratch0().low(),
+ input,
+ scratch1,
+ scratch2);
+ DeoptimizeIf(ne, instr->environment());
+ __ vmov(result, double_scratch0().low());
+
+ // Test for -0.
+ Label done;
+ __ cmp(result, Operand(0));
+ __ b(ne, &done);
+ __ vmov(scratch1, input.high());
+ __ tst(scratch1, Operand(HeapNumber::kSignMask));
+ DeoptimizeIf(ne, instr->environment());
+ __ bind(&done);
+}
void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) {
@@ -2624,6 +2648,9 @@
case kMathFloor:
DoMathFloor(instr);
break;
+ case kMathRound:
+ DoMathRound(instr);
+ break;
case kMathSqrt:
DoMathSqrt(instr);
break;
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Thu Feb 17
07:25:38 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.h Mon Feb 21
02:30:25 2011
@@ -212,6 +212,7 @@
Register scratch1,
Register scratch2);
void DoMathFloor(LUnaryMathOperation* instr);
+ void DoMathRound(LUnaryMathOperation* instr);
void DoMathSqrt(LUnaryMathOperation* instr);
// Support for recording safepoint and position information.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev