diff options
author | Max Graey <maxgraey@gmail.com> | 2021-07-22 00:10:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 14:10:48 -0700 |
commit | ed97c68294a8d95c57972eae22906cc0bea1aae8 (patch) | |
tree | 3b90c42bc96153b137a683e0edc6cf529b453f55 /test/wasm2js/reinterpret.2asm.js.opt | |
parent | 1e79c53ec1ad3d80db3354f15919331fdfa7ed28 (diff) | |
download | binaryen-ed97c68294a8d95c57972eae22906cc0bea1aae8.tar.gz binaryen-ed97c68294a8d95c57972eae22906cc0bea1aae8.tar.bz2 binaryen-ed97c68294a8d95c57972eae22906cc0bea1aae8.zip |
[Optimize Instructions] Combine reinterprets, loads and stores (#4006)
Fixes #3973
Loads:
f32.reinterpret_i32(i32.load(x)) => f32.load(x)
f64.reinterpret_i64(i64.load(x)) => f64.load(x)
i32.reinterpret_f32(f32.load(x)) => i32.load(x)
i64.reinterpret_f64(f64.load(x)) => i64.load(x)
Stores:
f32.store(y, f32.reinterpret_i32(x)) => i32.store(y, x)
f64.store(y, f64.reinterpret_i64(x)) => i64.store(y, x)
i32.store(y, i32.reinterpret_f32(x)) => f32.store(y, x)
i64.store(y, i64.reinterpret_f64(x)) => f64.store(y, x)
Also optimize reinterprets that are undone:
i32.reinterpret_f32(f32.reinterpret_i32(x)) => x
i64.reinterpret_f64(f64.reinterpret_i64(x)) => x
f32.reinterpret_i32(i32.reinterpret_f32(x)) => x
f64.reinterpret_i64(i64.reinterpret_f64(x)) => x
Diffstat (limited to 'test/wasm2js/reinterpret.2asm.js.opt')
-rw-r--r-- | test/wasm2js/reinterpret.2asm.js.opt | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/test/wasm2js/reinterpret.2asm.js.opt b/test/wasm2js/reinterpret.2asm.js.opt index cc5d4e984..f8d27101b 100644 --- a/test/wasm2js/reinterpret.2asm.js.opt +++ b/test/wasm2js/reinterpret.2asm.js.opt @@ -21,14 +21,6 @@ f64ScratchView[0] = value; } - function wasm2js_scratch_store_f32(value) { - f32ScratchView[2] = value; - } - - function wasm2js_scratch_load_f32() { - return f32ScratchView[2]; - } - function asmFunc(env) { var Math_imul = Math.imul; var Math_fround = Math.fround; @@ -45,7 +37,7 @@ function asmFunc(env) { var infinity = Infinity; function $1($0) { $0 = $0 | 0; - return ((wasm2js_scratch_store_f32((wasm2js_scratch_store_i32(2, $0), wasm2js_scratch_load_f32())), wasm2js_scratch_load_i32(2)) | 0) == ($0 | 0) | 0; + return 1; } function legalstub$2($0, $1_1) { |