diff --git a/src/codegen/mips/macro-assembler-mips.cc b/src/codegen/mips/macro-assembler-mips.cc index 909425360e..dcf7b60afd 100644 --- a/src/codegen/mips/macro-assembler-mips.cc +++ b/src/codegen/mips/macro-assembler-mips.cc @@ -2091,7 +2091,8 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src, Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits); Branch(USE_DELAY_SLOT, &done, hs, at, Operand(kFloat32ExponentBias + kFloat32MantissaBits)); - mov_s(dst, src); + // Canonicalize the result. + sub_s(dst, src, kDoubleRegZero); round(this, dst, src); mfc1(at, dst); Branch(USE_DELAY_SLOT, &done, ne, at, Operand(zero_reg)); diff --git a/src/codegen/mips64/macro-assembler-mips64.cc b/src/codegen/mips64/macro-assembler-mips64.cc index 902930045e..feda79e6c8 100644 --- a/src/codegen/mips64/macro-assembler-mips64.cc +++ b/src/codegen/mips64/macro-assembler-mips64.cc @@ -2513,7 +2513,8 @@ void TurboAssembler::RoundDouble(FPURegister dst, FPURegister src, Ext(at, scratch, HeapNumber::kExponentShift, HeapNumber::kExponentBits); Branch(USE_DELAY_SLOT, &done, hs, at, Operand(HeapNumber::kExponentBias + HeapNumber::kMantissaBits)); - mov_d(dst, src); + // Canonicalize the result. + sub_d(dst, src, kDoubleRegZero); round(this, dst, src); dmfc1(at, dst); Branch(USE_DELAY_SLOT, &done, ne, at, Operand(zero_reg)); @@ -2573,7 +2574,8 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src, Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits); Branch(USE_DELAY_SLOT, &done, hs, at, Operand(kFloat32ExponentBias + kFloat32MantissaBits)); - mov_s(dst, src); + // Canonicalize the result. + sub_s(dst, src, kDoubleRegZero); round(this, dst, src); mfc1(at, dst); Branch(USE_DELAY_SLOT, &done, ne, at, Operand(zero_reg));