Index: src/arm/lithium-codegen-arm.cc |
=================================================================== |
--- src/arm/lithium-codegen-arm.cc (revision 6953) |
+++ src/arm/lithium-codegen-arm.cc (working copy) |
@@ -2586,41 +2586,6 @@ |
} |
-// Truncates a double using a specific rounding mode. |
-// Clears the z flag (ne condition) if an overflow occurs. |
-void LCodeGen::EmitVFPTruncate(VFPRoundingMode rounding_mode, |
- SwVfpRegister result, |
- DwVfpRegister double_input, |
- Register scratch1, |
- Register scratch2) { |
- Register prev_fpscr = scratch1; |
- Register scratch = scratch2; |
- |
- // Set custom FPCSR: |
- // - Set rounding mode. |
- // - Clear vfp cumulative exception flags. |
- // - Make sure Flush-to-zero mode control bit is unset. |
- __ vmrs(prev_fpscr); |
- __ bic(scratch, prev_fpscr, Operand(kVFPExceptionMask | |
- kVFPRoundingModeMask | |
- kVFPFlushToZeroMask)); |
- __ orr(scratch, scratch, Operand(rounding_mode)); |
- __ vmsr(scratch); |
- |
- // Convert the argument to an integer. |
- __ vcvt_s32_f64(result, |
- double_input, |
- kFPSCRRounding); |
- |
- // Retrieve FPSCR. |
- __ vmrs(scratch); |
- // Restore FPSCR. |
- __ vmsr(prev_fpscr); |
- // Check for vfp exceptions. |
- __ tst(scratch, Operand(kVFPExceptionMask)); |
-} |
- |
- |
void LCodeGen::DoMathFloor(LUnaryMathOperation* instr) { |
DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
Register result = ToRegister(instr->result()); |
@@ -2628,11 +2593,11 @@ |
Register scratch1 = scratch0(); |
Register scratch2 = ToRegister(instr->TempAt(0)); |
- EmitVFPTruncate(kRoundToMinusInf, |
- single_scratch, |
- input, |
- scratch1, |
- scratch2); |
+ __ EmitVFPTruncate(kRoundToMinusInf, |
+ single_scratch, |
+ input, |
+ scratch1, |
+ scratch2); |
DeoptimizeIf(ne, instr->environment()); |
// Move the result back to general purpose register r0. |
@@ -2654,11 +2619,11 @@ |
Register result = ToRegister(instr->result()); |
Register scratch1 = scratch0(); |
Register scratch2 = result; |
- EmitVFPTruncate(kRoundToNearest, |
- double_scratch0().low(), |
- input, |
- scratch1, |
- scratch2); |
+ __ EmitVFPTruncate(kRoundToNearest, |
+ double_scratch0().low(), |
+ input, |
+ scratch1, |
+ scratch2); |
DeoptimizeIf(ne, instr->environment()); |
__ vmov(result, double_scratch0().low()); |
@@ -3371,11 +3336,15 @@ |
Register scratch1 = scratch0(); |
Register scratch2 = ToRegister(instr->TempAt(0)); |
- EmitVFPTruncate(kRoundToZero, |
- single_scratch, |
- double_input, |
- scratch1, |
- scratch2); |
+ VFPRoundingMode rounding_mode = instr->truncating() ? kRoundToZero |
+ : kRoundToMinusInf; |
+ |
+ __ EmitVFPTruncate(rounding_mode, |
Søren Thygesen Gjesse
2011/02/28 09:54:32
r6951 changed this to always use kRoundToZero. Is
Søren Thygesen Gjesse
2011/03/02 09:33:08
Changed to always use kRoundToZero.
Use of inexac
|
+ single_scratch, |
+ double_input, |
+ scratch1, |
+ scratch2); |
+ |
// Deoptimize if we had a vfp invalid exception. |
DeoptimizeIf(ne, instr->environment()); |