Commit a58de79c authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips] Fix floating-point rounding ops

The RoundFloat/RoundDouble functions should return the Canonical
NaN if the input is a NaN.

Change-Id: I19928a8a3d78770757c6fe2e240254efe9944bdc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2475493
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70530}
parent 10dbddd1
......@@ -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));
......
......@@ -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));
......
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