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

Unified Diff: src/wasm/wasm-interpreter.cc

Issue 2066483008: MIPS: Followup '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment the iterpreter. Created 4 years, 6 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') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index c5cedefa343ac5fb1a51939807c89b2537f1c62a..f27c8736959e9035f6afa1f4341d2d6182b882d5 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -60,7 +60,6 @@ namespace wasm {
V(I64GtS, int64_t, >) \
V(I64GeS, int64_t, >=) \
V(F32Add, float, +) \
- V(F32Sub, float, -) \
V(F32Mul, float, *) \
V(F32Div, float, /) \
V(F32Eq, float, ==) \
@@ -70,7 +69,6 @@ namespace wasm {
V(F32Gt, float, >) \
V(F32Ge, float, >=) \
V(F64Add, double, +) \
- V(F64Sub, double, -) \
V(F64Mul, double, *) \
V(F64Div, double, /) \
V(F64Eq, double, ==) \
@@ -99,11 +97,13 @@ namespace wasm {
V(I32Rol, int32_t) \
V(I64Ror, int64_t) \
V(I64Rol, int64_t) \
+ V(F32Sub, float) \
V(F32Min, float) \
V(F32Max, float) \
V(F32CopySign, float) \
V(F64Min, double) \
V(F64Max, double) \
+ V(F64Sub, double) \
V(F64CopySign, double) \
V(I32AsmjsDivS, int32_t) \
V(I32AsmjsDivU, uint32_t) \
@@ -311,6 +311,17 @@ static double quiet(double a) {
}
}
+static inline float ExecuteF32Sub(float a, float b, TrapReason* trap) {
+ float result = a - b;
+ // Some architectures (e.g. MIPS) need extra checking to preserve the payload
+ // of a NaN operand.
+ if (result - result != 0) {
+ if (std::isnan(a)) return quiet(a);
+ if (std::isnan(b)) return quiet(b);
+ }
+ return result;
+}
+
static inline float ExecuteF32Min(float a, float b, TrapReason* trap) {
if (std::isnan(a)) return quiet(a);
if (std::isnan(b)) return quiet(b);
@@ -327,6 +338,17 @@ static inline float ExecuteF32CopySign(float a, float b, TrapReason* trap) {
return copysignf(a, b);
}
+static inline double ExecuteF64Sub(double a, double b, TrapReason* trap) {
+ double result = a - b;
+ // Some architectures (e.g. MIPS) need extra checking to preserve the payload
+ // of a NaN operand.
+ if (result - result != 0) {
+ if (std::isnan(a)) return quiet(a);
+ if (std::isnan(b)) return quiet(b);
+ }
+ return result;
+}
+
static inline double ExecuteF64Min(double a, double b, TrapReason* trap) {
if (std::isnan(a)) return quiet(a);
if (std::isnan(b)) return quiet(b);
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698