Commit 2754ab26 authored by rmcilroy@chromium.org's avatar rmcilroy@chromium.org

Revert "ARM: Do not set FPSCR when converting to clamped uint8"

This reverts commit r20676.

TBR=danno@chromium.org

Review URL: https://codereview.chromium.org/233013005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20678 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9a544e18
...@@ -796,10 +796,6 @@ void MacroAssembler::VFPEnsureFPSCRState(Register scratch) { ...@@ -796,10 +796,6 @@ void MacroAssembler::VFPEnsureFPSCRState(Register scratch) {
// If needed, restore wanted bits of FPSCR. // If needed, restore wanted bits of FPSCR.
Label fpscr_done; Label fpscr_done;
vmrs(scratch); vmrs(scratch);
if (emit_debug_code()) {
tst(scratch, Operand(kVFPRoundingModeMask));
Assert(eq, kDefaultRoundingModeNotSet);
}
tst(scratch, Operand(kVFPDefaultNaNModeControlBit)); tst(scratch, Operand(kVFPDefaultNaNModeControlBit));
b(ne, &fpscr_done); b(ne, &fpscr_done);
orr(scratch, scratch, Operand(kVFPDefaultNaNModeControlBit)); orr(scratch, scratch, Operand(kVFPDefaultNaNModeControlBit));
...@@ -3804,19 +3800,36 @@ void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) { ...@@ -3804,19 +3800,36 @@ void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
void MacroAssembler::ClampDoubleToUint8(Register result_reg, void MacroAssembler::ClampDoubleToUint8(Register result_reg,
DwVfpRegister input_reg, DwVfpRegister input_reg,
LowDwVfpRegister double_scratch) { LowDwVfpRegister double_scratch) {
Label above_zero;
Label done; Label done;
Label in_bounds;
VFPCompareAndSetFlags(input_reg, 0.0);
b(gt, &above_zero);
// Double value is less than zero, NaN or Inf, return 0.
mov(result_reg, Operand::Zero());
b(al, &done);
// Handle inputs >= 255 (including +infinity). // Double value is >= 255, return 255.
bind(&above_zero);
Vmov(double_scratch, 255.0, result_reg); Vmov(double_scratch, 255.0, result_reg);
mov(result_reg, Operand(255));
VFPCompareAndSetFlags(input_reg, double_scratch); VFPCompareAndSetFlags(input_reg, double_scratch);
b(ge, &done); b(le, &in_bounds);
mov(result_reg, Operand(255));
// For inputs < 255 (including negative) vcvt_u32_f64 with round-to-nearest b(al, &done);
// rounding mode will provide the correct result.
vcvt_u32_f64(double_scratch.low(), input_reg, kFPSCRRounding); // In 0-255 range, round and truncate.
bind(&in_bounds);
// Save FPSCR.
vmrs(ip);
// Set rounding mode to round to the nearest integer by clearing bits[23:22].
bic(result_reg, ip, Operand(kVFPRoundingModeMask));
vmsr(result_reg);
vcvt_s32_f64(double_scratch.low(), input_reg, kFPSCRRounding);
vmov(result_reg, double_scratch.low()); vmov(result_reg, double_scratch.low());
// Restore FPSCR.
vmsr(ip);
bind(&done); bind(&done);
} }
......
...@@ -1127,7 +1127,6 @@ class MaybeObject BASE_EMBEDDED { ...@@ -1127,7 +1127,6 @@ class MaybeObject BASE_EMBEDDED {
V(kDeclarationInCatchContext, "Declaration in catch context") \ V(kDeclarationInCatchContext, "Declaration in catch context") \
V(kDeclarationInWithContext, "Declaration in with context") \ V(kDeclarationInWithContext, "Declaration in with context") \
V(kDefaultNaNModeNotSet, "Default NaN mode not set") \ V(kDefaultNaNModeNotSet, "Default NaN mode not set") \
V(kDefaultRoundingModeNotSet, "Default rounding mode not set") \
V(kDeleteWithGlobalVariable, "Delete with global variable") \ V(kDeleteWithGlobalVariable, "Delete with global variable") \
V(kDeleteWithNonGlobalVariable, "Delete with non-global variable") \ V(kDeleteWithNonGlobalVariable, "Delete with non-global variable") \
V(kDestinationOfCopyNotAligned, "Destination of copy not aligned") \ V(kDestinationOfCopyNotAligned, "Destination of copy not aligned") \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment