Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index a68cc130092fc68362301f75c87cc72fb9ff04eb..030e2c9b2f9f06910eb37cc7573d97c436cba08f 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -587,6 +587,25 @@ void MacroAssembler::Cvtsi2sd(XMMRegister dst, const Operand& src) { |
} |
+void MacroAssembler::Cvtui2ss(XMMRegister dst, Register src, Register tmp) { |
+ Label msb_set_src; |
+ Label jmp_return; |
+ test(src, src); |
+ j(sign, &msb_set_src, Label::kNear); |
+ cvtsi2ss(dst, src); |
+ jmp(&jmp_return, Label::kNear); |
+ bind(&msb_set_src); |
+ mov(tmp, src); |
+ shr(src, 1); |
+ // Recover the least significant bit to avoid rounding errors. |
+ and_(tmp, Immediate(1)); |
+ or_(src, tmp); |
+ cvtsi2ss(dst, src); |
+ addss(dst, dst); |
+ bind(&jmp_return); |
+} |
+ |
+ |
bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { |
static const int kMaxImmediateBits = 17; |
if (!RelocInfo::IsNone(x.rmode_)) return false; |