Commit 5ba3384e authored by Zhao Jiazhong's avatar Zhao Jiazhong Committed by Commit Bot

[mips] Fix the usage of kDoubleRegZero in RoundFloat/RoundDouble

kDoubleRegZero register is not hardwired to 0.0, we need to check
it's value before using it.

Change-Id: I8a64ac55294f51a9a5f96a39a3b344f7e34d508a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2479223Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#70595}
parent 9417dae4
...@@ -2087,6 +2087,9 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src, ...@@ -2087,6 +2087,9 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src,
int32_t kFloat32MantissaBits = 23; int32_t kFloat32MantissaBits = 23;
int32_t kFloat32ExponentBits = 8; int32_t kFloat32ExponentBits = 8;
Label done; Label done;
if (!IsDoubleZeroRegSet()) {
Move(kDoubleRegZero, 0.0);
}
mfc1(scratch, src); mfc1(scratch, src);
Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits); Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits);
Branch(USE_DELAY_SLOT, &done, hs, at, Branch(USE_DELAY_SLOT, &done, hs, at,
......
...@@ -2509,6 +2509,9 @@ void TurboAssembler::RoundDouble(FPURegister dst, FPURegister src, ...@@ -2509,6 +2509,9 @@ void TurboAssembler::RoundDouble(FPURegister dst, FPURegister src,
ctc1(scratch, FCSR); ctc1(scratch, FCSR);
} else { } else {
Label done; Label done;
if (!IsDoubleZeroRegSet()) {
Move(kDoubleRegZero, 0.0);
}
mfhc1(scratch, src); mfhc1(scratch, src);
Ext(at, scratch, HeapNumber::kExponentShift, HeapNumber::kExponentBits); Ext(at, scratch, HeapNumber::kExponentShift, HeapNumber::kExponentBits);
Branch(USE_DELAY_SLOT, &done, hs, at, Branch(USE_DELAY_SLOT, &done, hs, at,
...@@ -2570,6 +2573,9 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src, ...@@ -2570,6 +2573,9 @@ void TurboAssembler::RoundFloat(FPURegister dst, FPURegister src,
int32_t kFloat32MantissaBits = 23; int32_t kFloat32MantissaBits = 23;
int32_t kFloat32ExponentBits = 8; int32_t kFloat32ExponentBits = 8;
Label done; Label done;
if (!IsDoubleZeroRegSet()) {
Move(kDoubleRegZero, 0.0);
}
mfc1(scratch, src); mfc1(scratch, src);
Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits); Ext(at, scratch, kFloat32MantissaBits, kFloat32ExponentBits);
Branch(USE_DELAY_SLOT, &done, hs, at, Branch(USE_DELAY_SLOT, &done, hs, at,
......
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