diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 10:49:32 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 10:49:32 -0800 |
commit | f117fd69b9568aa31fd4b78b9ce0413220f4eb40 (patch) | |
tree | 149682a411a3933630785638a14271bb7d493867 /src | |
parent | 9c5850f24085ac5843a799692d5099c8af98def7 (diff) | |
download | binaryen-f117fd69b9568aa31fd4b78b9ce0413220f4eb40.tar.gz binaryen-f117fd69b9568aa31fd4b78b9ce0413220f4eb40.tar.bz2 binaryen-f117fd69b9568aa31fd4b78b9ce0413220f4eb40.zip |
nan reinterpretation
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-interpreter.h | 5 | ||||
-rw-r--r-- | src/wasm-shell.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index b93832d03..f3f6d6986 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -385,7 +385,10 @@ public: return Flow(Literal(converted)); } } - case ReinterpretFloat: return curr->type == i32 ? Flow(Literal(value.reinterpreti32())) : Flow(Literal(value.reinterpreti64())); + case ReinterpretFloat: { + if (value.type == f64 && isnan(value.getf64())) return Flow(Literal((int64_t)0x7ff8000000000000)); // canonicalized + return curr->type == i32 ? Flow(Literal(value.reinterpreti32())) : Flow(Literal(value.reinterpreti64())); + } case ConvertUInt32: return curr->type == f32 ? Flow(Literal(float(uint32_t(value.geti32())))) : Flow(Literal(double(uint32_t(value.geti32())))); case ConvertSInt32: return curr->type == f32 ? Flow(Literal(float(int32_t(value.geti32())))) : Flow(Literal(double(int32_t(value.geti32())))); case ConvertUInt64: return curr->type == f32 ? Flow(Literal(float((uint64_t)value.geti64()))) : Flow(Literal(double((uint64_t)value.geti64()))); diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp index bafbf75dc..9b2c90ce5 100644 --- a/src/wasm-shell.cpp +++ b/src/wasm-shell.cpp @@ -146,7 +146,7 @@ int main(int argc, char **argv) { Element& curr = *root[i]; IString id = curr[0]->str(); if (id == MODULE) break; - std::cerr << i << '/' << root.size() << " CHECKING| " << curr << '\n'; + std::cerr << i << '/' << (root.size()-1) << " CHECKING| " << curr << '\n'; Element& invoke = *curr[1]; assert(invoke[0]->str() == INVOKE); IString name = invoke[1]->str(); |