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

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

Issue 1691763002: MIPS: Refine 'MIPS: Fix FPU min, max, mina, maxa in simulator.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/mips/simulator-mips.h ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/simulator-mips.cc
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
index 2d45739526d6e7abd8569c68b5ad1edd8348547b..0c91cb5512c94bce4adf210768a676cac5cc275b 100644
--- a/src/mips/simulator-mips.cc
+++ b/src/mips/simulator-mips.cc
@@ -2348,8 +2348,10 @@ void Simulator::SignalException(Exception e) {
static_cast<int>(e));
}
+// Min/Max template functions for Double and Single arguments.
+
template <typename T>
-T FPAbs(T a);
+static T FPAbs(T a);
template <>
double FPAbs<double>(double a) {
@@ -2362,7 +2364,7 @@ float FPAbs<float>(float a) {
}
template <typename T>
-bool Simulator::FPUProcessNaNsAndZeros(T a, T b, IsMin min, T& result) {
+static bool FPUProcessNaNsAndZeros(T a, T b, MaxMinKind kind, T& result) {
if (std::isnan(a) && std::isnan(b)) {
result = a;
} else if (std::isnan(a)) {
@@ -2371,9 +2373,9 @@ bool Simulator::FPUProcessNaNsAndZeros(T a, T b, IsMin min, T& result) {
result = a;
} else if (b == a) {
// Handle -0.0 == 0.0 case.
- // std::signbit() returns int 0 or 1 so substracting IsMin::kMax negates the
- // result.
- result = std::signbit(b) - static_cast<int>(min) ? b : a;
+ // std::signbit() returns int 0 or 1 so substracting MaxMinKind::kMax
+ // negates the result.
+ result = std::signbit(b) - static_cast<int>(kind) ? b : a;
} else {
return false;
}
@@ -2381,9 +2383,9 @@ bool Simulator::FPUProcessNaNsAndZeros(T a, T b, IsMin min, T& result) {
}
template <typename T>
-T Simulator::FPUMin(T a, T b) {
+static T FPUMin(T a, T b) {
T result;
- if (FPUProcessNaNsAndZeros(a, b, IsMin::kMin, result)) {
+ if (FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, result)) {
return result;
} else {
return b < a ? b : a;
@@ -2391,9 +2393,9 @@ T Simulator::FPUMin(T a, T b) {
}
template <typename T>
-T Simulator::FPUMax(T a, T b) {
+static T FPUMax(T a, T b) {
T result;
- if (FPUProcessNaNsAndZeros(a, b, IsMin::kMax, result)) {
+ if (FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMax, result)) {
return result;
} else {
return b > a ? b : a;
@@ -2401,9 +2403,9 @@ T Simulator::FPUMax(T a, T b) {
}
template <typename T>
-T Simulator::FPUMinA(T a, T b) {
+static T FPUMinA(T a, T b) {
T result;
- if (!FPUProcessNaNsAndZeros(a, b, IsMin::kMin, result)) {
+ if (!FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, result)) {
if (FPAbs(a) < FPAbs(b)) {
result = a;
} else if (FPAbs(b) < FPAbs(a)) {
@@ -2416,9 +2418,9 @@ T Simulator::FPUMinA(T a, T b) {
}
template <typename T>
-T Simulator::FPUMaxA(T a, T b) {
+static T FPUMaxA(T a, T b) {
T result;
- if (!FPUProcessNaNsAndZeros(a, b, IsMin::kMin, result)) {
+ if (!FPUProcessNaNsAndZeros(a, b, MaxMinKind::kMin, result)) {
if (FPAbs(a) > FPAbs(b)) {
result = a;
} else if (FPAbs(b) > FPAbs(a)) {
« no previous file with comments | « src/mips/simulator-mips.h ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698