diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/asm.js/testAtomic-effect.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/asm.js/testAtomic-effect.js')
-rw-r--r-- | js/src/jit-test/tests/asm.js/testAtomic-effect.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/asm.js/testAtomic-effect.js b/js/src/jit-test/tests/asm.js/testAtomic-effect.js new file mode 100644 index 000000000..8db4b1fb9 --- /dev/null +++ b/js/src/jit-test/tests/asm.js/testAtomic-effect.js @@ -0,0 +1,49 @@ +if (!this.Atomics) + quit(); + +load(libdir + "asm.js"); +setJitCompilerOption('asmjs.atomics.enable', 1); + +var code = ` + "use asm"; + + var HEAP32 = new stdlib.Int32Array(heap); + var add = stdlib.Atomics.add; + var load = stdlib.Atomics.load; + var _emscripten_asm_const_int=ffi._emscripten_asm_const_int; + + // Regression test for bug 1154858 - Atomics.add for effect did + // not get compiled properly because of an assembler bug. This + // kernel is derived from the large test case in that bug. + + function add_sharedEv(i1) { + i1 = i1 | 0; + var i2 = 0; + var xx = 0; + i2 = i1 + 4 | 0; + i1 = load(HEAP32, i2 >> 2) | 0; + _emscripten_asm_const_int(7, i2 | 0, i1 | 0) | 0; + add(HEAP32, i2 >> 2, 1) | 0; + _emscripten_asm_const_int(8, i2 | 0, load(HEAP32, i2 >> 2) | 0, i1 + 1 | 0) | 0; + return xx|0; + } + + return {add_sharedEv:add_sharedEv}; +`; + +var x; + +var sab = new SharedArrayBuffer(65536); +var ffi = + { _emscripten_asm_const_int: + function (...rest) { + //print("OUT: " + rest.join(" ")); + if (rest[0] == 8) + x = rest[2]; + } + }; +var m = asmCompile('stdlib', 'ffi', 'heap', code); +var {add_sharedEv} = asmLink(m, this, ffi, sab); +add_sharedEv(13812); + +assertEq(x, 1); |