summaryrefslogtreecommitdiff
path: root/src/asmjs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-16 18:40:45 -0500
committerAlon Zakai <alonzakai@gmail.com>2018-05-16 16:40:45 -0700
commit3c5a2de669542caebd7ef001db6678b70375f0b5 (patch)
treebbe25d21142627cc04041d7ecbea9d4d15f3a680 /src/asmjs
parentd4aa0d30234ac9e553d743bd881a767d96554a4a (diff)
downloadbinaryen-3c5a2de669542caebd7ef001db6678b70375f0b5.tar.gz
binaryen-3c5a2de669542caebd7ef001db6678b70375f0b5.tar.bz2
binaryen-3c5a2de669542caebd7ef001db6678b70375f0b5.zip
wasm2asm: Implement float<->int conversions (#1550)
This commit lifts the same conversion strategy that `emcc` takes to convert between floats point numbers and integers, and it should implement all the various matrices of i32/u32/i64/u64 to f32/f64 Some refactoring was performed in the i64->i32 pass to allow for temporary variables to get allocated which have types other than i32, but otherwise this contains a pretty direct translation of `emcc`'s operations to `wasm2asm`.
Diffstat (limited to 'src/asmjs')
-rw-r--r--src/asmjs/shared-constants.cpp4
-rw-r--r--src/asmjs/shared-constants.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/asmjs/shared-constants.cpp b/src/asmjs/shared-constants.cpp
index c6efe64f9..bf956f173 100644
--- a/src/asmjs/shared-constants.cpp
+++ b/src/asmjs/shared-constants.cpp
@@ -89,5 +89,7 @@ cashew::IString GLOBAL("global"),
WASM_ROTR32("__wasm_rotr_i32"),
WASM_ROTR64("__wasm_rotr_i64"),
WASM_GROW_MEMORY("__wasm_grow_memory"),
- WASM_CURRENT_MEMORY("__wasm_current_memory");
+ WASM_CURRENT_MEMORY("__wasm_current_memory"),
+ WASM_FETCH_HIGH_BITS("__wasm_fetch_high_bits"),
+ INT64_TO_32_HIGH_BITS("i64toi32_i32$HIGH_BITS");
}
diff --git a/src/asmjs/shared-constants.h b/src/asmjs/shared-constants.h
index 28142fecc..973b5eb49 100644
--- a/src/asmjs/shared-constants.h
+++ b/src/asmjs/shared-constants.h
@@ -92,7 +92,9 @@ extern cashew::IString GLOBAL,
WASM_ROTR32,
WASM_ROTR64,
WASM_GROW_MEMORY,
- WASM_CURRENT_MEMORY;
+ WASM_CURRENT_MEMORY,
+ WASM_FETCH_HIGH_BITS,
+ INT64_TO_32_HIGH_BITS;
}
#endif // wasm_asmjs_shared_constants_h