summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-stack.cpp
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2021-09-14 19:24:34 +0300
committerGitHub <noreply@github.com>2021-09-14 16:24:34 +0000
commit9e2f13a2d14284cbc3e6dd4d5f891fa5df895436 (patch)
treede0a114f1d3bf1affee5ff42b2a78fc5a803c19b /src/wasm/wasm-stack.cpp
parent181b0e7037bc2999a24cb45a02523f3da04b254d (diff)
downloadbinaryen-9e2f13a2d14284cbc3e6dd4d5f891fa5df895436.tar.gz
binaryen-9e2f13a2d14284cbc3e6dd4d5f891fa5df895436.tar.bz2
binaryen-9e2f13a2d14284cbc3e6dd4d5f891fa5df895436.zip
[OptimizeInstructions] Optimize memory.fill with constant arguments (#4130)
This is reland of #3071 Do similar optimizations as in #3038 but for memory.fill. `memory.fill(d, v, 0)` ==> `{ drop(d), drop(v) }` only with `ignoreImplicitTraps` or `trapsNeverHappen` `memory.fill(d, v, 1)` ==> `store8(d, v)` Further simplifications can be done only if v is constant because otherwise binary size would increase: `memory.fill(d, C, 1)` ==> `store8(d, (C & 0xFF))` `memory.fill(d, C, 2)` ==> `store16(d, (C & 0xFF) * 0x0101)` `memory.fill(d, C, 4)` ==> `store32(d, (C & 0xFF) * 0x01010101)` `memory.fill(d, C, 8)` ==> `store64(d, (C & 0xFF) * 0x0101010101010101)` `memory.fill(d, C, 16)` ==> `store128(d, i8x16.splat(C & 0xFF))`
Diffstat (limited to 'src/wasm/wasm-stack.cpp')
0 files changed, 0 insertions, 0 deletions