diff options
Diffstat (limited to 'test/binaryen.js')
-rw-r--r-- | test/binaryen.js/hello-world.js.txt | 2 | ||||
-rw-r--r-- | test/binaryen.js/optimize-levels.js.txt | 4 | ||||
-rw-r--r-- | test/binaryen.js/sieve.js | 26 | ||||
-rw-r--r-- | test/binaryen.js/sieve.js.txt | 38 |
4 files changed, 39 insertions, 31 deletions
diff --git a/test/binaryen.js/hello-world.js.txt b/test/binaryen.js/hello-world.js.txt index c3cfae20b..dcdb21e80 100644 --- a/test/binaryen.js/hello-world.js.txt +++ b/test/binaryen.js/hello-world.js.txt @@ -16,7 +16,7 @@ optimized: (module (type $iii (func (param i32 i32) (result i32))) (export "adder" (func $adder)) - (func $adder (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $adder (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) diff --git a/test/binaryen.js/optimize-levels.js.txt b/test/binaryen.js/optimize-levels.js.txt index 78190fc0d..8cb0dfea5 100644 --- a/test/binaryen.js/optimize-levels.js.txt +++ b/test/binaryen.js/optimize-levels.js.txt @@ -36,7 +36,7 @@ shrinkLevel=1 (module (type $i (func (param i32) (result i32))) (export "test" (func $test)) - (func $test (; 0 ;) (type $i) (param $0 i32) (result i32) + (func $test (; 0 ;) (; has Stack IR ;) (type $i) (param $0 i32) (result i32) (select (get_local $0) (i32.const 0) @@ -66,7 +66,7 @@ shrinkLevel=1 (module (type $i (func (param i32) (result i32))) (export "test" (func $test)) - (func $test (; 0 ;) (type $i) (param $0 i32) (result i32) + (func $test (; 0 ;) (; has Stack IR ;) (type $i) (param $0 i32) (result i32) (select (get_local $0) (i32.const 0) diff --git a/test/binaryen.js/sieve.js b/test/binaryen.js/sieve.js index a7f0c993b..4c1e5eefc 100644 --- a/test/binaryen.js/sieve.js +++ b/test/binaryen.js/sieve.js @@ -19,16 +19,18 @@ var body = module.block( ), module.get_local(0, Binaryen.i32) ), - module.grow_memory( - module.i32.sub( - module.i32.div_u( - module.i32.add( - module.get_local(0, Binaryen.i32), - module.i32.const(65535) + module.drop( + module.grow_memory( + module.i32.sub( + module.i32.div_u( + module.i32.add( + module.get_local(0, Binaryen.i32), + module.i32.const(65535) + ), + module.i32.const(65536) ), - module.i32.const(65536) - ), - module.current_memory() + module.current_memory() + ) ) ) ), @@ -44,8 +46,8 @@ var body = module.block( module.i32.const(1) )), module.br_if('clear', module.i32.eq( - module.get_local(1), - module.get_local(0) + module.get_local(1, Binaryen.i32), + module.get_local(0, Binaryen.i32) )) ])), // perform the sieve TODO @@ -63,6 +65,8 @@ module.addFunction('sieve', ii, [Binaryen.i32], body); // export it as the same name as it has internally) module.addFunctionExport('sieve', 'sieve'); +if (!module.validate()) throw 'did not validate :('; + // Print out the text console.log(module.emitText()); diff --git a/test/binaryen.js/sieve.js.txt b/test/binaryen.js/sieve.js.txt index 2c4b906dd..97816e6b3 100644 --- a/test/binaryen.js/sieve.js.txt +++ b/test/binaryen.js/sieve.js.txt @@ -12,16 +12,18 @@ ) (get_local $0) ) - (grow_memory - (i32.sub - (i32.div_u - (i32.add - (get_local $0) - (i32.const 65535) + (drop + (grow_memory + (i32.sub + (i32.div_u + (i32.add + (get_local $0) + (i32.const 65535) + ) + (i32.const 65536) ) - (i32.const 65536) + (current_memory) ) - (current_memory) ) ) ) @@ -58,7 +60,7 @@ optimized: (type $i (func (param i32) (result i32))) (memory $0 1 100) (export "sieve" (func $sieve)) - (func $sieve (; 0 ;) (type $i) (param $0 i32) (result i32) + (func $sieve (; 0 ;) (; has Stack IR ;) (type $i) (param $0 i32) (result i32) (local $1 i32) (if (i32.lt_u @@ -68,16 +70,18 @@ optimized: ) (get_local $0) ) - (grow_memory - (i32.sub - (i32.div_u - (i32.add - (get_local $0) - (i32.const 65535) + (drop + (grow_memory + (i32.sub + (i32.div_u + (i32.add + (get_local $0) + (i32.const 65535) + ) + (i32.const 65536) ) - (i32.const 65536) + (current_memory) ) - (current_memory) ) ) ) |