diff options
author | Max Graey <maxgraey@gmail.com> | 2020-08-23 08:41:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-22 22:41:33 -0700 |
commit | fa83375d2bed8802de67e1689e056209561636e6 (patch) | |
tree | d90890899b4b1582dee9b41710ee2aaacce96ee3 /test/passes/optimize-instructions_all-features.wast | |
parent | 7d1c17479318609b4af564f8206c1e367fdf6eac (diff) | |
download | binaryen-fa83375d2bed8802de67e1689e056209561636e6.tar.gz binaryen-fa83375d2bed8802de67e1689e056209561636e6.tar.bz2 binaryen-fa83375d2bed8802de67e1689e056209561636e6.zip |
Optimize bulk memory.copy (#3038)
Replace it with a load and a store when the size is a small constant and remove it entirely when it would be a nop.
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r-- | test/passes/optimize-instructions_all-features.wast | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index 2790cc9ea..b62ecdcfd 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -4233,6 +4233,79 @@ ) )) ) + (func $optimize-bulk-memory-copy (param $dst i32) (param $src i32) (param $sz i32) + (memory.copy ;; nop + (local.get $dst) + (local.get $dst) + (local.get $sz) + ) + + (memory.copy ;; nop + (local.get $dst) + (local.get $src) + (i32.const 0) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 1) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 2) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 3) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 4) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 5) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 6) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 7) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 8) + ) + + (memory.copy + (local.get $dst) + (local.get $src) + (i32.const 16) + ) + + (memory.copy ;; skip + (local.get $dst) + (local.get $src) + (local.get $sz) + ) + ) ) (module (import "env" "memory" (memory $0 (shared 256 256))) |