Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Unified Diff: src/mips64/simulator-mips64.cc

Issue 1784353003: MIPS64: Use BOVC/BNVC for overflow checking on r6. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/simulator-mips64.cc
diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc
index 2e6b0f252a73eeb269a363885ef4c35493cc5e31..efaf02d5af25c5ac0484c00b96085d0e406a84f3 100644
--- a/src/mips64/simulator-mips64.cc
+++ b/src/mips64/simulator-mips64.cc
@@ -4330,11 +4330,8 @@ void Simulator::DecodeTypeImmediate(Instruction* instr) {
if (kArchVariant == kMips64r6) {
if (rs_reg >= rt_reg) { // BOVC
if (HaveSameSign(rs, rt)) {
- if (rs > 0) {
- BranchCompactHelper(rs > Registers::kMaxValue - rt, 16);
- } else if (rs < 0) {
- BranchCompactHelper(rs < Registers::kMinValue - rt, 16);
- }
+ int64_t sum = rs + rt;
+ BranchCompactHelper(sum < INT32_MIN || sum > INT32_MAX, 16);
}
} else {
if (rs_reg == 0) { // BEQZALC
@@ -4364,11 +4361,8 @@ void Simulator::DecodeTypeImmediate(Instruction* instr) {
if (!HaveSameSign(rs, rt) || rs == 0 || rt == 0) {
BranchCompactHelper(true, 16);
} else {
- if (rs > 0) {
- BranchCompactHelper(rs <= Registers::kMaxValue - rt, 16);
- } else if (rs < 0) {
- BranchCompactHelper(rs >= Registers::kMinValue - rt, 16);
- }
+ int64_t sum = rs + rt;
+ BranchCompactHelper(sum >= INT32_MIN && sum <= INT32_MAX, 16);
}
} else {
if (rs_reg == 0) { // BNEZALC
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698