Chromium Code Reviews| Index: runtime/vm/assembler_ia32.cc |
| =================================================================== |
| --- runtime/vm/assembler_ia32.cc (revision 16607) |
| +++ runtime/vm/assembler_ia32.cc (working copy) |
| @@ -809,6 +809,19 @@ |
| } |
| +void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) { |
| + ASSERT(CPUFeatures::sse4_1_supported()); |
| + AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| + EmitUint8(0x66); |
| + EmitUint8(0x0F); |
| + EmitUint8(0x3A); |
| + EmitUint8(0x0B); |
| + EmitXmmRegisterOperand(dst, src); |
| + // Mask precision exeption. |
| + EmitUint8(static_cast<uint8_t>(mode) | 0x8); |
| +} |
| + |
| + |
| void Assembler::fldl(const Address& src) { |
| AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| EmitUint8(0xDD); |
| @@ -1728,6 +1741,28 @@ |
| } |
| +void Assembler::DoubleRound(XmmRegister dst, XmmRegister src, XmmRegister tmp) { |
| + ASSERT(tmp != src); |
| + static double kZeroFiveConst = 0.5; |
| + static double kNegZeroFiveConst = -0.5; |
| + Label is_negative, round; |
| + if (src != dst) { |
| + movsd(dst, src); |
| + } |
| + pxor(tmp, tmp); |
| + comisd(src, tmp); |
| + j(BELOW, &is_negative, Assembler::kNearJump); |
| + addsd(dst, |
| + Address::Absolute(reinterpret_cast<uword>(&kZeroFiveConst))); |
| + jmp(&round, Assembler::kNearJump); |
| + Bind(&is_negative); |
| + addsd(dst, |
| + Address::Absolute(reinterpret_cast<uword>(&kNegZeroFiveConst))); |
| + Bind(&round); |
| + roundsd(dst, dst, Assembler::kRoundToZero); |
|
Florian Schneider
2013/01/08 14:24:04
truncate(x+0.5) does not work for some corner case
srdjan
2013/01/10 22:35:52
No, it doesn't. Round to nearest rounds 0.5 to 0 i
|
| +} |
| + |
| + |
| void Assembler::EnterFrame(intptr_t frame_size) { |
| if (prologue_offset_ == -1) { |
| prologue_offset_ = CodeSize(); |