Chromium Code Reviews| Index: src/wasm/wasm-interpreter.cc |
| diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc |
| index fc727801b983555a21f2992b3676eb92f59f648d..e8c0bb34dbe995eaae84a843890e52bc3c1a1cd5 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, -) \ |
|
Marija Antic
2016/06/17 08:09:08
Have you run the interpreter tests on the board? W
|
| 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,15 @@ static double quiet(double a) { |
| } |
| } |
| +static inline float ExecuteF32Sub(float a, float b, TrapReason* trap) { |
| + float result = a - b; |
| + if (result - result != 0) { |
| + if (std::isnan(a)) return quiet(a); |
| + if (std::isnan(b)) return quiet(b); |
| + } |
| + return a - b; |
| +} |
| + |
| 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 +336,15 @@ 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; |
| + if (result - result != 0) { |
| + if (std::isnan(a)) return quiet(a); |
| + if (std::isnan(b)) return quiet(b); |
| + } |
| + return a - b; |
| +} |
| + |
| static inline double ExecuteF64Min(double a, double b, TrapReason* trap) { |
| if (std::isnan(a)) return quiet(a); |
| if (std::isnan(b)) return quiet(b); |