diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-09-11 10:22:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-11 10:22:41 -0700 |
commit | 13bccf058972660d7d59e68c08c0278c1554a19b (patch) | |
tree | 57a5c0827243516a927ad2181bb4f361557141c7 /test/threads.fromasm | |
parent | 9fafcef2c3dfe18b119b11fa527514835a4371ce (diff) | |
download | binaryen-13bccf058972660d7d59e68c08c0278c1554a19b.tar.gz binaryen-13bccf058972660d7d59e68c08c0278c1554a19b.tar.bz2 binaryen-13bccf058972660d7d59e68c08c0278c1554a19b.zip |
asm2wasm atomics (#1171)
* translate asm.js atomics into wasm atomics
* fix wasm-builder atomic load emitting, the alignment is the loaded size, not the output size
* don't require code for each node type in vaccuum, for non-mentioned nodes, assume we can't optimize them out
* support atomics in hashing, comparing, and copying
Diffstat (limited to 'test/threads.fromasm')
-rw-r--r-- | test/threads.fromasm | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/threads.fromasm b/test/threads.fromasm new file mode 100644 index 000000000..5114d985a --- /dev/null +++ b/test/threads.fromasm @@ -0,0 +1,69 @@ +(module + (import "env" "memory" (memory $0 256 256 shared)) + (import "env" "table" (table 0 0 anyfunc)) + (import "env" "memoryBase" (global $memoryBase i32)) + (import "env" "tableBase" (global $tableBase i32)) + (data (get_global $memoryBase) "threads.asm.js") + (export "test" (func $test)) + (func $test + (local $0 i32) + (drop + (i32.atomic.load + (i32.const 4916) + ) + ) + (drop + (i32.atomic.rmw.xor + (i32.atomic.rmw.or + (i32.atomic.rmw.and + (i32.atomic.rmw.sub + (i32.atomic.rmw.add + (i32.atomic.rmw.cmpxchg + (block (result i32) + (i32.atomic.store + (i32.atomic.load16_u + (i32.const 2458) + ) + (tee_local $0 + (i32.const 0) + ) + ) + (i32.atomic.rmw.xchg + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + (i32.const 2) + ) + (i32.const 0) + ) + (i32.const 0) + ) + (i32.const 0) + ) + (i32.const 0) + ) + (i32.const 0) + ) + ) + (drop + (i32.atomic.rmw.xor + (i32.const 4096) + (i32.const 0) + ) + ) + (drop + (i32.atomic.rmw16_u.xor + (i32.const 2048) + (i32.const 0) + ) + ) + (drop + (i32.atomic.rmw8_u.xor + (i32.const 1024) + (i32.const 0) + ) + ) + ) +) |