diff options
28 files changed, 3804 insertions, 3718 deletions
diff --git a/scripts/port_passes_tests_to_lit.py b/scripts/port_passes_tests_to_lit.py index 1bebfba75..4a71f741f 100755 --- a/scripts/port_passes_tests_to_lit.py +++ b/scripts/port_passes_tests_to_lit.py @@ -83,6 +83,9 @@ def port_test(args, test): if not args.no_delete: for f in glob.glob(test.replace('.wast', '.*')): + # Do not delete binary tests with the same name + if f.endswith('.wasm') or f.endswith('.bin.txt'): + continue os.remove(f) if args.git_add: subprocess.run(['git', 'add', f]) diff --git a/test/lit/passes/O.wast b/test/lit/passes/O.wast new file mode 100644 index 000000000..f7c9a0084 --- /dev/null +++ b/test/lit/passes/O.wast @@ -0,0 +1,134 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O -S -o - | filecheck %s + +(module + ;; CHECK: (type $i32_=>_i32 (func (param i32) (result i32))) + + ;; CHECK: (type $none_=>_i32 (func (result i32))) + + ;; CHECK: (type $i64_=>_none (func (param i64))) + + ;; CHECK: (export "ret" (func $ret)) + + ;; CHECK: (export "waka" (func $if-0-unreachable-to-none)) + + ;; CHECK: (export "many-selects" (func $many-selects)) + + ;; CHECK: (export "end-if-else" (func $end-if-else)) + + ;; CHECK: (export "end-if-else-call" (func $end-if-else-call)) + + ;; CHECK: (func $ret (; has Stack IR ;) (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (call $ret) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (call $ret) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 999) + ;; CHECK-NEXT: ) + (func $ret (export "ret") (result i32) + (block $out (result i32) + (drop (call $ret)) + (if (call $ret) + (return + (return + (i32.const 1) + ) + ) + ) + (drop (br_if $out (i32.const 999) (i32.const 1))) + (unreachable) + ) + ) + ;; CHECK: (func $if-0-unreachable-to-none (; has Stack IR ;) (param $0 i64) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $if-0-unreachable-to-none (export "waka") (param $var$0 i64) + (local $var$1 i64) + (local $var$2 i64) + (block $label$1 + (if + (i32.const 0) + (br $label$1) + (unreachable) + ) + ) + ) + ;; CHECK: (func $many-selects (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (i32.const -1073741824) + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (i32.const 1073741823) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.gt_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1073741823) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.lt_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const -1073741824) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $many-selects (export "many-selects") (param $0 i32) (result i32) + (if + (i32.lt_s + (local.get $0) + (i32.const -1073741824) + ) + (local.set $0 + (i32.const -1073741824) + ) + (if + (i32.gt_s + (local.get $0) + (i32.const 1073741823) + ) + (local.set $0 + (i32.const 1073741823) + ) + ) + ) + (local.get $0) + ) + ;; CHECK: (func $end-if-else (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $end-if-else (export "end-if-else") (param $x i32) (result i32) + (if + (local.get $x) + (local.set $x + (i32.const 1) + ) + ) + (local.get $x) + ) + ;; CHECK: (func $end-if-else-call (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (call $ret) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $end-if-else-call (export "end-if-else-call") (param $x i32) (result i32) + (if + (local.get $x) + (local.set $x + (call $ret) + ) + ) + (local.get $x) + ) +) + diff --git a/test/lit/passes/O1.wast b/test/lit/passes/O1.wast new file mode 100644 index 000000000..823b4a172 --- /dev/null +++ b/test/lit/passes/O1.wast @@ -0,0 +1,43 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O1 -S -o - | filecheck %s + +(module + ;; CHECK: (type $none_=>_i32 (func (result i32))) + + ;; CHECK: (memory $0 1 1) + (memory $0 1 1) + (global $global$0 (mut i32) (i32.const 10)) + (func "foo" (result i32) + (i32.load offset=4 align=1 + (i32.and + (block $label$1 (result i32) + (global.set $global$0 + (i32.const 0) + ) + (i32.const -64) + ) + (i32.const 15) + ) + ) + ) + (func $signed-overflow (param $0 f32) (result i32) + (i32.sub + (i32.const 268435456) + (i32.const -2147483648) + ) + ) +) + + +;; CHECK: (export "foo" (func $0)) + +;; CHECK: (func $0 (result i32) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (i32.const 0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: (i32.load align=1 +;; CHECK-NEXT: (i32.const 4) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) diff --git a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast new file mode 100644 index 000000000..2f34c6eb1 --- /dev/null +++ b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -0,0 +1,186 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O3 --inline-functions-with-loops --flexible-inline-max-function-size=30 -S -o - | filecheck %s + +(module + ;; CHECK: (type $t0 (func (param i32) (result i32))) + (type $t0 (func (param i32) (result i32))) + ;; CHECK: (memory $memory 0) + + ;; CHECK: (export "fib" (func $fib)) + + ;; CHECK: (export "looped" (func $looped)) + + ;; CHECK: (export "t0" (func $looped)) + + ;; CHECK: (export "t1" (func $t1)) + + ;; CHECK: (export "t2" (func $t2)) + + ;; CHECK: (export "t3" (func $t3)) + + ;; CHECK: (export "memory" (memory $memory)) + + ;; CHECK: (func $fib (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.le_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (call $fib + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $fib + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $fib (export "fib") (type $t0) (param $p0 i32) (result i32) + (if $I0 + (i32.le_s + (local.get $p0) + (i32.const 2) + ) + (then + (return + (local.get $p0) + ) + ) + ) + (i32.add + (call $fib + (i32.sub + (local.get $p0) + (i32.const 1) + ) + ) + (call $fib + (i32.sub + (local.get $p0) + (i32.const 2) + ) + ) + ) + ) + ;; CHECK: (func $looped (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (loop $L0 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.ge_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $L0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + (func $looped (export "looped") (type $t0) (param $p0 i32) (result i32) + (loop $L0 + (if $I1 + (i32.ge_s + (local.get $p0) + (i32.const 0) + ) + (then + (local.set $p0 + (i32.sub + (local.get $p0) + (i32.const 1) + ) + ) + (br $L0) + ) + ) + ) + (local.get $p0) + ) + + (func $t0 (export "t0") (type $t0) (param $p0 i32) (result i32) + (call $looped + (local.get $p0) + ) + ) + + ;; CHECK: (func $t1 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $L0 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.ge_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $L0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + (func $t1 (export "t1") (type $t0) (param $p0 i32) (result i32) + (call $looped + (i32.add + (local.get $p0) + (i32.const 1) + ) + ) + ) + ;; CHECK: (func $t2 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (call $fib + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $t2 (export "t2") (type $t0) (param $p0 i32) (result i32) + (call $fib + (local.get $p0) + ) + ) + + ;; CHECK: (func $t3 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (call $fib + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $t3 (export "t3") (type $t0) (param $p0 i32) (result i32) + (call $fib + (i32.add + (local.get $p0) + (i32.const 1) + ) + ) + ) + (memory $memory (export "memory") 0) +) diff --git a/test/lit/passes/O3_inlining.wast b/test/lit/passes/O3_inlining.wast new file mode 100644 index 000000000..185155179 --- /dev/null +++ b/test/lit/passes/O3_inlining.wast @@ -0,0 +1,71 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O3 --inlining -S -o - | filecheck %s + +(module + (global $global$0 (mut f64) (f64.const -32768)) + ;; CHECK: (type $i32_=>_none (func (param i32))) + + ;; CHECK: (global $global$1 (mut i32) (i32.const 100)) + (global $global$1 (mut i32) (i32.const 100)) + ;; CHECK: (memory $0 1 1) + (memory $0 1 1) + ;; CHECK: (export "func_217" (func $1)) + (export "func_217" (func $1)) + (func $0 + (if + (global.get $global$1) + (unreachable) + ) + (global.set $global$1 + (i32.const 0) + ) + (block $label$2 + (global.set $global$0 + (block $label$3 (result f64) + (br_if $label$2 + (if (result i32) + (i32.load16_u offset=3 + (i32.const 0) + ) + (i32.const 1) + (i32.const 0) + ) + ) + (unreachable) + ) + ) + ) + ) + ;; CHECK: (func $1 (param $0 i32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (global.get $global$1) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.eqz + ;; CHECK-NEXT: (i32.load16_u + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $1 (param $var$0 i32) + (drop + (call $2 + (f32.const 1) + (i32.const 1) + (i32.const 0) + ) + ) + ) + (func $2 (param $var$0 f32) (param $var$1 i32) (param $var$2 i32) (result i32) + (call $0) + (i32.const 0) + ) +) diff --git a/test/lit/passes/O4_disable-bulk-memory.wast b/test/lit/passes/O4_disable-bulk-memory.wast new file mode 100644 index 000000000..279d4b531 --- /dev/null +++ b/test/lit/passes/O4_disable-bulk-memory.wast @@ -0,0 +1,3028 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O4 --disable-bulk-memory -S -o - | filecheck %s + +(module + ;; CHECK: (type $0 (func)) + (type $0 (func)) + (global $global$0 (mut i32) (i32.const 10)) + ;; CHECK: (export "func_59_invoker" (func $0)) + (export "func_59_invoker" (func $0)) + ;; CHECK: (func $0 (; has Stack IR ;) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $0 (; 0 ;) (type $0) + (if + (block $label$1 (result i32) + (global.set $global$0 + (i32.const 0) + ) + (i32.const 127) + ) + (unreachable) + ) + (global.set $global$0 + (i32.const -1) + ) + (if + (global.get $global$0) + (unreachable) + ) + (unreachable) + ) +) +;; AssemblyScript n-body benchmark +(module + ;; CHECK: (type $0 (func)) + (type $0 (func)) + (type $1 (func (param i32 i32) (result i32))) + (type $2 (func (param i32 f64 f64 f64) (result i32))) + ;; CHECK: (type $3 (func (param i32) (result i32))) + (type $3 (func (param i32) (result i32))) + (type $4 (func (result i32))) + (type $5 (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32))) + (type $6 (func (param i32 i32 i32 i32))) + (type $7 (func (param i32 i32 i32))) + ;; CHECK: (type $11 (func (param i32))) + + ;; CHECK: (type $f64_f64_f64_f64_f64_f64_f64_=>_i32 (func (param f64 f64 f64 f64 f64 f64 f64) (result i32))) + + ;; CHECK: (type $8 (func (result f64))) + (type $8 (func (result f64))) + (type $9 (func (param i32 f64))) + (type $10 (func (param i32) (result f64))) + (type $11 (func (param i32))) + ;; CHECK: (import "env" "memory" (memory $1 1)) + (import "env" "memory" (memory $1 1)) + (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + ;; CHECK: (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + + ;; CHECK: (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + + ;; CHECK: (global $global$0 (mut i32) (i32.const 0)) + + ;; CHECK: (global $global$1 (mut i32) (i32.const 0)) + + ;; CHECK: (global $global$5 (mut i32) (i32.const 0)) + + ;; CHECK: (table $0 1 funcref) + (table $0 1 funcref) + (elem (i32.const 0) $null) + (global $global$0 (mut i32) (i32.const 0)) + (global $global$1 (mut i32) (i32.const 0)) + (global $global$2 f64 (f64.const 3.141592653589793)) + (global $global$3 f64 (f64.const 39.47841760435743)) + (global $global$4 f64 (f64.const 365.24)) + (global $global$5 (mut i32) (i32.const 0)) + (global $global$6 i32 (i32.const 100)) + ;; CHECK: (elem (i32.const 0) $null) + + ;; CHECK: (export "memory" (memory $0)) + (export "memory" (memory $0)) + ;; CHECK: (export "table" (table $0)) + (export "table" (table $0)) + ;; CHECK: (export "init" (func $assembly/index/init)) + (export "init" (func $assembly/index/init)) + ;; CHECK: (export "step" (func $assembly/index/step)) + (export "step" (func $assembly/index/step)) + ;; CHECK: (export "bench" (func $assembly/index/bench)) + (export "bench" (func $assembly/index/bench)) + ;; CHECK: (export "getBody" (func $assembly/index/getBody)) + (export "getBody" (func $assembly/index/getBody)) + ;; CHECK: (start $start) + (start $start) + (func $start:~lib/allocator/arena (; 1 ;) (type $0) + (global.set $global$0 + (i32.and + (i32.add + (global.get $global$6) + (i32.const 7) + ) + (i32.xor + (i32.const 7) + (i32.const -1) + ) + ) + ) + (global.set $global$1 + (global.get $global$0) + ) + ) + (func $start:assembly/index (; 2 ;) (type $0) + (call $start:~lib/allocator/arena) + ) + (func $~lib/array/Array<Body>#__unchecked_get (; 3 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local.set $2 + (i32.load + (local.get $0) + ) + ) + (local.set $3 + (local.get $1) + ) + (local.set $4 + (i32.const 0) + ) + (i32.load offset=8 + (i32.add + (i32.add + (local.get $2) + (i32.shl + (local.get $3) + (i32.const 2) + ) + ) + (local.get $4) + ) + ) + ) + (func $~lib/array/Array<Body>#__get (; 4 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local.set $2 + (i32.load + (local.get $0) + ) + ) + (if (result i32) + (i32.lt_u + (local.get $1) + (i32.shr_u + (i32.load + (local.get $2) + ) + (i32.const 2) + ) + ) + (block (result i32) + (local.set $3 + (local.get $2) + ) + (local.set $4 + (local.get $1) + ) + (local.set $5 + (i32.const 0) + ) + (i32.load offset=8 + (i32.add + (i32.add + (local.get $3) + (i32.shl + (local.get $4) + (i32.const 2) + ) + ) + (local.get $5) + ) + ) + ) + (unreachable) + ) + ) + (func $assembly/index/Body#offsetMomentum (; 5 ;) (type $2) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (f64.store offset=24 + (local.get $0) + (f64.div + (f64.neg + (local.get $1) + ) + (global.get $global$3) + ) + ) + (f64.store offset=32 + (local.get $0) + (f64.div + (f64.neg + (local.get $2) + ) + (global.get $global$3) + ) + ) + (f64.store offset=40 + (local.get $0) + (f64.div + (f64.neg + (local.get $3) + ) + (global.get $global$3) + ) + ) + (local.get $0) + ) + ;; CHECK: (func $~lib/allocator/arena/__memory_allocate (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.gt_u + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1073741824) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.gt_u + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (global.get $global$1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (i32.gt_u + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 7) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const -8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.tee $2 + ;; CHECK-NEXT: (memory.size) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_s + ;; CHECK-NEXT: (memory.grow + ;; CHECK-NEXT: (select + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.tee $3 + ;; CHECK-NEXT: (i32.shr_u + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 65535) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const -65536) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.gt_s + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_s + ;; CHECK-NEXT: (memory.grow + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $3) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (if + (i32.gt_u + (local.get $0) + (i32.const 1073741824) + ) + (unreachable) + ) + (local.set $1 + (global.get $global$1) + ) + (local.set $4 + (i32.and + (i32.add + (i32.add + (local.get $1) + (select + (local.tee $2 + (local.get $0) + ) + (local.tee $3 + (i32.const 1) + ) + (i32.gt_u + (local.get $2) + (local.get $3) + ) + ) + ) + (i32.const 7) + ) + (i32.xor + (i32.const 7) + (i32.const -1) + ) + ) + ) + (local.set $5 + (memory.size) + ) + (if + (i32.gt_u + (local.get $4) + (i32.shl + (local.get $5) + (i32.const 16) + ) + ) + (block + (local.set $2 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (local.get $4) + (local.get $1) + ) + (i32.const 65535) + ) + (i32.xor + (i32.const 65535) + (i32.const -1) + ) + ) + (i32.const 16) + ) + ) + (local.set $3 + (select + (local.tee $3 + (local.get $5) + ) + (local.tee $6 + (local.get $2) + ) + (i32.gt_s + (local.get $3) + (local.get $6) + ) + ) + ) + (if + (i32.lt_s + (memory.grow + (local.get $3) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (memory.grow + (local.get $2) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + ) + (global.set $global$1 + (local.get $4) + ) + (local.get $1) + ) + (func $~lib/memory/memory.allocate (; 7 ;) (type $3) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (local.get $0) + ) + ) + ) + (func $assembly/index/NBodySystem#constructor (; 8 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 f64) + (local $6 f64) + (local $7 f64) + (local $8 f64) + (local.set $5 + (f64.const 0) + ) + (local.set $6 + (f64.const 0) + ) + (local.set $7 + (f64.const 0) + ) + (local.set $3 + (block $label$1 (result i32) + (local.set $2 + (local.get $1) + ) + (i32.load offset=4 + (local.get $2) + ) + ) + ) + (block $label$2 + (local.set $2 + (i32.const 0) + ) + (loop $label$3 + (br_if $label$2 + (i32.eqz + (i32.lt_s + (local.get $2) + (local.get $3) + ) + ) + ) + (block $label$4 + (local.set $4 + (call $~lib/array/Array<Body>#__unchecked_get + (local.get $1) + (local.get $2) + ) + ) + (local.set $8 + (f64.load offset=48 + (local.get $4) + ) + ) + (local.set $5 + (f64.add + (local.get $5) + (f64.mul + (f64.load offset=24 + (local.get $4) + ) + (local.get $8) + ) + ) + ) + (local.set $6 + (f64.add + (local.get $6) + (f64.mul + (f64.load offset=32 + (local.get $4) + ) + (local.get $8) + ) + ) + ) + (local.set $7 + (f64.add + (local.get $7) + (f64.mul + (f64.load offset=40 + (local.get $4) + ) + (local.get $8) + ) + ) + ) + ) + (local.set $2 + (i32.add + (local.get $2) + (i32.const 1) + ) + ) + (br $label$3) + ) + ) + (drop + (call $assembly/index/Body#offsetMomentum + (call $~lib/array/Array<Body>#__get + (local.get $1) + (i32.const 0) + ) + (local.get $5) + (local.get $6) + (local.get $7) + ) + ) + (if + (i32.eqz + (local.get $0) + ) + (local.set $0 + (call $~lib/memory/memory.allocate + (i32.const 4) + ) + ) + ) + (i32.store + (local.get $0) + (local.get $1) + ) + (local.get $0) + ) + ;; CHECK: (func $assembly/index/Body#constructor (; has Stack IR ;) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32) + ;; CHECK-NEXT: (local $7 i32) + ;; CHECK-NEXT: (f64.store + ;; CHECK-NEXT: (local.tee $7 + ;; CHECK-NEXT: (call $~lib/allocator/arena/__memory_allocate + ;; CHECK-NEXT: (i32.const 56) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=8 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=16 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=24 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=32 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=40 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=48 + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: ) + (func $assembly/index/Body#constructor (; 9 ;) (type $5) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) + (if + (i32.eqz + (local.get $0) + ) + (local.set $0 + (call $~lib/memory/memory.allocate + (i32.const 56) + ) + ) + ) + (f64.store + (local.get $0) + (local.get $1) + ) + (f64.store offset=8 + (local.get $0) + (local.get $2) + ) + (f64.store offset=16 + (local.get $0) + (local.get $3) + ) + (f64.store offset=24 + (local.get $0) + (local.get $4) + ) + (f64.store offset=32 + (local.get $0) + (local.get $5) + ) + (f64.store offset=40 + (local.get $0) + (local.get $6) + ) + (f64.store offset=48 + (local.get $0) + (local.get $7) + ) + (local.get $0) + ) + (func $assembly/index/Sun (; 10 ;) (type $4) (result i32) + (call $assembly/index/Body#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (global.get $global$3) + ) + ) + (func $assembly/index/Jupiter (; 11 ;) (type $4) (result i32) + (call $assembly/index/Body#constructor + (i32.const 0) + (f64.const 4.841431442464721) + (f64.const -1.1603200440274284) + (f64.const -0.10362204447112311) + (f64.mul + (f64.const 0.001660076642744037) + (global.get $global$4) + ) + (f64.mul + (f64.const 0.007699011184197404) + (global.get $global$4) + ) + (f64.mul + (f64.const -6.90460016972063e-05) + (global.get $global$4) + ) + (f64.mul + (f64.const 9.547919384243266e-04) + (global.get $global$3) + ) + ) + ) + (func $assembly/index/Saturn (; 12 ;) (type $4) (result i32) + (call $assembly/index/Body#constructor + (i32.const 0) + (f64.const 8.34336671824458) + (f64.const 4.124798564124305) + (f64.const -0.4035234171143214) + (f64.mul + (f64.const -0.002767425107268624) + (global.get $global$4) + ) + (f64.mul + (f64.const 0.004998528012349172) + (global.get $global$4) + ) + (f64.mul + (f64.const 2.3041729757376393e-05) + (global.get $global$4) + ) + (f64.mul + (f64.const 2.858859806661308e-04) + (global.get $global$3) + ) + ) + ) + (func $assembly/index/Uranus (; 13 ;) (type $4) (result i32) + (call $assembly/index/Body#constructor + (i32.const 0) + (f64.const 12.894369562139131) + (f64.const -15.111151401698631) + (f64.const -0.22330757889265573) + (f64.mul + (f64.const 0.002964601375647616) + (global.get $global$4) + ) + (f64.mul + (f64.const 2.3784717395948095e-03) + (global.get $global$4) + ) + (f64.mul + (f64.const -2.9658956854023756e-05) + (global.get $global$4) + ) + (f64.mul + (f64.const 4.366244043351563e-05) + (global.get $global$3) + ) + ) + ) + (func $assembly/index/Neptune (; 14 ;) (type $4) (result i32) + (call $assembly/index/Body#constructor + (i32.const 0) + (f64.const 15.379697114850917) + (f64.const -25.919314609987964) + (f64.const 0.17925877295037118) + (f64.mul + (f64.const 2.6806777249038932e-03) + (global.get $global$4) + ) + (f64.mul + (f64.const 0.001628241700382423) + (global.get $global$4) + ) + (f64.mul + (f64.const -9.515922545197159e-05) + (global.get $global$4) + ) + (f64.mul + (f64.const 5.1513890204661145e-05) + (global.get $global$3) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 15 ;) (type $3) (param $0 i32) (result i32) + (i32.shl + (i32.const 1) + (i32.sub + (i32.const 32) + (i32.clz + (i32.sub + (i32.add + (local.get $0) + (i32.const 8) + ) + (i32.const 1) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 16 ;) (type $3) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (if + (i32.eqz + (i32.le_u + (local.get $0) + (i32.const 1073741816) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 26) + (i32.const 2) + ) + (unreachable) + ) + ) + (local.set $1 + (block $label$2 (result i32) + (local.set $2 + (call $~lib/internal/arraybuffer/computeSize + (local.get $0) + ) + ) + (br $label$2 + (call $~lib/allocator/arena/__memory_allocate + (local.get $2) + ) + ) + ) + ) + (i32.store + (local.get $1) + (local.get $0) + ) + (local.get $1) + ) + (func $~lib/internal/memory/memset (; 17 ;) (type $7) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + (if + (i32.eqz + (local.get $2) + ) + (return) + ) + (i32.store8 + (local.get $0) + (local.get $1) + ) + (i32.store8 + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 1) + ) + (local.get $1) + ) + (if + (i32.le_u + (local.get $2) + (i32.const 2) + ) + (return) + ) + (i32.store8 + (i32.add + (local.get $0) + (i32.const 1) + ) + (local.get $1) + ) + (i32.store8 + (i32.add + (local.get $0) + (i32.const 2) + ) + (local.get $1) + ) + (i32.store8 + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 2) + ) + (local.get $1) + ) + (i32.store8 + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 3) + ) + (local.get $1) + ) + (if + (i32.le_u + (local.get $2) + (i32.const 6) + ) + (return) + ) + (i32.store8 + (i32.add + (local.get $0) + (i32.const 3) + ) + (local.get $1) + ) + (i32.store8 + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 4) + ) + (local.get $1) + ) + (if + (i32.le_u + (local.get $2) + (i32.const 8) + ) + (return) + ) + (local.set $3 + (i32.and + (i32.sub + (i32.const 0) + (local.get $0) + ) + (i32.const 3) + ) + ) + (local.set $0 + (i32.add + (local.get $0) + (local.get $3) + ) + ) + (local.set $2 + (i32.sub + (local.get $2) + (local.get $3) + ) + ) + (local.set $2 + (i32.and + (local.get $2) + (i32.const -4) + ) + ) + (local.set $4 + (i32.mul + (i32.div_u + (i32.const -1) + (i32.const 255) + ) + (i32.and + (local.get $1) + (i32.const 255) + ) + ) + ) + (i32.store + (local.get $0) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 4) + ) + (local.get $4) + ) + (if + (i32.le_u + (local.get $2) + (i32.const 8) + ) + (return) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 4) + ) + (local.get $4) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 8) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 12) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 8) + ) + (local.get $4) + ) + (if + (i32.le_u + (local.get $2) + (i32.const 24) + ) + (return) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 12) + ) + (local.get $4) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 16) + ) + (local.get $4) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 20) + ) + (local.get $4) + ) + (i32.store + (i32.add + (local.get $0) + (i32.const 24) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 28) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 24) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 20) + ) + (local.get $4) + ) + (i32.store + (i32.sub + (i32.add + (local.get $0) + (local.get $2) + ) + (i32.const 16) + ) + (local.get $4) + ) + (local.set $3 + (i32.add + (i32.const 24) + (i32.and + (local.get $0) + (i32.const 4) + ) + ) + ) + (local.set $0 + (i32.add + (local.get $0) + (local.get $3) + ) + ) + (local.set $2 + (i32.sub + (local.get $2) + (local.get $3) + ) + ) + (local.set $5 + (i64.or + (i64.extend_i32_u + (local.get $4) + ) + (i64.shl + (i64.extend_i32_u + (local.get $4) + ) + (i64.const 32) + ) + ) + ) + (block $label$7 + (loop $label$8 + (if + (i32.ge_u + (local.get $2) + (i32.const 32) + ) + (block + (block $label$10 + (i64.store + (local.get $0) + (local.get $5) + ) + (i64.store + (i32.add + (local.get $0) + (i32.const 8) + ) + (local.get $5) + ) + (i64.store + (i32.add + (local.get $0) + (i32.const 16) + ) + (local.get $5) + ) + (i64.store + (i32.add + (local.get $0) + (i32.const 24) + ) + (local.get $5) + ) + (local.set $2 + (i32.sub + (local.get $2) + (i32.const 32) + ) + ) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 32) + ) + ) + ) + (br $label$8) + ) + ) + ) + ) + ) + (func $~lib/array/Array<Body>#constructor (; 18 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (if + (i32.gt_u + (local.get $1) + (i32.const 268435454) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 45) + (i32.const 39) + ) + (unreachable) + ) + ) + (local.set $2 + (i32.shl + (local.get $1) + (i32.const 2) + ) + ) + (local.set $3 + (call $~lib/internal/arraybuffer/allocateUnsafe + (local.get $2) + ) + ) + (i32.store + (block $label$2 (result i32) + (if + (i32.eqz + (local.get $0) + ) + (local.set $0 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + ) + (i32.store + (local.get $0) + (i32.const 0) + ) + (i32.store offset=4 + (local.get $0) + (i32.const 0) + ) + (local.get $0) + ) + (local.get $3) + ) + (i32.store offset=4 + (local.get $0) + (local.get $1) + ) + (block $label$4 + (local.set $4 + (i32.add + (local.get $3) + (i32.const 8) + ) + ) + (local.set $5 + (i32.const 0) + ) + (local.set $6 + (local.get $2) + ) + (call $~lib/internal/memory/memset + (local.get $4) + (local.get $5) + (local.get $6) + ) + ) + (local.get $0) + ) + (func $~lib/array/Array<Body>#__unchecked_set (; 19 ;) (type $7) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local.set $3 + (i32.load + (local.get $0) + ) + ) + (local.set $4 + (local.get $1) + ) + (local.set $5 + (local.get $2) + ) + (local.set $6 + (i32.const 0) + ) + (i32.store offset=8 + (i32.add + (i32.add + (local.get $3) + (i32.shl + (local.get $4) + (i32.const 2) + ) + ) + (local.get $6) + ) + (local.get $5) + ) + ) + ;; CHECK: (func $assembly/index/init (; has Stack IR ;) + ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (local $4 f64) + ;; CHECK-NEXT: (local $5 f64) + ;; CHECK-NEXT: (local $6 f64) + ;; CHECK-NEXT: (local $7 f64) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (call $~lib/allocator/arena/__memory_allocate + ;; CHECK-NEXT: (i32.const 32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $2 + ;; CHECK-NEXT: (call $~lib/allocator/arena/__memory_allocate + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=4 + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=4 + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.const 5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const -4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block $__inlined_func$~lib/internal/memory/memset + ;; CHECK-NEXT: (br_if $__inlined_func$~lib/internal/memory/memset + ;; CHECK-NEXT: (i32.le_u + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.tee $3 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br_if $__inlined_func$~lib/internal/memory/memset + ;; CHECK-NEXT: (i32.le_u + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.tee $3 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 28) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.tee $3 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$8 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.ge_u + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (i64.store + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i64.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.store + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 24) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $assembly/index/Body#constructor + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 0) + ;; CHECK-NEXT: (f64.const 39.47841760435743) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=8 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $assembly/index/Body#constructor + ;; CHECK-NEXT: (f64.const 4.841431442464721) + ;; CHECK-NEXT: (f64.const -1.1603200440274284) + ;; CHECK-NEXT: (f64.const -0.10362204447112311) + ;; CHECK-NEXT: (f64.const 0.606326392995832) + ;; CHECK-NEXT: (f64.const 2.81198684491626) + ;; CHECK-NEXT: (f64.const -0.02521836165988763) + ;; CHECK-NEXT: (f64.const 0.03769367487038949) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $assembly/index/Body#constructor + ;; CHECK-NEXT: (f64.const 8.34336671824458) + ;; CHECK-NEXT: (f64.const 4.124798564124305) + ;; CHECK-NEXT: (f64.const -0.4035234171143214) + ;; CHECK-NEXT: (f64.const -1.0107743461787924) + ;; CHECK-NEXT: (f64.const 1.8256623712304119) + ;; CHECK-NEXT: (f64.const 0.008415761376584154) + ;; CHECK-NEXT: (f64.const 0.011286326131968767) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $assembly/index/Body#constructor + ;; CHECK-NEXT: (f64.const 12.894369562139131) + ;; CHECK-NEXT: (f64.const -15.111151401698631) + ;; CHECK-NEXT: (f64.const -0.22330757889265573) + ;; CHECK-NEXT: (f64.const 1.0827910064415354) + ;; CHECK-NEXT: (f64.const 0.8687130181696082) + ;; CHECK-NEXT: (f64.const -0.010832637401363636) + ;; CHECK-NEXT: (f64.const 1.7237240570597112e-03) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $assembly/index/Body#constructor + ;; CHECK-NEXT: (f64.const 15.379697114850917) + ;; CHECK-NEXT: (f64.const -25.919314609987964) + ;; CHECK-NEXT: (f64.const 0.17925877295037118) + ;; CHECK-NEXT: (f64.const 0.979090732243898) + ;; CHECK-NEXT: (f64.const 0.5946989986476762) + ;; CHECK-NEXT: (f64.const -0.034755955504078104) + ;; CHECK-NEXT: (f64.const 2.0336868699246304e-03) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 16) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (i32.load offset=4 + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$3 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_s + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (f64.load offset=48 + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (f64.load offset=24 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (f64.load offset=32 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (f64.load offset=40 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=24 + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.shr_u + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.div + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (f64.const -39.47841760435743) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=32 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.div + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (f64.const -39.47841760435743) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=40 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.div + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (f64.const -39.47841760435743) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (call $~lib/allocator/arena/__memory_allocate + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$5 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $assembly/index/init (; 20 ;) (type $0) + (local $0 i32) + (global.set $global$5 + (call $assembly/index/NBodySystem#constructor + (i32.const 0) + (block $label$1 (result i32) + (local.set $0 + (call $~lib/array/Array<Body>#constructor + (i32.const 0) + (i32.const 5) + ) + ) + (call $~lib/array/Array<Body>#__unchecked_set + (local.get $0) + (i32.const 0) + (call $assembly/index/Sun) + ) + (call $~lib/array/Array<Body>#__unchecked_set + (local.get $0) + (i32.const 1) + (call $assembly/index/Jupiter) + ) + (call $~lib/array/Array<Body>#__unchecked_set + (local.get $0) + (i32.const 2) + (call $assembly/index/Saturn) + ) + (call $~lib/array/Array<Body>#__unchecked_set + (local.get $0) + (i32.const 3) + (call $assembly/index/Uranus) + ) + (call $~lib/array/Array<Body>#__unchecked_set + (local.get $0) + (i32.const 4) + (call $assembly/index/Neptune) + ) + (local.get $0) + ) + ) + ) + ) + ;; CHECK: (func $assembly/index/NBodySystem#advance (; has Stack IR ;) (param $0 i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (local $2 f64) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (local $4 f64) + ;; CHECK-NEXT: (local $5 f64) + ;; CHECK-NEXT: (local $6 f64) + ;; CHECK-NEXT: (local $7 i32) + ;; CHECK-NEXT: (local $8 f64) + ;; CHECK-NEXT: (local $9 f64) + ;; CHECK-NEXT: (local $10 f64) + ;; CHECK-NEXT: (local $11 f64) + ;; CHECK-NEXT: (local $12 i32) + ;; CHECK-NEXT: (local $13 i32) + ;; CHECK-NEXT: (local $14 f64) + ;; CHECK-NEXT: (local $15 f64) + ;; CHECK-NEXT: (local $16 f64) + ;; CHECK-NEXT: (local $17 f64) + ;; CHECK-NEXT: (local.set $13 + ;; CHECK-NEXT: (i32.load offset=4 + ;; CHECK-NEXT: (local.tee $12 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$3 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_u + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $13) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $14 + ;; CHECK-NEXT: (f64.load + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $15 + ;; CHECK-NEXT: (f64.load offset=8 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $16 + ;; CHECK-NEXT: (f64.load offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (f64.load offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (f64.load offset=32 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (f64.load offset=40 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $17 + ;; CHECK-NEXT: (f64.load offset=48 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$6 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_u + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (local.get $13) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $11 + ;; CHECK-NEXT: (f64.sqrt + ;; CHECK-NEXT: (local.tee $8 + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $2 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $14) + ;; CHECK-NEXT: (f64.load + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $9 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $15) + ;; CHECK-NEXT: (f64.load offset=8 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $10 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $16) + ;; CHECK-NEXT: (f64.load offset=16 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $10) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $4 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.tee $8 + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (f64.load offset=48 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.tee $11 + ;; CHECK-NEXT: (f64.div + ;; CHECK-NEXT: (f64.const 0.01) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: (local.get $11) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $10) + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=24 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load offset=24 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.tee $2 + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $17) + ;; CHECK-NEXT: (local.get $11) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=32 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load offset=32 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=40 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load offset=40 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $10) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$6) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=32 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=40 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: (f64.const 0.01) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=8 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load offset=8 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: (f64.const 0.01) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.store offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.load offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (f64.const 0.01) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $assembly/index/NBodySystem#advance (; 21 ;) (type $9) (param $0 i32) (param $1 f64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 f64) + (local $9 f64) + (local $10 f64) + (local $11 f64) + (local $12 f64) + (local $13 f64) + (local $14 f64) + (local $15 f64) + (local $16 f64) + (local $17 f64) + (local $18 f64) + (local $19 f64) + (local $20 f64) + (local $21 f64) + (local $22 f64) + (local.set $2 + (i32.load + (local.get $0) + ) + ) + (local.set $4 + (block $label$1 (result i32) + (local.set $3 + (local.get $2) + ) + (i32.load offset=4 + (local.get $3) + ) + ) + ) + (block $label$2 + (local.set $3 + (i32.const 0) + ) + (loop $label$3 + (br_if $label$2 + (i32.eqz + (i32.lt_u + (local.get $3) + (local.get $4) + ) + ) + ) + (block $label$4 + (local.set $5 + (call $~lib/array/Array<Body>#__unchecked_get + (local.get $2) + (local.get $3) + ) + ) + (local.set $8 + (f64.load + (local.get $5) + ) + ) + (local.set $9 + (f64.load offset=8 + (local.get $5) + ) + ) + (local.set $10 + (f64.load offset=16 + (local.get $5) + ) + ) + (local.set $11 + (f64.load offset=24 + (local.get $5) + ) + ) + (local.set $12 + (f64.load offset=32 + (local.get $5) + ) + ) + (local.set $13 + (f64.load offset=40 + (local.get $5) + ) + ) + (local.set $14 + (f64.load offset=48 + (local.get $5) + ) + ) + (block $label$5 + (local.set $6 + (i32.add + (local.get $3) + (i32.const 1) + ) + ) + (loop $label$6 + (br_if $label$5 + (i32.eqz + (i32.lt_u + (local.get $6) + (local.get $4) + ) + ) + ) + (block $label$7 + (local.set $7 + (call $~lib/array/Array<Body>#__unchecked_get + (local.get $2) + (local.get $6) + ) + ) + (local.set $15 + (f64.sub + (local.get $8) + (f64.load + (local.get $7) + ) + ) + ) + (local.set $16 + (f64.sub + (local.get $9) + (f64.load offset=8 + (local.get $7) + ) + ) + ) + (local.set $17 + (f64.sub + (local.get $10) + (f64.load offset=16 + (local.get $7) + ) + ) + ) + (local.set $18 + (f64.add + (f64.add + (f64.mul + (local.get $15) + (local.get $15) + ) + (f64.mul + (local.get $16) + (local.get $16) + ) + ) + (f64.mul + (local.get $17) + (local.get $17) + ) + ) + ) + (local.set $19 + (block $label$8 (result f64) + (local.set $19 + (local.get $18) + ) + (f64.sqrt + (local.get $19) + ) + ) + ) + (local.set $20 + (f64.div + (local.get $1) + (f64.mul + (local.get $18) + (local.get $19) + ) + ) + ) + (local.set $21 + (f64.mul + (local.get $14) + (local.get $20) + ) + ) + (local.set $22 + (f64.mul + (f64.load offset=48 + (local.get $7) + ) + (local.get $20) + ) + ) + (local.set $11 + (f64.sub + (local.get $11) + (f64.mul + (local.get $15) + (local.get $22) + ) + ) + ) + (local.set $12 + (f64.sub + (local.get $12) + (f64.mul + (local.get $16) + (local.get $22) + ) + ) + ) + (local.set $13 + (f64.sub + (local.get $13) + (f64.mul + (local.get $17) + (local.get $22) + ) + ) + ) + (f64.store offset=24 + (local.get $7) + (f64.add + (f64.load offset=24 + (local.get $7) + ) + (f64.mul + (local.get $15) + (local.get $21) + ) + ) + ) + (f64.store offset=32 + (local.get $7) + (f64.add + (f64.load offset=32 + (local.get $7) + ) + (f64.mul + (local.get $16) + (local.get $21) + ) + ) + ) + (f64.store offset=40 + (local.get $7) + (f64.add + (f64.load offset=40 + (local.get $7) + ) + (f64.mul + (local.get $17) + (local.get $21) + ) + ) + ) + ) + (local.set $6 + (i32.add + (local.get $6) + (i32.const 1) + ) + ) + (br $label$6) + ) + ) + (f64.store offset=24 + (local.get $5) + (local.get $11) + ) + (f64.store offset=32 + (local.get $5) + (local.get $12) + ) + (f64.store offset=40 + (local.get $5) + (local.get $13) + ) + (f64.store + (local.get $5) + (f64.add + (f64.load + (local.get $5) + ) + (f64.mul + (local.get $1) + (local.get $11) + ) + ) + ) + (f64.store offset=8 + (local.get $5) + (f64.add + (f64.load offset=8 + (local.get $5) + ) + (f64.mul + (local.get $1) + (local.get $12) + ) + ) + ) + (f64.store offset=16 + (local.get $5) + (f64.add + (f64.load offset=16 + (local.get $5) + ) + (f64.mul + (local.get $1) + (local.get $13) + ) + ) + ) + ) + (local.set $3 + (i32.add + (local.get $3) + (i32.const 1) + ) + ) + (br $label$3) + ) + ) + ) + (func $assembly/index/NBodySystem#energy (; 22 ;) (type $10) (param $0 i32) (result f64) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 f64) + (local $8 f64) + (local $9 f64) + (local $10 f64) + (local $11 f64) + (local $12 f64) + (local $13 f64) + (local $14 f64) + (local $15 f64) + (local $16 f64) + (local $17 f64) + (local $18 f64) + (local.set $7 + (f64.const 0) + ) + (local.set $1 + (i32.load + (local.get $0) + ) + ) + (block $label$1 + (block $label$2 + (local.set $2 + (i32.const 0) + ) + (local.set $3 + (block $label$3 (result i32) + (local.set $3 + (local.get $1) + ) + (i32.load offset=4 + (local.get $3) + ) + ) + ) + ) + (loop $label$4 + (br_if $label$1 + (i32.eqz + (i32.lt_u + (local.get $2) + (local.get $3) + ) + ) + ) + (block $label$5 + (local.set $4 + (call $~lib/array/Array<Body>#__unchecked_get + (local.get $1) + (local.get $2) + ) + ) + (local.set $8 + (f64.load + (local.get $4) + ) + ) + (local.set $9 + (f64.load offset=8 + (local.get $4) + ) + ) + (local.set $10 + (f64.load offset=16 + (local.get $4) + ) + ) + (local.set $11 + (f64.load offset=24 + (local.get $4) + ) + ) + (local.set $12 + (f64.load offset=32 + (local.get $4) + ) + ) + (local.set $13 + (f64.load offset=40 + (local.get $4) + ) + ) + (local.set $14 + (f64.load offset=48 + (local.get $4) + ) + ) + (local.set $7 + (f64.add + (local.get $7) + (f64.mul + (f64.mul + (f64.const 0.5) + (local.get $14) + ) + (f64.add + (f64.add + (f64.mul + (local.get $11) + (local.get $11) + ) + (f64.mul + (local.get $12) + (local.get $12) + ) + ) + (f64.mul + (local.get $13) + (local.get $13) + ) + ) + ) + ) + ) + (block $label$6 + (local.set $5 + (i32.add + (local.get $2) + (i32.const 1) + ) + ) + (loop $label$7 + (br_if $label$6 + (i32.eqz + (i32.lt_u + (local.get $5) + (local.get $3) + ) + ) + ) + (block $label$8 + (local.set $6 + (call $~lib/array/Array<Body>#__unchecked_get + (local.get $1) + (local.get $5) + ) + ) + (local.set $15 + (f64.sub + (local.get $8) + (f64.load + (local.get $6) + ) + ) + ) + (local.set $16 + (f64.sub + (local.get $9) + (f64.load offset=8 + (local.get $6) + ) + ) + ) + (local.set $17 + (f64.sub + (local.get $10) + (f64.load offset=16 + (local.get $6) + ) + ) + ) + (local.set $18 + (block $label$9 (result f64) + (local.set $18 + (f64.add + (f64.add + (f64.mul + (local.get $15) + (local.get $15) + ) + (f64.mul + (local.get $16) + (local.get $16) + ) + ) + (f64.mul + (local.get $17) + (local.get $17) + ) + ) + ) + (f64.sqrt + (local.get $18) + ) + ) + ) + (local.set $7 + (f64.sub + (local.get $7) + (f64.div + (f64.mul + (local.get $14) + (f64.load offset=48 + (local.get $6) + ) + ) + (local.get $18) + ) + ) + ) + ) + (local.set $5 + (i32.add + (local.get $5) + (i32.const 1) + ) + ) + (br $label$7) + ) + ) + ) + (local.set $2 + (i32.add + (local.get $2) + (i32.const 1) + ) + ) + (br $label$4) + ) + ) + (local.get $7) + ) + ;; CHECK: (func $assembly/index/step (; has Stack IR ;) (result f64) + ;; CHECK-NEXT: (local $0 f64) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (local $4 i32) + ;; CHECK-NEXT: (local $5 i32) + ;; CHECK-NEXT: (local $6 f64) + ;; CHECK-NEXT: (local $7 f64) + ;; CHECK-NEXT: (local $8 f64) + ;; CHECK-NEXT: (local $9 f64) + ;; CHECK-NEXT: (local $10 f64) + ;; CHECK-NEXT: (call $assembly/index/NBodySystem#advance + ;; CHECK-NEXT: (global.get $global$5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $5 + ;; CHECK-NEXT: (i32.load offset=4 + ;; CHECK-NEXT: (local.tee $4 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (global.get $global$5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$4 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_u + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $7 + ;; CHECK-NEXT: (f64.load + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $8 + ;; CHECK-NEXT: (f64.load offset=8 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $9 + ;; CHECK-NEXT: (f64.load offset=16 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $10 + ;; CHECK-NEXT: (f64.load offset=48 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.const 0.5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (f64.load offset=24 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (f64.load offset=32 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (f64.load offset=40 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (loop $label$7 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.lt_u + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $6 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $7) + ;; CHECK-NEXT: (f64.load + ;; CHECK-NEXT: (local.tee $3 + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (f64.div + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $10) + ;; CHECK-NEXT: (f64.load offset=48 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.sqrt + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.add + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: (local.get $6) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $8) + ;; CHECK-NEXT: (f64.load offset=8 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (f64.mul + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (f64.sub + ;; CHECK-NEXT: (local.get $9) + ;; CHECK-NEXT: (f64.load offset=16 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$7) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + (func $assembly/index/step (; 23 ;) (type $8) (result f64) + (call $assembly/index/NBodySystem#advance + (global.get $global$5) + (f64.const 0.01) + ) + (call $assembly/index/NBodySystem#energy + (global.get $global$5) + ) + ) + ;; CHECK: (func $assembly/index/bench (; has Stack IR ;) (param $0 i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (block $label$1 + ;; CHECK-NEXT: (loop $label$2 + ;; CHECK-NEXT: (br_if $label$1 + ;; CHECK-NEXT: (i32.le_u + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $assembly/index/NBodySystem#advance + ;; CHECK-NEXT: (global.get $global$5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $assembly/index/bench (; 24 ;) (type $11) (param $0 i32) + (local $1 i32) + (block $label$1 + (local.set $1 + (i32.const 0) + ) + (loop $label$2 + (br_if $label$1 + (i32.eqz + (i32.lt_u + (local.get $1) + (local.get $0) + ) + ) + ) + (call $assembly/index/NBodySystem#advance + (global.get $global$5) + (f64.const 0.01) + ) + (local.set $1 + (i32.add + (local.get $1) + (i32.const 1) + ) + ) + (br $label$2) + ) + ) + ) + ;; CHECK: (func $assembly/index/getBody (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.gt_u + ;; CHECK-NEXT: (i32.load offset=4 + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (global.get $global$5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.gt_u + ;; CHECK-NEXT: (i32.shr_u + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.tee $1 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.load offset=8 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.shl + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $assembly/index/getBody (; 25 ;) (type $3) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local.set $1 + (i32.load + (global.get $global$5) + ) + ) + (if (result i32) + (i32.lt_u + (local.get $0) + (block $label$1 (result i32) + (local.set $2 + (local.get $1) + ) + (i32.load offset=4 + (local.get $2) + ) + ) + ) + (call $~lib/array/Array<Body>#__get + (local.get $1) + (local.get $0) + ) + (i32.const 0) + ) + ) + ;; CHECK: (func $start (; has Stack IR ;) + ;; CHECK-NEXT: (global.set $global$0 + ;; CHECK-NEXT: (i32.const 104) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (i32.const 104) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $start (; 26 ;) (type $0) + (call $start:assembly/index) + ) + ;; CHECK: (func $null (; has Stack IR ;) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $null (; 27 ;) (type $0) + ) +) + diff --git a/test/lit/passes/O_all-features.wast b/test/lit/passes/O_all-features.wast new file mode 100644 index 000000000..dc538e952 --- /dev/null +++ b/test/lit/passes/O_all-features.wast @@ -0,0 +1,33 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O --all-features -S -o - | filecheck %s + +;; Test that we can run GC types through the optimizer +(module + ;; CHECK: (type $struct.A (struct (field i32))) + (type $struct.A (struct i32)) + + (func "foo" (param $x (ref null $struct.A)) + ;; get a struct reference + (drop + (local.get $x) + ) + ;; get a struct field value + ;; (note that since this is a nullable reference, it may trap) + (drop + (struct.get $struct.A 0 (local.get $x)) + ) + ) +) +;; CHECK: (type $ref?|$struct.A|_=>_none (func (param (ref null $struct.A)))) + +;; CHECK: (export "foo" (func $0)) + +;; CHECK: (func $0 (; has Stack IR ;) (param $0 (ref null $struct.A)) +;; CHECK-NEXT: (drop +;; CHECK-NEXT: (struct.get $struct.A 0 +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) diff --git a/test/lit/passes/O_all-features_ignore-implicit-traps.wast b/test/lit/passes/O_all-features_ignore-implicit-traps.wast new file mode 100644 index 000000000..1a7d431f1 --- /dev/null +++ b/test/lit/passes/O_all-features_ignore-implicit-traps.wast @@ -0,0 +1,30 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O --all-features --ignore-implicit-traps -S -o - | filecheck %s + +;; Test that we can run GC types through the optimizer +(module + ;; CHECK: (type $ref?|$struct.A|_=>_none (func (param (ref null $struct.A)))) + + ;; CHECK: (type $struct.A (struct (field i32))) + (type $struct.A (struct i32)) + + (func "foo" (param $x (ref null $struct.A)) + ;; get a struct reference + (drop + (local.get $x) + ) + ;; get a struct field value + ;; (note that since this is a nullable reference, it may trap, but we + ;; are ignoring implicit traps, so it has no side effects) + (drop + (struct.get $struct.A 0 (local.get $x)) + ) + ) +) +;; CHECK: (export "foo" (func $0)) + +;; CHECK: (func $0 (; has Stack IR ;) (param $0 (ref null $struct.A)) +;; CHECK-NEXT: (nop) +;; CHECK-NEXT: ) diff --git a/test/lit/passes/O_fast-math.wast b/test/lit/passes/O_fast-math.wast new file mode 100644 index 000000000..4d0224f6c --- /dev/null +++ b/test/lit/passes/O_fast-math.wast @@ -0,0 +1,159 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -O --fast-math -S -o - | filecheck %s + +;; with fast-math we can optimize some of these patterns +(module + (func "div" (result f32) + (f32.div + (f32.const -nan:0x23017a) + (f32.const 1) + ) + ) + (func "mul1" (result f32) + (f32.mul + (f32.const -nan:0x34546d) + (f32.const 1) + ) + ) + (func "mul2" (result f32) + (f32.mul + (f32.const 1) + (f32.const -nan:0x34546d) + ) + ) + (func "add1" (result f32) + (f32.add + (f32.const -nan:0x34546d) + (f32.const -0) + ) + ) + (func "add2" (result f32) + (f32.add + (f32.const -0) + (f32.const -nan:0x34546d) + ) + ) + (func "add3" (result f32) + (f32.add + (f32.const -nan:0x34546d) + (f32.const 0) + ) + ) + (func "add4" (result f32) + (f32.add + (f32.const 0) + (f32.const -nan:0x34546d) + ) + ) + (func "sub1" (result f32) + (f32.sub + (f32.const -nan:0x34546d) + (f32.const 0) + ) + ) + (func "sub2" (result f32) + (f32.sub + (f32.const -nan:0x34546d) + (f32.const -0) + ) + ) + (func "mul_neg_one1" (param $x f32) (result f32) + (f32.mul + (local.get $x) + (f32.const -1) + ) + ) + (func "mul_neg_one2" (param $x f64) (result f64) + (f64.mul + (local.get $x) + (f64.const -1) + ) + ) + (func "abs_sub_zero1" (param $x f32) (result f32) + ;; abs(0 - x) ==> abs(x) + (f32.abs + (f32.sub + (f32.const 0) + (local.get $x) + ) + ) + ) + (func "abs_sub_zero2" (param $x f64) (result f64) + ;; abs(0 - x) ==> abs(x) + (f64.abs + (f64.sub + (f64.const 0) + (local.get $x) + ) + ) + ) +) +;; CHECK: (type $none_=>_f32 (func (result f32))) + +;; CHECK: (type $f32_=>_f32 (func (param f32) (result f32))) + +;; CHECK: (type $f64_=>_f64 (func (param f64) (result f64))) + +;; CHECK: (export "div" (func $0)) + +;; CHECK: (export "mul1" (func $1)) + +;; CHECK: (export "mul2" (func $2)) + +;; CHECK: (export "add1" (func $1)) + +;; CHECK: (export "add2" (func $2)) + +;; CHECK: (export "add3" (func $2)) + +;; CHECK: (export "add4" (func $2)) + +;; CHECK: (export "sub1" (func $1)) + +;; CHECK: (export "sub2" (func $2)) + +;; CHECK: (export "mul_neg_one1" (func $9)) + +;; CHECK: (export "mul_neg_one2" (func $10)) + +;; CHECK: (export "abs_sub_zero1" (func $11)) + +;; CHECK: (export "abs_sub_zero2" (func $12)) + +;; CHECK: (func $0 (; has Stack IR ;) (result f32) +;; CHECK-NEXT: (f32.const -nan:0x23017a) +;; CHECK-NEXT: ) + +;; CHECK: (func $1 (; has Stack IR ;) (result f32) +;; CHECK-NEXT: (f32.const -nan:0x34546d) +;; CHECK-NEXT: ) + +;; CHECK: (func $2 (; has Stack IR ;) (result f32) +;; CHECK-NEXT: (f32.const nan:0x400000) +;; CHECK-NEXT: ) + +;; CHECK: (func $9 (; has Stack IR ;) (param $0 f32) (result f32) +;; CHECK-NEXT: (f32.neg +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) + +;; CHECK: (func $10 (; has Stack IR ;) (param $0 f64) (result f64) +;; CHECK-NEXT: (f64.neg +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) + +;; CHECK: (func $11 (; has Stack IR ;) (param $0 f32) (result f32) +;; CHECK-NEXT: (f32.abs +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) + +;; CHECK: (func $12 (; has Stack IR ;) (param $0 f64) (result f64) +;; CHECK-NEXT: (f64.abs +;; CHECK-NEXT: (local.get $0) +;; CHECK-NEXT: ) +;; CHECK-NEXT: ) diff --git a/test/lit/passes/Oz.wast b/test/lit/passes/Oz.wast new file mode 100644 index 000000000..2ded890f7 --- /dev/null +++ b/test/lit/passes/Oz.wast @@ -0,0 +1,117 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; NOTE: This test was ported using port_test.py and could be cleaned up. + +;; RUN: foreach %s %t wasm-opt -Oz -S -o - | filecheck %s + +(module + (memory 100 100) + ;; CHECK: (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + + ;; CHECK: (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) + + ;; CHECK: (memory $0 100 100) + + ;; CHECK: (export "localcse" (func $basics)) + + ;; CHECK: (export "localcse-2" (func $8)) + + ;; CHECK: (func $basics (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $basics (export "localcse") (param $x i32) ($param $y i32) (result i32) ;; -O3 does localcse + (local $x2 i32) + (local $y2 i32) + (local.set $x2 + (i32.add (local.get $x) (local.get $y)) + ) + (local.set $y2 + (i32.add (local.get $x) (local.get $y)) + ) + (i32.add (local.get $x2) (local.get $y2)) + ) + ;; CHECK: (func $8 (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.and + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const -75) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.or + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 8) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + (func $8 (export "localcse-2") (param $var$0 i32) + (param $var$1 i32) + (param $var$2 i32) + (param $var$3 i32) + (result i32) + (block $label$0 (result i32) + (i32.store + (local.tee $var$2 + (i32.add + (local.get $var$1) + (i32.const 4) + ) + ) + (i32.and + (i32.load + (local.get $var$2) + ) + (i32.xor + (local.tee $var$2 + (i32.const 74) + ) + (i32.const -1) + ) + ) + ) + (i32.store + (local.tee $var$1 + (i32.add + (local.get $var$1) + (i32.const 4) + ) + ) + (i32.or + (i32.load + (local.get $var$1) + ) + (i32.and + (local.get $var$2) + (i32.const 8) + ) + ) + ) + (i32.const 0) + ) + ) +) diff --git a/test/passes/O.txt b/test/passes/O.txt deleted file mode 100644 index 939d00eda..000000000 --- a/test/passes/O.txt +++ /dev/null @@ -1,56 +0,0 @@ -(module - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $none_=>_i32 (func (result i32))) - (type $i64_=>_none (func (param i64))) - (export "ret" (func $ret)) - (export "waka" (func $if-0-unreachable-to-none)) - (export "many-selects" (func $many-selects)) - (export "end-if-else" (func $end-if-else)) - (export "end-if-else-call" (func $end-if-else-call)) - (func $ret (; has Stack IR ;) (result i32) - (drop - (call $ret) - ) - (if - (call $ret) - (return - (i32.const 1) - ) - ) - (i32.const 999) - ) - (func $if-0-unreachable-to-none (; has Stack IR ;) (param $0 i64) - (unreachable) - ) - (func $many-selects (; has Stack IR ;) (param $0 i32) (result i32) - (select - (i32.const -1073741824) - (select - (i32.const 1073741823) - (local.get $0) - (i32.gt_s - (local.get $0) - (i32.const 1073741823) - ) - ) - (i32.lt_s - (local.get $0) - (i32.const -1073741824) - ) - ) - ) - (func $end-if-else (; has Stack IR ;) (param $0 i32) (result i32) - (select - (i32.const 1) - (local.get $0) - (local.get $0) - ) - ) - (func $end-if-else-call (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) - (local.get $0) - (call $ret) - (local.get $0) - ) - ) -) diff --git a/test/passes/O.wast b/test/passes/O.wast deleted file mode 100644 index 393e6e843..000000000 --- a/test/passes/O.wast +++ /dev/null @@ -1,67 +0,0 @@ -(module - (func $ret (export "ret") (result i32) - (block $out (result i32) - (drop (call $ret)) - (if (call $ret) - (return - (return - (i32.const 1) - ) - ) - ) - (drop (br_if $out (i32.const 999) (i32.const 1))) - (unreachable) - ) - ) - (func $if-0-unreachable-to-none (export "waka") (param $var$0 i64) - (local $var$1 i64) - (local $var$2 i64) - (block $label$1 - (if - (i32.const 0) - (br $label$1) - (unreachable) - ) - ) - ) - (func $many-selects (export "many-selects") (param $0 i32) (result i32) - (if - (i32.lt_s - (local.get $0) - (i32.const -1073741824) - ) - (local.set $0 - (i32.const -1073741824) - ) - (if - (i32.gt_s - (local.get $0) - (i32.const 1073741823) - ) - (local.set $0 - (i32.const 1073741823) - ) - ) - ) - (local.get $0) - ) - (func $end-if-else (export "end-if-else") (param $x i32) (result i32) - (if - (local.get $x) - (local.set $x - (i32.const 1) - ) - ) - (local.get $x) - ) - (func $end-if-else-call (export "end-if-else-call") (param $x i32) (result i32) - (if - (local.get $x) - (local.set $x - (call $ret) - ) - ) - (local.get $x) - ) -) - diff --git a/test/passes/O1.txt b/test/passes/O1.txt deleted file mode 100644 index 8c286d8e6..000000000 --- a/test/passes/O1.txt +++ /dev/null @@ -1,13 +0,0 @@ -(module - (type $none_=>_i32 (func (result i32))) - (memory $0 1 1) - (export "foo" (func $0)) - (func $0 (result i32) - (drop - (i32.const 0) - ) - (i32.load align=1 - (i32.const 4) - ) - ) -) diff --git a/test/passes/O1.wast b/test/passes/O1.wast deleted file mode 100644 index 6c1f3abda..000000000 --- a/test/passes/O1.wast +++ /dev/null @@ -1,25 +0,0 @@ -(module - (memory $0 1 1) - (global $global$0 (mut i32) (i32.const 10)) - (func "foo" (result i32) - (i32.load offset=4 align=1 - (i32.and - (block $label$1 (result i32) - (global.set $global$0 - (i32.const 0) - ) - (i32.const -64) - ) - (i32.const 15) - ) - ) - ) - (func $signed-overflow (param $0 f32) (result i32) - (i32.sub - (i32.const 268435456) - (i32.const -2147483648) - ) - ) -) - - diff --git a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt deleted file mode 100644 index 0b52b5a56..000000000 --- a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt +++ /dev/null @@ -1,95 +0,0 @@ -(module - (type $t0 (func (param i32) (result i32))) - (memory $memory 0) - (export "fib" (func $fib)) - (export "looped" (func $looped)) - (export "t0" (func $looped)) - (export "t1" (func $t1)) - (export "t2" (func $t2)) - (export "t3" (func $t3)) - (export "memory" (memory $memory)) - (func $fib (; has Stack IR ;) (param $0 i32) (result i32) - (if - (i32.le_s - (local.get $0) - (i32.const 2) - ) - (return - (local.get $0) - ) - ) - (i32.add - (call $fib - (i32.sub - (local.get $0) - (i32.const 1) - ) - ) - (call $fib - (i32.sub - (local.get $0) - (i32.const 2) - ) - ) - ) - ) - (func $looped (; has Stack IR ;) (param $0 i32) (result i32) - (loop $L0 - (if - (i32.ge_s - (local.get $0) - (i32.const 0) - ) - (block - (local.set $0 - (i32.sub - (local.get $0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $0) - ) - (func $t1 (; has Stack IR ;) (param $0 i32) (result i32) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 1) - ) - ) - (loop $L0 - (if - (i32.ge_s - (local.get $0) - (i32.const 0) - ) - (block - (local.set $0 - (i32.sub - (local.get $0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $0) - ) - (func $t2 (; has Stack IR ;) (param $0 i32) (result i32) - (call $fib - (local.get $0) - ) - ) - (func $t3 (; has Stack IR ;) (param $0 i32) (result i32) - (call $fib - (i32.add - (local.get $0) - (i32.const 1) - ) - ) - ) -) diff --git a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast deleted file mode 100644 index b1085b922..000000000 --- a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast +++ /dev/null @@ -1,80 +0,0 @@ -(module - (type $t0 (func (param i32) (result i32))) - (func $fib (export "fib") (type $t0) (param $p0 i32) (result i32) - (if $I0 - (i32.le_s - (local.get $p0) - (i32.const 2) - ) - (then - (return - (local.get $p0) - ) - ) - ) - (i32.add - (call $fib - (i32.sub - (local.get $p0) - (i32.const 1) - ) - ) - (call $fib - (i32.sub - (local.get $p0) - (i32.const 2) - ) - ) - ) - ) - (func $looped (export "looped") (type $t0) (param $p0 i32) (result i32) - (loop $L0 - (if $I1 - (i32.ge_s - (local.get $p0) - (i32.const 0) - ) - (then - (local.set $p0 - (i32.sub - (local.get $p0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $p0) - ) - - (func $t0 (export "t0") (type $t0) (param $p0 i32) (result i32) - (call $looped - (local.get $p0) - ) - ) - - (func $t1 (export "t1") (type $t0) (param $p0 i32) (result i32) - (call $looped - (i32.add - (local.get $p0) - (i32.const 1) - ) - ) - ) - (func $t2 (export "t2") (type $t0) (param $p0 i32) (result i32) - (call $fib - (local.get $p0) - ) - ) - - (func $t3 (export "t3") (type $t0) (param $p0 i32) (result i32) - (call $fib - (i32.add - (local.get $p0) - (i32.const 1) - ) - ) - ) - (memory $memory (export "memory") 0) -) diff --git a/test/passes/O3_inlining.txt b/test/passes/O3_inlining.txt deleted file mode 100644 index 808f03ae8..000000000 --- a/test/passes/O3_inlining.txt +++ /dev/null @@ -1,23 +0,0 @@ -(module - (type $i32_=>_none (func (param i32))) - (global $global$1 (mut i32) (i32.const 100)) - (memory $0 1 1) - (export "func_217" (func $1)) - (func $1 (param $0 i32) - (if - (global.get $global$1) - (unreachable) - ) - (global.set $global$1 - (i32.const 0) - ) - (if - (i32.eqz - (i32.load16_u - (i32.const 3) - ) - ) - (unreachable) - ) - ) -) diff --git a/test/passes/O3_inlining.wast b/test/passes/O3_inlining.wast deleted file mode 100644 index 8d1a18f2f..000000000 --- a/test/passes/O3_inlining.wast +++ /dev/null @@ -1,44 +0,0 @@ -(module - (global $global$0 (mut f64) (f64.const -32768)) - (global $global$1 (mut i32) (i32.const 100)) - (memory $0 1 1) - (export "func_217" (func $1)) - (func $0 - (if - (global.get $global$1) - (unreachable) - ) - (global.set $global$1 - (i32.const 0) - ) - (block $label$2 - (global.set $global$0 - (block $label$3 (result f64) - (br_if $label$2 - (if (result i32) - (i32.load16_u offset=3 - (i32.const 0) - ) - (i32.const 1) - (i32.const 0) - ) - ) - (unreachable) - ) - ) - ) - ) - (func $1 (param $var$0 i32) - (drop - (call $2 - (f32.const 1) - (i32.const 1) - (i32.const 0) - ) - ) - ) - (func $2 (param $var$0 f32) (param $var$1 i32) (param $var$2 i32) (result i32) - (call $0) - (i32.const 0) - ) -) diff --git a/test/passes/O4_disable-bulk-memory.txt b/test/passes/O4_disable-bulk-memory.txt deleted file mode 100644 index 3e3607a32..000000000 --- a/test/passes/O4_disable-bulk-memory.txt +++ /dev/null @@ -1,1260 +0,0 @@ -(module - (type $0 (func)) - (export "func_59_invoker" (func $0)) - (func $0 (; has Stack IR ;) - (unreachable) - ) -) -(module - (type $0 (func)) - (type $3 (func (param i32) (result i32))) - (type $11 (func (param i32))) - (type $f64_f64_f64_f64_f64_f64_f64_=>_i32 (func (param f64 f64 f64 f64 f64 f64 f64) (result i32))) - (type $8 (func (result f64))) - (import "env" "memory" (memory $1 1)) - (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") - (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (table $0 1 funcref) - (elem (i32.const 0) $null) - (export "memory" (memory $0)) - (export "table" (table $0)) - (export "init" (func $assembly/index/init)) - (export "step" (func $assembly/index/step)) - (export "bench" (func $assembly/index/bench)) - (export "getBody" (func $assembly/index/getBody)) - (start $start) - (func $~lib/allocator/arena/__memory_allocate (; has Stack IR ;) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (if - (i32.gt_u - (local.get $0) - (i32.const 1073741824) - ) - (unreachable) - ) - (if - (i32.gt_u - (local.tee $0 - (i32.and - (i32.add - (i32.add - (local.tee $1 - (global.get $global$1) - ) - (select - (local.get $0) - (i32.const 1) - (i32.gt_u - (local.get $0) - (i32.const 1) - ) - ) - ) - (i32.const 7) - ) - (i32.const -8) - ) - ) - (i32.shl - (local.tee $2 - (memory.size) - ) - (i32.const 16) - ) - ) - (if - (i32.lt_s - (memory.grow - (select - (local.get $2) - (local.tee $3 - (i32.shr_u - (i32.and - (i32.add - (i32.sub - (local.get $0) - (local.get $1) - ) - (i32.const 65535) - ) - (i32.const -65536) - ) - (i32.const 16) - ) - ) - (i32.gt_s - (local.get $2) - (local.get $3) - ) - ) - ) - (i32.const 0) - ) - (if - (i32.lt_s - (memory.grow - (local.get $3) - ) - (i32.const 0) - ) - (unreachable) - ) - ) - ) - (global.set $global$1 - (local.get $0) - ) - (local.get $1) - ) - (func $assembly/index/Body#constructor (; has Stack IR ;) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32) - (local $7 i32) - (f64.store - (local.tee $7 - (call $~lib/allocator/arena/__memory_allocate - (i32.const 56) - ) - ) - (local.get $0) - ) - (f64.store offset=8 - (local.get $7) - (local.get $1) - ) - (f64.store offset=16 - (local.get $7) - (local.get $2) - ) - (f64.store offset=24 - (local.get $7) - (local.get $3) - ) - (f64.store offset=32 - (local.get $7) - (local.get $4) - ) - (f64.store offset=40 - (local.get $7) - (local.get $5) - ) - (f64.store offset=48 - (local.get $7) - (local.get $6) - ) - (local.get $7) - ) - (func $assembly/index/init (; has Stack IR ;) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 f64) - (local $5 f64) - (local $6 f64) - (local $7 f64) - (i32.store - (local.tee $0 - (call $~lib/allocator/arena/__memory_allocate - (i32.const 32) - ) - ) - (i32.const 20) - ) - (i32.store - (local.tee $2 - (call $~lib/allocator/arena/__memory_allocate - (i32.const 8) - ) - ) - (i32.const 0) - ) - (i32.store offset=4 - (local.get $2) - (i32.const 0) - ) - (i32.store - (local.get $2) - (local.get $0) - ) - (i32.store offset=4 - (local.get $2) - (i32.const 5) - ) - (i32.store8 - (local.tee $0 - (i32.add - (local.get $0) - (i32.const 8) - ) - ) - (i32.const 0) - ) - (i32.store8 - (i32.sub - (local.tee $1 - (i32.add - (local.get $0) - (i32.const 20) - ) - ) - (i32.const 1) - ) - (i32.const 0) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 1) - ) - (i32.const 0) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 2) - ) - (i32.const 0) - ) - (i32.store8 - (i32.sub - (local.get $1) - (i32.const 2) - ) - (i32.const 0) - ) - (i32.store8 - (i32.sub - (local.get $1) - (i32.const 3) - ) - (i32.const 0) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 3) - ) - (i32.const 0) - ) - (i32.store8 - (i32.sub - (local.get $1) - (i32.const 4) - ) - (i32.const 0) - ) - (i32.store - (local.tee $0 - (i32.add - (local.tee $1 - (i32.and - (i32.sub - (i32.const 0) - (local.get $0) - ) - (i32.const 3) - ) - ) - (local.get $0) - ) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (i32.add - (local.tee $1 - (i32.and - (i32.sub - (i32.const 20) - (local.get $1) - ) - (i32.const -4) - ) - ) - (local.get $0) - ) - (i32.const 4) - ) - (i32.const 0) - ) - (block $__inlined_func$~lib/internal/memory/memset - (br_if $__inlined_func$~lib/internal/memory/memset - (i32.le_u - (local.get $1) - (i32.const 8) - ) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 4) - ) - (i32.const 0) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 8) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.tee $3 - (i32.add - (local.get $0) - (local.get $1) - ) - ) - (i32.const 12) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.get $3) - (i32.const 8) - ) - (i32.const 0) - ) - (br_if $__inlined_func$~lib/internal/memory/memset - (i32.le_u - (local.get $1) - (i32.const 24) - ) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 12) - ) - (i32.const 0) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 16) - ) - (i32.const 0) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 20) - ) - (i32.const 0) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 24) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.tee $3 - (i32.add - (local.get $0) - (local.get $1) - ) - ) - (i32.const 28) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.get $3) - (i32.const 24) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.get $3) - (i32.const 20) - ) - (i32.const 0) - ) - (i32.store - (i32.sub - (local.get $3) - (i32.const 16) - ) - (i32.const 0) - ) - (local.set $0 - (i32.add - (local.tee $3 - (i32.add - (i32.and - (local.get $0) - (i32.const 4) - ) - (i32.const 24) - ) - ) - (local.get $0) - ) - ) - (local.set $1 - (i32.sub - (local.get $1) - (local.get $3) - ) - ) - (loop $label$8 - (if - (i32.ge_u - (local.get $1) - (i32.const 32) - ) - (block - (i64.store - (local.get $0) - (i64.const 0) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 8) - ) - (i64.const 0) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 16) - ) - (i64.const 0) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 24) - ) - (i64.const 0) - ) - (local.set $1 - (i32.sub - (local.get $1) - (i32.const 32) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 32) - ) - ) - (br $label$8) - ) - ) - ) - ) - (local.set $0 - (call $assembly/index/Body#constructor - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 39.47841760435743) - ) - ) - (i32.store offset=8 - (i32.load - (local.get $2) - ) - (local.get $0) - ) - (local.set $0 - (call $assembly/index/Body#constructor - (f64.const 4.841431442464721) - (f64.const -1.1603200440274284) - (f64.const -0.10362204447112311) - (f64.const 0.606326392995832) - (f64.const 2.81198684491626) - (f64.const -0.02521836165988763) - (f64.const 0.03769367487038949) - ) - ) - (i32.store offset=8 - (i32.add - (i32.load - (local.get $2) - ) - (i32.const 4) - ) - (local.get $0) - ) - (local.set $0 - (call $assembly/index/Body#constructor - (f64.const 8.34336671824458) - (f64.const 4.124798564124305) - (f64.const -0.4035234171143214) - (f64.const -1.0107743461787924) - (f64.const 1.8256623712304119) - (f64.const 0.008415761376584154) - (f64.const 0.011286326131968767) - ) - ) - (i32.store offset=8 - (i32.add - (i32.load - (local.get $2) - ) - (i32.const 8) - ) - (local.get $0) - ) - (local.set $0 - (call $assembly/index/Body#constructor - (f64.const 12.894369562139131) - (f64.const -15.111151401698631) - (f64.const -0.22330757889265573) - (f64.const 1.0827910064415354) - (f64.const 0.8687130181696082) - (f64.const -0.010832637401363636) - (f64.const 1.7237240570597112e-03) - ) - ) - (i32.store offset=8 - (i32.add - (i32.load - (local.get $2) - ) - (i32.const 12) - ) - (local.get $0) - ) - (local.set $0 - (call $assembly/index/Body#constructor - (f64.const 15.379697114850917) - (f64.const -25.919314609987964) - (f64.const 0.17925877295037118) - (f64.const 0.979090732243898) - (f64.const 0.5946989986476762) - (f64.const -0.034755955504078104) - (f64.const 2.0336868699246304e-03) - ) - ) - (i32.store offset=8 - (i32.add - (i32.load - (local.get $2) - ) - (i32.const 16) - ) - (local.get $0) - ) - (local.set $0 - (i32.const 0) - ) - (local.set $3 - (i32.load offset=4 - (local.get $2) - ) - ) - (loop $label$3 - (if - (i32.lt_s - (local.get $0) - (local.get $3) - ) - (block - (local.set $4 - (f64.load offset=48 - (local.tee $1 - (i32.load offset=8 - (i32.add - (i32.load - (local.get $2) - ) - (i32.shl - (local.get $0) - (i32.const 2) - ) - ) - ) - ) - ) - ) - (local.set $5 - (f64.add - (local.get $5) - (f64.mul - (f64.load offset=24 - (local.get $1) - ) - (local.get $4) - ) - ) - ) - (local.set $6 - (f64.add - (local.get $6) - (f64.mul - (f64.load offset=32 - (local.get $1) - ) - (local.get $4) - ) - ) - ) - (local.set $7 - (f64.add - (local.get $7) - (f64.mul - (f64.load offset=40 - (local.get $1) - ) - (local.get $4) - ) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 1) - ) - ) - (br $label$3) - ) - ) - ) - (f64.store offset=24 - (local.tee $0 - (if (result i32) - (i32.shr_u - (i32.load - (local.tee $0 - (i32.load - (local.get $2) - ) - ) - ) - (i32.const 2) - ) - (i32.load offset=8 - (local.get $0) - ) - (unreachable) - ) - ) - (f64.div - (local.get $5) - (f64.const -39.47841760435743) - ) - ) - (f64.store offset=32 - (local.get $0) - (f64.div - (local.get $6) - (f64.const -39.47841760435743) - ) - ) - (f64.store offset=40 - (local.get $0) - (f64.div - (local.get $7) - (f64.const -39.47841760435743) - ) - ) - (i32.store - (local.tee $0 - (call $~lib/allocator/arena/__memory_allocate - (i32.const 4) - ) - ) - (local.get $2) - ) - (global.set $global$5 - (local.get $0) - ) - ) - (func $assembly/index/NBodySystem#advance (; has Stack IR ;) (param $0 i32) - (local $1 i32) - (local $2 f64) - (local $3 i32) - (local $4 f64) - (local $5 f64) - (local $6 f64) - (local $7 i32) - (local $8 f64) - (local $9 f64) - (local $10 f64) - (local $11 f64) - (local $12 i32) - (local $13 i32) - (local $14 f64) - (local $15 f64) - (local $16 f64) - (local $17 f64) - (local.set $13 - (i32.load offset=4 - (local.tee $12 - (i32.load - (local.get $0) - ) - ) - ) - ) - (loop $label$3 - (if - (i32.lt_u - (local.get $3) - (local.get $13) - ) - (block - (local.set $14 - (f64.load - (local.tee $0 - (i32.load offset=8 - (i32.add - (i32.load - (local.get $12) - ) - (i32.shl - (local.get $3) - (i32.const 2) - ) - ) - ) - ) - ) - ) - (local.set $15 - (f64.load offset=8 - (local.get $0) - ) - ) - (local.set $16 - (f64.load offset=16 - (local.get $0) - ) - ) - (local.set $4 - (f64.load offset=24 - (local.get $0) - ) - ) - (local.set $5 - (f64.load offset=32 - (local.get $0) - ) - ) - (local.set $6 - (f64.load offset=40 - (local.get $0) - ) - ) - (local.set $17 - (f64.load offset=48 - (local.get $0) - ) - ) - (local.set $7 - (i32.add - (local.get $3) - (i32.const 1) - ) - ) - (loop $label$6 - (if - (i32.lt_u - (local.get $7) - (local.get $13) - ) - (block - (local.set $11 - (f64.sqrt - (local.tee $8 - (f64.add - (f64.add - (f64.mul - (local.tee $2 - (f64.sub - (local.get $14) - (f64.load - (local.tee $1 - (i32.load offset=8 - (i32.add - (i32.load - (local.get $12) - ) - (i32.shl - (local.get $7) - (i32.const 2) - ) - ) - ) - ) - ) - ) - ) - (local.get $2) - ) - (f64.mul - (local.tee $9 - (f64.sub - (local.get $15) - (f64.load offset=8 - (local.get $1) - ) - ) - ) - (local.get $9) - ) - ) - (f64.mul - (local.tee $10 - (f64.sub - (local.get $16) - (f64.load offset=16 - (local.get $1) - ) - ) - ) - (local.get $10) - ) - ) - ) - ) - ) - (local.set $4 - (f64.sub - (local.get $4) - (f64.mul - (local.get $2) - (local.tee $8 - (f64.mul - (f64.load offset=48 - (local.get $1) - ) - (local.tee $11 - (f64.div - (f64.const 0.01) - (f64.mul - (local.get $8) - (local.get $11) - ) - ) - ) - ) - ) - ) - ) - ) - (local.set $5 - (f64.sub - (local.get $5) - (f64.mul - (local.get $9) - (local.get $8) - ) - ) - ) - (local.set $6 - (f64.sub - (local.get $6) - (f64.mul - (local.get $10) - (local.get $8) - ) - ) - ) - (f64.store offset=24 - (local.get $1) - (f64.add - (f64.load offset=24 - (local.get $1) - ) - (f64.mul - (local.get $2) - (local.tee $2 - (f64.mul - (local.get $17) - (local.get $11) - ) - ) - ) - ) - ) - (f64.store offset=32 - (local.get $1) - (f64.add - (f64.load offset=32 - (local.get $1) - ) - (f64.mul - (local.get $9) - (local.get $2) - ) - ) - ) - (f64.store offset=40 - (local.get $1) - (f64.add - (f64.load offset=40 - (local.get $1) - ) - (f64.mul - (local.get $10) - (local.get $2) - ) - ) - ) - (local.set $7 - (i32.add - (local.get $7) - (i32.const 1) - ) - ) - (br $label$6) - ) - ) - ) - (f64.store offset=24 - (local.get $0) - (local.get $4) - ) - (f64.store offset=32 - (local.get $0) - (local.get $5) - ) - (f64.store offset=40 - (local.get $0) - (local.get $6) - ) - (f64.store - (local.get $0) - (f64.add - (f64.load - (local.get $0) - ) - (f64.mul - (local.get $4) - (f64.const 0.01) - ) - ) - ) - (f64.store offset=8 - (local.get $0) - (f64.add - (f64.load offset=8 - (local.get $0) - ) - (f64.mul - (local.get $5) - (f64.const 0.01) - ) - ) - ) - (f64.store offset=16 - (local.get $0) - (f64.add - (f64.load offset=16 - (local.get $0) - ) - (f64.mul - (local.get $6) - (f64.const 0.01) - ) - ) - ) - (local.set $3 - (i32.add - (local.get $3) - (i32.const 1) - ) - ) - (br $label$3) - ) - ) - ) - ) - (func $assembly/index/step (; has Stack IR ;) (result f64) - (local $0 f64) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 f64) - (local $7 f64) - (local $8 f64) - (local $9 f64) - (local $10 f64) - (call $assembly/index/NBodySystem#advance - (global.get $global$5) - ) - (local.set $5 - (i32.load offset=4 - (local.tee $4 - (i32.load - (global.get $global$5) - ) - ) - ) - ) - (loop $label$4 - (if - (i32.lt_u - (local.get $2) - (local.get $5) - ) - (block - (local.set $7 - (f64.load - (local.tee $1 - (i32.load offset=8 - (i32.add - (i32.load - (local.get $4) - ) - (i32.shl - (local.get $2) - (i32.const 2) - ) - ) - ) - ) - ) - ) - (local.set $8 - (f64.load offset=8 - (local.get $1) - ) - ) - (local.set $9 - (f64.load offset=16 - (local.get $1) - ) - ) - (local.set $0 - (f64.add - (local.get $0) - (f64.mul - (f64.mul - (local.tee $10 - (f64.load offset=48 - (local.get $1) - ) - ) - (f64.const 0.5) - ) - (f64.add - (f64.add - (f64.mul - (local.tee $0 - (f64.load offset=24 - (local.get $1) - ) - ) - (local.get $0) - ) - (f64.mul - (local.tee $0 - (f64.load offset=32 - (local.get $1) - ) - ) - (local.get $0) - ) - ) - (f64.mul - (local.tee $0 - (f64.load offset=40 - (local.get $1) - ) - ) - (local.get $0) - ) - ) - ) - ) - ) - (local.set $1 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (loop $label$7 - (if - (i32.lt_u - (local.get $1) - (local.get $5) - ) - (block - (local.set $6 - (f64.sub - (local.get $7) - (f64.load - (local.tee $3 - (i32.load offset=8 - (i32.add - (i32.load - (local.get $4) - ) - (i32.shl - (local.get $1) - (i32.const 2) - ) - ) - ) - ) - ) - ) - ) - (local.set $0 - (f64.sub - (local.get $0) - (f64.div - (f64.mul - (local.get $10) - (f64.load offset=48 - (local.get $3) - ) - ) - (f64.sqrt - (f64.add - (f64.add - (f64.mul - (local.get $6) - (local.get $6) - ) - (f64.mul - (local.tee $0 - (f64.sub - (local.get $8) - (f64.load offset=8 - (local.get $3) - ) - ) - ) - (local.get $0) - ) - ) - (f64.mul - (local.tee $0 - (f64.sub - (local.get $9) - (f64.load offset=16 - (local.get $3) - ) - ) - ) - (local.get $0) - ) - ) - ) - ) - ) - ) - (local.set $1 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (br $label$7) - ) - ) - ) - (local.set $2 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (br $label$4) - ) - ) - ) - (local.get $0) - ) - (func $assembly/index/bench (; has Stack IR ;) (param $0 i32) - (local $1 i32) - (block $label$1 - (loop $label$2 - (br_if $label$1 - (i32.le_u - (local.get $0) - (local.get $1) - ) - ) - (call $assembly/index/NBodySystem#advance - (global.get $global$5) - ) - (local.set $1 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (br $label$2) - ) - ) - ) - (func $assembly/index/getBody (; has Stack IR ;) (param $0 i32) (result i32) - (local $1 i32) - (if (result i32) - (i32.gt_u - (i32.load offset=4 - (local.tee $1 - (i32.load - (global.get $global$5) - ) - ) - ) - (local.get $0) - ) - (if (result i32) - (i32.gt_u - (i32.shr_u - (i32.load - (local.tee $1 - (i32.load - (local.get $1) - ) - ) - ) - (i32.const 2) - ) - (local.get $0) - ) - (i32.load offset=8 - (i32.add - (i32.shl - (local.get $0) - (i32.const 2) - ) - (local.get $1) - ) - ) - (unreachable) - ) - (i32.const 0) - ) - ) - (func $start (; has Stack IR ;) - (global.set $global$0 - (i32.const 104) - ) - (global.set $global$1 - (i32.const 104) - ) - ) - (func $null (; has Stack IR ;) - (nop) - ) -) diff --git a/test/passes/O4_disable-bulk-memory.wast b/test/passes/O4_disable-bulk-memory.wast deleted file mode 100644 index 9a8c38b49..000000000 --- a/test/passes/O4_disable-bulk-memory.wast +++ /dev/null @@ -1,1759 +0,0 @@ -(module - (type $0 (func)) - (global $global$0 (mut i32) (i32.const 10)) - (export "func_59_invoker" (func $0)) - (func $0 (; 0 ;) (type $0) - (if - (block $label$1 (result i32) - (global.set $global$0 - (i32.const 0) - ) - (i32.const 127) - ) - (unreachable) - ) - (global.set $global$0 - (i32.const -1) - ) - (if - (global.get $global$0) - (unreachable) - ) - (unreachable) - ) -) -;; AssemblyScript n-body benchmark -(module - (type $0 (func)) - (type $1 (func (param i32 i32) (result i32))) - (type $2 (func (param i32 f64 f64 f64) (result i32))) - (type $3 (func (param i32) (result i32))) - (type $4 (func (result i32))) - (type $5 (func (param i32 f64 f64 f64 f64 f64 f64 f64) (result i32))) - (type $6 (func (param i32 i32 i32 i32))) - (type $7 (func (param i32 i32 i32))) - (type $8 (func (result f64))) - (type $9 (func (param i32 f64))) - (type $10 (func (param i32) (result f64))) - (type $11 (func (param i32))) - (import "env" "memory" (memory $1 1)) - (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") - (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") - (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) - (table $0 1 funcref) - (elem (i32.const 0) $null) - (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 f64 (f64.const 3.141592653589793)) - (global $global$3 f64 (f64.const 39.47841760435743)) - (global $global$4 f64 (f64.const 365.24)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 i32 (i32.const 100)) - (export "memory" (memory $0)) - (export "table" (table $0)) - (export "init" (func $assembly/index/init)) - (export "step" (func $assembly/index/step)) - (export "bench" (func $assembly/index/bench)) - (export "getBody" (func $assembly/index/getBody)) - (start $start) - (func $start:~lib/allocator/arena (; 1 ;) (type $0) - (global.set $global$0 - (i32.and - (i32.add - (global.get $global$6) - (i32.const 7) - ) - (i32.xor - (i32.const 7) - (i32.const -1) - ) - ) - ) - (global.set $global$1 - (global.get $global$0) - ) - ) - (func $start:assembly/index (; 2 ;) (type $0) - (call $start:~lib/allocator/arena) - ) - (func $~lib/array/Array<Body>#__unchecked_get (; 3 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local.set $2 - (i32.load - (local.get $0) - ) - ) - (local.set $3 - (local.get $1) - ) - (local.set $4 - (i32.const 0) - ) - (i32.load offset=8 - (i32.add - (i32.add - (local.get $2) - (i32.shl - (local.get $3) - (i32.const 2) - ) - ) - (local.get $4) - ) - ) - ) - (func $~lib/array/Array<Body>#__get (; 4 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local.set $2 - (i32.load - (local.get $0) - ) - ) - (if (result i32) - (i32.lt_u - (local.get $1) - (i32.shr_u - (i32.load - (local.get $2) - ) - (i32.const 2) - ) - ) - (block (result i32) - (local.set $3 - (local.get $2) - ) - (local.set $4 - (local.get $1) - ) - (local.set $5 - (i32.const 0) - ) - (i32.load offset=8 - (i32.add - (i32.add - (local.get $3) - (i32.shl - (local.get $4) - (i32.const 2) - ) - ) - (local.get $5) - ) - ) - ) - (unreachable) - ) - ) - (func $assembly/index/Body#offsetMomentum (; 5 ;) (type $2) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) - (f64.store offset=24 - (local.get $0) - (f64.div - (f64.neg - (local.get $1) - ) - (global.get $global$3) - ) - ) - (f64.store offset=32 - (local.get $0) - (f64.div - (f64.neg - (local.get $2) - ) - (global.get $global$3) - ) - ) - (f64.store offset=40 - (local.get $0) - (f64.div - (f64.neg - (local.get $3) - ) - (global.get $global$3) - ) - ) - (local.get $0) - ) - (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $3) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (if - (i32.gt_u - (local.get $0) - (i32.const 1073741824) - ) - (unreachable) - ) - (local.set $1 - (global.get $global$1) - ) - (local.set $4 - (i32.and - (i32.add - (i32.add - (local.get $1) - (select - (local.tee $2 - (local.get $0) - ) - (local.tee $3 - (i32.const 1) - ) - (i32.gt_u - (local.get $2) - (local.get $3) - ) - ) - ) - (i32.const 7) - ) - (i32.xor - (i32.const 7) - (i32.const -1) - ) - ) - ) - (local.set $5 - (memory.size) - ) - (if - (i32.gt_u - (local.get $4) - (i32.shl - (local.get $5) - (i32.const 16) - ) - ) - (block - (local.set $2 - (i32.shr_u - (i32.and - (i32.add - (i32.sub - (local.get $4) - (local.get $1) - ) - (i32.const 65535) - ) - (i32.xor - (i32.const 65535) - (i32.const -1) - ) - ) - (i32.const 16) - ) - ) - (local.set $3 - (select - (local.tee $3 - (local.get $5) - ) - (local.tee $6 - (local.get $2) - ) - (i32.gt_s - (local.get $3) - (local.get $6) - ) - ) - ) - (if - (i32.lt_s - (memory.grow - (local.get $3) - ) - (i32.const 0) - ) - (if - (i32.lt_s - (memory.grow - (local.get $2) - ) - (i32.const 0) - ) - (unreachable) - ) - ) - ) - ) - (global.set $global$1 - (local.get $4) - ) - (local.get $1) - ) - (func $~lib/memory/memory.allocate (; 7 ;) (type $3) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (local.get $0) - ) - ) - ) - (func $assembly/index/NBodySystem#constructor (; 8 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 f64) - (local $6 f64) - (local $7 f64) - (local $8 f64) - (local.set $5 - (f64.const 0) - ) - (local.set $6 - (f64.const 0) - ) - (local.set $7 - (f64.const 0) - ) - (local.set $3 - (block $label$1 (result i32) - (local.set $2 - (local.get $1) - ) - (i32.load offset=4 - (local.get $2) - ) - ) - ) - (block $label$2 - (local.set $2 - (i32.const 0) - ) - (loop $label$3 - (br_if $label$2 - (i32.eqz - (i32.lt_s - (local.get $2) - (local.get $3) - ) - ) - ) - (block $label$4 - (local.set $4 - (call $~lib/array/Array<Body>#__unchecked_get - (local.get $1) - (local.get $2) - ) - ) - (local.set $8 - (f64.load offset=48 - (local.get $4) - ) - ) - (local.set $5 - (f64.add - (local.get $5) - (f64.mul - (f64.load offset=24 - (local.get $4) - ) - (local.get $8) - ) - ) - ) - (local.set $6 - (f64.add - (local.get $6) - (f64.mul - (f64.load offset=32 - (local.get $4) - ) - (local.get $8) - ) - ) - ) - (local.set $7 - (f64.add - (local.get $7) - (f64.mul - (f64.load offset=40 - (local.get $4) - ) - (local.get $8) - ) - ) - ) - ) - (local.set $2 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (br $label$3) - ) - ) - (drop - (call $assembly/index/Body#offsetMomentum - (call $~lib/array/Array<Body>#__get - (local.get $1) - (i32.const 0) - ) - (local.get $5) - (local.get $6) - (local.get $7) - ) - ) - (if - (i32.eqz - (local.get $0) - ) - (local.set $0 - (call $~lib/memory/memory.allocate - (i32.const 4) - ) - ) - ) - (i32.store - (local.get $0) - (local.get $1) - ) - (local.get $0) - ) - (func $assembly/index/Body#constructor (; 9 ;) (type $5) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) - (if - (i32.eqz - (local.get $0) - ) - (local.set $0 - (call $~lib/memory/memory.allocate - (i32.const 56) - ) - ) - ) - (f64.store - (local.get $0) - (local.get $1) - ) - (f64.store offset=8 - (local.get $0) - (local.get $2) - ) - (f64.store offset=16 - (local.get $0) - (local.get $3) - ) - (f64.store offset=24 - (local.get $0) - (local.get $4) - ) - (f64.store offset=32 - (local.get $0) - (local.get $5) - ) - (f64.store offset=40 - (local.get $0) - (local.get $6) - ) - (f64.store offset=48 - (local.get $0) - (local.get $7) - ) - (local.get $0) - ) - (func $assembly/index/Sun (; 10 ;) (type $4) (result i32) - (call $assembly/index/Body#constructor - (i32.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (f64.const 0) - (global.get $global$3) - ) - ) - (func $assembly/index/Jupiter (; 11 ;) (type $4) (result i32) - (call $assembly/index/Body#constructor - (i32.const 0) - (f64.const 4.841431442464721) - (f64.const -1.1603200440274284) - (f64.const -0.10362204447112311) - (f64.mul - (f64.const 0.001660076642744037) - (global.get $global$4) - ) - (f64.mul - (f64.const 0.007699011184197404) - (global.get $global$4) - ) - (f64.mul - (f64.const -6.90460016972063e-05) - (global.get $global$4) - ) - (f64.mul - (f64.const 9.547919384243266e-04) - (global.get $global$3) - ) - ) - ) - (func $assembly/index/Saturn (; 12 ;) (type $4) (result i32) - (call $assembly/index/Body#constructor - (i32.const 0) - (f64.const 8.34336671824458) - (f64.const 4.124798564124305) - (f64.const -0.4035234171143214) - (f64.mul - (f64.const -0.002767425107268624) - (global.get $global$4) - ) - (f64.mul - (f64.const 0.004998528012349172) - (global.get $global$4) - ) - (f64.mul - (f64.const 2.3041729757376393e-05) - (global.get $global$4) - ) - (f64.mul - (f64.const 2.858859806661308e-04) - (global.get $global$3) - ) - ) - ) - (func $assembly/index/Uranus (; 13 ;) (type $4) (result i32) - (call $assembly/index/Body#constructor - (i32.const 0) - (f64.const 12.894369562139131) - (f64.const -15.111151401698631) - (f64.const -0.22330757889265573) - (f64.mul - (f64.const 0.002964601375647616) - (global.get $global$4) - ) - (f64.mul - (f64.const 2.3784717395948095e-03) - (global.get $global$4) - ) - (f64.mul - (f64.const -2.9658956854023756e-05) - (global.get $global$4) - ) - (f64.mul - (f64.const 4.366244043351563e-05) - (global.get $global$3) - ) - ) - ) - (func $assembly/index/Neptune (; 14 ;) (type $4) (result i32) - (call $assembly/index/Body#constructor - (i32.const 0) - (f64.const 15.379697114850917) - (f64.const -25.919314609987964) - (f64.const 0.17925877295037118) - (f64.mul - (f64.const 2.6806777249038932e-03) - (global.get $global$4) - ) - (f64.mul - (f64.const 0.001628241700382423) - (global.get $global$4) - ) - (f64.mul - (f64.const -9.515922545197159e-05) - (global.get $global$4) - ) - (f64.mul - (f64.const 5.1513890204661145e-05) - (global.get $global$3) - ) - ) - ) - (func $~lib/internal/arraybuffer/computeSize (; 15 ;) (type $3) (param $0 i32) (result i32) - (i32.shl - (i32.const 1) - (i32.sub - (i32.const 32) - (i32.clz - (i32.sub - (i32.add - (local.get $0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocateUnsafe (; 16 ;) (type $3) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (if - (i32.eqz - (i32.le_u - (local.get $0) - (i32.const 1073741816) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 40) - (i32.const 26) - (i32.const 2) - ) - (unreachable) - ) - ) - (local.set $1 - (block $label$2 (result i32) - (local.set $2 - (call $~lib/internal/arraybuffer/computeSize - (local.get $0) - ) - ) - (br $label$2 - (call $~lib/allocator/arena/__memory_allocate - (local.get $2) - ) - ) - ) - ) - (i32.store - (local.get $1) - (local.get $0) - ) - (local.get $1) - ) - (func $~lib/internal/memory/memset (; 17 ;) (type $7) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i64) - (if - (i32.eqz - (local.get $2) - ) - (return) - ) - (i32.store8 - (local.get $0) - (local.get $1) - ) - (i32.store8 - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 1) - ) - (local.get $1) - ) - (if - (i32.le_u - (local.get $2) - (i32.const 2) - ) - (return) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 1) - ) - (local.get $1) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 2) - ) - (local.get $1) - ) - (i32.store8 - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 2) - ) - (local.get $1) - ) - (i32.store8 - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 3) - ) - (local.get $1) - ) - (if - (i32.le_u - (local.get $2) - (i32.const 6) - ) - (return) - ) - (i32.store8 - (i32.add - (local.get $0) - (i32.const 3) - ) - (local.get $1) - ) - (i32.store8 - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 4) - ) - (local.get $1) - ) - (if - (i32.le_u - (local.get $2) - (i32.const 8) - ) - (return) - ) - (local.set $3 - (i32.and - (i32.sub - (i32.const 0) - (local.get $0) - ) - (i32.const 3) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (local.get $3) - ) - ) - (local.set $2 - (i32.sub - (local.get $2) - (local.get $3) - ) - ) - (local.set $2 - (i32.and - (local.get $2) - (i32.const -4) - ) - ) - (local.set $4 - (i32.mul - (i32.div_u - (i32.const -1) - (i32.const 255) - ) - (i32.and - (local.get $1) - (i32.const 255) - ) - ) - ) - (i32.store - (local.get $0) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 4) - ) - (local.get $4) - ) - (if - (i32.le_u - (local.get $2) - (i32.const 8) - ) - (return) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 4) - ) - (local.get $4) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 8) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 12) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 8) - ) - (local.get $4) - ) - (if - (i32.le_u - (local.get $2) - (i32.const 24) - ) - (return) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 12) - ) - (local.get $4) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 16) - ) - (local.get $4) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 20) - ) - (local.get $4) - ) - (i32.store - (i32.add - (local.get $0) - (i32.const 24) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 28) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 24) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 20) - ) - (local.get $4) - ) - (i32.store - (i32.sub - (i32.add - (local.get $0) - (local.get $2) - ) - (i32.const 16) - ) - (local.get $4) - ) - (local.set $3 - (i32.add - (i32.const 24) - (i32.and - (local.get $0) - (i32.const 4) - ) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (local.get $3) - ) - ) - (local.set $2 - (i32.sub - (local.get $2) - (local.get $3) - ) - ) - (local.set $5 - (i64.or - (i64.extend_i32_u - (local.get $4) - ) - (i64.shl - (i64.extend_i32_u - (local.get $4) - ) - (i64.const 32) - ) - ) - ) - (block $label$7 - (loop $label$8 - (if - (i32.ge_u - (local.get $2) - (i32.const 32) - ) - (block - (block $label$10 - (i64.store - (local.get $0) - (local.get $5) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 8) - ) - (local.get $5) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 16) - ) - (local.get $5) - ) - (i64.store - (i32.add - (local.get $0) - (i32.const 24) - ) - (local.get $5) - ) - (local.set $2 - (i32.sub - (local.get $2) - (i32.const 32) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 32) - ) - ) - ) - (br $label$8) - ) - ) - ) - ) - ) - (func $~lib/array/Array<Body>#constructor (; 18 ;) (type $1) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (if - (i32.gt_u - (local.get $1) - (i32.const 268435454) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 45) - (i32.const 39) - ) - (unreachable) - ) - ) - (local.set $2 - (i32.shl - (local.get $1) - (i32.const 2) - ) - ) - (local.set $3 - (call $~lib/internal/arraybuffer/allocateUnsafe - (local.get $2) - ) - ) - (i32.store - (block $label$2 (result i32) - (if - (i32.eqz - (local.get $0) - ) - (local.set $0 - (call $~lib/memory/memory.allocate - (i32.const 8) - ) - ) - ) - (i32.store - (local.get $0) - (i32.const 0) - ) - (i32.store offset=4 - (local.get $0) - (i32.const 0) - ) - (local.get $0) - ) - (local.get $3) - ) - (i32.store offset=4 - (local.get $0) - (local.get $1) - ) - (block $label$4 - (local.set $4 - (i32.add - (local.get $3) - (i32.const 8) - ) - ) - (local.set $5 - (i32.const 0) - ) - (local.set $6 - (local.get $2) - ) - (call $~lib/internal/memory/memset - (local.get $4) - (local.get $5) - (local.get $6) - ) - ) - (local.get $0) - ) - (func $~lib/array/Array<Body>#__unchecked_set (; 19 ;) (type $7) (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local.set $3 - (i32.load - (local.get $0) - ) - ) - (local.set $4 - (local.get $1) - ) - (local.set $5 - (local.get $2) - ) - (local.set $6 - (i32.const 0) - ) - (i32.store offset=8 - (i32.add - (i32.add - (local.get $3) - (i32.shl - (local.get $4) - (i32.const 2) - ) - ) - (local.get $6) - ) - (local.get $5) - ) - ) - (func $assembly/index/init (; 20 ;) (type $0) - (local $0 i32) - (global.set $global$5 - (call $assembly/index/NBodySystem#constructor - (i32.const 0) - (block $label$1 (result i32) - (local.set $0 - (call $~lib/array/Array<Body>#constructor - (i32.const 0) - (i32.const 5) - ) - ) - (call $~lib/array/Array<Body>#__unchecked_set - (local.get $0) - (i32.const 0) - (call $assembly/index/Sun) - ) - (call $~lib/array/Array<Body>#__unchecked_set - (local.get $0) - (i32.const 1) - (call $assembly/index/Jupiter) - ) - (call $~lib/array/Array<Body>#__unchecked_set - (local.get $0) - (i32.const 2) - (call $assembly/index/Saturn) - ) - (call $~lib/array/Array<Body>#__unchecked_set - (local.get $0) - (i32.const 3) - (call $assembly/index/Uranus) - ) - (call $~lib/array/Array<Body>#__unchecked_set - (local.get $0) - (i32.const 4) - (call $assembly/index/Neptune) - ) - (local.get $0) - ) - ) - ) - ) - (func $assembly/index/NBodySystem#advance (; 21 ;) (type $9) (param $0 i32) (param $1 f64) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 f64) - (local $9 f64) - (local $10 f64) - (local $11 f64) - (local $12 f64) - (local $13 f64) - (local $14 f64) - (local $15 f64) - (local $16 f64) - (local $17 f64) - (local $18 f64) - (local $19 f64) - (local $20 f64) - (local $21 f64) - (local $22 f64) - (local.set $2 - (i32.load - (local.get $0) - ) - ) - (local.set $4 - (block $label$1 (result i32) - (local.set $3 - (local.get $2) - ) - (i32.load offset=4 - (local.get $3) - ) - ) - ) - (block $label$2 - (local.set $3 - (i32.const 0) - ) - (loop $label$3 - (br_if $label$2 - (i32.eqz - (i32.lt_u - (local.get $3) - (local.get $4) - ) - ) - ) - (block $label$4 - (local.set $5 - (call $~lib/array/Array<Body>#__unchecked_get - (local.get $2) - (local.get $3) - ) - ) - (local.set $8 - (f64.load - (local.get $5) - ) - ) - (local.set $9 - (f64.load offset=8 - (local.get $5) - ) - ) - (local.set $10 - (f64.load offset=16 - (local.get $5) - ) - ) - (local.set $11 - (f64.load offset=24 - (local.get $5) - ) - ) - (local.set $12 - (f64.load offset=32 - (local.get $5) - ) - ) - (local.set $13 - (f64.load offset=40 - (local.get $5) - ) - ) - (local.set $14 - (f64.load offset=48 - (local.get $5) - ) - ) - (block $label$5 - (local.set $6 - (i32.add - (local.get $3) - (i32.const 1) - ) - ) - (loop $label$6 - (br_if $label$5 - (i32.eqz - (i32.lt_u - (local.get $6) - (local.get $4) - ) - ) - ) - (block $label$7 - (local.set $7 - (call $~lib/array/Array<Body>#__unchecked_get - (local.get $2) - (local.get $6) - ) - ) - (local.set $15 - (f64.sub - (local.get $8) - (f64.load - (local.get $7) - ) - ) - ) - (local.set $16 - (f64.sub - (local.get $9) - (f64.load offset=8 - (local.get $7) - ) - ) - ) - (local.set $17 - (f64.sub - (local.get $10) - (f64.load offset=16 - (local.get $7) - ) - ) - ) - (local.set $18 - (f64.add - (f64.add - (f64.mul - (local.get $15) - (local.get $15) - ) - (f64.mul - (local.get $16) - (local.get $16) - ) - ) - (f64.mul - (local.get $17) - (local.get $17) - ) - ) - ) - (local.set $19 - (block $label$8 (result f64) - (local.set $19 - (local.get $18) - ) - (f64.sqrt - (local.get $19) - ) - ) - ) - (local.set $20 - (f64.div - (local.get $1) - (f64.mul - (local.get $18) - (local.get $19) - ) - ) - ) - (local.set $21 - (f64.mul - (local.get $14) - (local.get $20) - ) - ) - (local.set $22 - (f64.mul - (f64.load offset=48 - (local.get $7) - ) - (local.get $20) - ) - ) - (local.set $11 - (f64.sub - (local.get $11) - (f64.mul - (local.get $15) - (local.get $22) - ) - ) - ) - (local.set $12 - (f64.sub - (local.get $12) - (f64.mul - (local.get $16) - (local.get $22) - ) - ) - ) - (local.set $13 - (f64.sub - (local.get $13) - (f64.mul - (local.get $17) - (local.get $22) - ) - ) - ) - (f64.store offset=24 - (local.get $7) - (f64.add - (f64.load offset=24 - (local.get $7) - ) - (f64.mul - (local.get $15) - (local.get $21) - ) - ) - ) - (f64.store offset=32 - (local.get $7) - (f64.add - (f64.load offset=32 - (local.get $7) - ) - (f64.mul - (local.get $16) - (local.get $21) - ) - ) - ) - (f64.store offset=40 - (local.get $7) - (f64.add - (f64.load offset=40 - (local.get $7) - ) - (f64.mul - (local.get $17) - (local.get $21) - ) - ) - ) - ) - (local.set $6 - (i32.add - (local.get $6) - (i32.const 1) - ) - ) - (br $label$6) - ) - ) - (f64.store offset=24 - (local.get $5) - (local.get $11) - ) - (f64.store offset=32 - (local.get $5) - (local.get $12) - ) - (f64.store offset=40 - (local.get $5) - (local.get $13) - ) - (f64.store - (local.get $5) - (f64.add - (f64.load - (local.get $5) - ) - (f64.mul - (local.get $1) - (local.get $11) - ) - ) - ) - (f64.store offset=8 - (local.get $5) - (f64.add - (f64.load offset=8 - (local.get $5) - ) - (f64.mul - (local.get $1) - (local.get $12) - ) - ) - ) - (f64.store offset=16 - (local.get $5) - (f64.add - (f64.load offset=16 - (local.get $5) - ) - (f64.mul - (local.get $1) - (local.get $13) - ) - ) - ) - ) - (local.set $3 - (i32.add - (local.get $3) - (i32.const 1) - ) - ) - (br $label$3) - ) - ) - ) - (func $assembly/index/NBodySystem#energy (; 22 ;) (type $10) (param $0 i32) (result f64) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 f64) - (local $8 f64) - (local $9 f64) - (local $10 f64) - (local $11 f64) - (local $12 f64) - (local $13 f64) - (local $14 f64) - (local $15 f64) - (local $16 f64) - (local $17 f64) - (local $18 f64) - (local.set $7 - (f64.const 0) - ) - (local.set $1 - (i32.load - (local.get $0) - ) - ) - (block $label$1 - (block $label$2 - (local.set $2 - (i32.const 0) - ) - (local.set $3 - (block $label$3 (result i32) - (local.set $3 - (local.get $1) - ) - (i32.load offset=4 - (local.get $3) - ) - ) - ) - ) - (loop $label$4 - (br_if $label$1 - (i32.eqz - (i32.lt_u - (local.get $2) - (local.get $3) - ) - ) - ) - (block $label$5 - (local.set $4 - (call $~lib/array/Array<Body>#__unchecked_get - (local.get $1) - (local.get $2) - ) - ) - (local.set $8 - (f64.load - (local.get $4) - ) - ) - (local.set $9 - (f64.load offset=8 - (local.get $4) - ) - ) - (local.set $10 - (f64.load offset=16 - (local.get $4) - ) - ) - (local.set $11 - (f64.load offset=24 - (local.get $4) - ) - ) - (local.set $12 - (f64.load offset=32 - (local.get $4) - ) - ) - (local.set $13 - (f64.load offset=40 - (local.get $4) - ) - ) - (local.set $14 - (f64.load offset=48 - (local.get $4) - ) - ) - (local.set $7 - (f64.add - (local.get $7) - (f64.mul - (f64.mul - (f64.const 0.5) - (local.get $14) - ) - (f64.add - (f64.add - (f64.mul - (local.get $11) - (local.get $11) - ) - (f64.mul - (local.get $12) - (local.get $12) - ) - ) - (f64.mul - (local.get $13) - (local.get $13) - ) - ) - ) - ) - ) - (block $label$6 - (local.set $5 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (loop $label$7 - (br_if $label$6 - (i32.eqz - (i32.lt_u - (local.get $5) - (local.get $3) - ) - ) - ) - (block $label$8 - (local.set $6 - (call $~lib/array/Array<Body>#__unchecked_get - (local.get $1) - (local.get $5) - ) - ) - (local.set $15 - (f64.sub - (local.get $8) - (f64.load - (local.get $6) - ) - ) - ) - (local.set $16 - (f64.sub - (local.get $9) - (f64.load offset=8 - (local.get $6) - ) - ) - ) - (local.set $17 - (f64.sub - (local.get $10) - (f64.load offset=16 - (local.get $6) - ) - ) - ) - (local.set $18 - (block $label$9 (result f64) - (local.set $18 - (f64.add - (f64.add - (f64.mul - (local.get $15) - (local.get $15) - ) - (f64.mul - (local.get $16) - (local.get $16) - ) - ) - (f64.mul - (local.get $17) - (local.get $17) - ) - ) - ) - (f64.sqrt - (local.get $18) - ) - ) - ) - (local.set $7 - (f64.sub - (local.get $7) - (f64.div - (f64.mul - (local.get $14) - (f64.load offset=48 - (local.get $6) - ) - ) - (local.get $18) - ) - ) - ) - ) - (local.set $5 - (i32.add - (local.get $5) - (i32.const 1) - ) - ) - (br $label$7) - ) - ) - ) - (local.set $2 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (br $label$4) - ) - ) - (local.get $7) - ) - (func $assembly/index/step (; 23 ;) (type $8) (result f64) - (call $assembly/index/NBodySystem#advance - (global.get $global$5) - (f64.const 0.01) - ) - (call $assembly/index/NBodySystem#energy - (global.get $global$5) - ) - ) - (func $assembly/index/bench (; 24 ;) (type $11) (param $0 i32) - (local $1 i32) - (block $label$1 - (local.set $1 - (i32.const 0) - ) - (loop $label$2 - (br_if $label$1 - (i32.eqz - (i32.lt_u - (local.get $1) - (local.get $0) - ) - ) - ) - (call $assembly/index/NBodySystem#advance - (global.get $global$5) - (f64.const 0.01) - ) - (local.set $1 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (br $label$2) - ) - ) - ) - (func $assembly/index/getBody (; 25 ;) (type $3) (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - (local.set $1 - (i32.load - (global.get $global$5) - ) - ) - (if (result i32) - (i32.lt_u - (local.get $0) - (block $label$1 (result i32) - (local.set $2 - (local.get $1) - ) - (i32.load offset=4 - (local.get $2) - ) - ) - ) - (call $~lib/array/Array<Body>#__get - (local.get $1) - (local.get $0) - ) - (i32.const 0) - ) - ) - (func $start (; 26 ;) (type $0) - (call $start:assembly/index) - ) - (func $null (; 27 ;) (type $0) - ) -) - diff --git a/test/passes/O_all-features.txt b/test/passes/O_all-features.txt deleted file mode 100644 index 00b88ad32..000000000 --- a/test/passes/O_all-features.txt +++ /dev/null @@ -1,12 +0,0 @@ -(module - (type $struct.A (struct (field i32))) - (type $ref?|$struct.A|_=>_none (func (param (ref null $struct.A)))) - (export "foo" (func $0)) - (func $0 (; has Stack IR ;) (param $0 (ref null $struct.A)) - (drop - (struct.get $struct.A 0 - (local.get $0) - ) - ) - ) -) diff --git a/test/passes/O_all-features.wast b/test/passes/O_all-features.wast deleted file mode 100644 index a8723b523..000000000 --- a/test/passes/O_all-features.wast +++ /dev/null @@ -1,16 +0,0 @@ -;; Test that we can run GC types through the optimizer -(module - (type $struct.A (struct i32)) - - (func "foo" (param $x (ref null $struct.A)) - ;; get a struct reference - (drop - (local.get $x) - ) - ;; get a struct field value - ;; (note that since this is a nullable reference, it may trap) - (drop - (struct.get $struct.A 0 (local.get $x)) - ) - ) -) diff --git a/test/passes/O_all-features_ignore-implicit-traps.txt b/test/passes/O_all-features_ignore-implicit-traps.txt deleted file mode 100644 index 785662bca..000000000 --- a/test/passes/O_all-features_ignore-implicit-traps.txt +++ /dev/null @@ -1,8 +0,0 @@ -(module - (type $ref?|$struct.A|_=>_none (func (param (ref null $struct.A)))) - (type $struct.A (struct (field i32))) - (export "foo" (func $0)) - (func $0 (; has Stack IR ;) (param $0 (ref null $struct.A)) - (nop) - ) -) diff --git a/test/passes/O_all-features_ignore-implicit-traps.wast b/test/passes/O_all-features_ignore-implicit-traps.wast deleted file mode 100644 index 028a1d691..000000000 --- a/test/passes/O_all-features_ignore-implicit-traps.wast +++ /dev/null @@ -1,17 +0,0 @@ -;; Test that we can run GC types through the optimizer -(module - (type $struct.A (struct i32)) - - (func "foo" (param $x (ref null $struct.A)) - ;; get a struct reference - (drop - (local.get $x) - ) - ;; get a struct field value - ;; (note that since this is a nullable reference, it may trap, but we - ;; are ignoring implicit traps, so it has no side effects) - (drop - (struct.get $struct.A 0 (local.get $x)) - ) - ) -) diff --git a/test/passes/O_fast-math.txt b/test/passes/O_fast-math.txt deleted file mode 100644 index c6ae6ec16..000000000 --- a/test/passes/O_fast-math.txt +++ /dev/null @@ -1,47 +0,0 @@ -(module - (type $none_=>_f32 (func (result f32))) - (type $f32_=>_f32 (func (param f32) (result f32))) - (type $f64_=>_f64 (func (param f64) (result f64))) - (export "div" (func $0)) - (export "mul1" (func $1)) - (export "mul2" (func $2)) - (export "add1" (func $1)) - (export "add2" (func $2)) - (export "add3" (func $2)) - (export "add4" (func $2)) - (export "sub1" (func $1)) - (export "sub2" (func $2)) - (export "mul_neg_one1" (func $9)) - (export "mul_neg_one2" (func $10)) - (export "abs_sub_zero1" (func $11)) - (export "abs_sub_zero2" (func $12)) - (func $0 (; has Stack IR ;) (result f32) - (f32.const -nan:0x23017a) - ) - (func $1 (; has Stack IR ;) (result f32) - (f32.const -nan:0x34546d) - ) - (func $2 (; has Stack IR ;) (result f32) - (f32.const nan:0x400000) - ) - (func $9 (; has Stack IR ;) (param $0 f32) (result f32) - (f32.neg - (local.get $0) - ) - ) - (func $10 (; has Stack IR ;) (param $0 f64) (result f64) - (f64.neg - (local.get $0) - ) - ) - (func $11 (; has Stack IR ;) (param $0 f32) (result f32) - (f32.abs - (local.get $0) - ) - ) - (func $12 (; has Stack IR ;) (param $0 f64) (result f64) - (f64.abs - (local.get $0) - ) - ) -) diff --git a/test/passes/O_fast-math.wast b/test/passes/O_fast-math.wast deleted file mode 100644 index 68cf2bcd8..000000000 --- a/test/passes/O_fast-math.wast +++ /dev/null @@ -1,87 +0,0 @@ -;; with fast-math we can optimize some of these patterns -(module - (func "div" (result f32) - (f32.div - (f32.const -nan:0x23017a) - (f32.const 1) - ) - ) - (func "mul1" (result f32) - (f32.mul - (f32.const -nan:0x34546d) - (f32.const 1) - ) - ) - (func "mul2" (result f32) - (f32.mul - (f32.const 1) - (f32.const -nan:0x34546d) - ) - ) - (func "add1" (result f32) - (f32.add - (f32.const -nan:0x34546d) - (f32.const -0) - ) - ) - (func "add2" (result f32) - (f32.add - (f32.const -0) - (f32.const -nan:0x34546d) - ) - ) - (func "add3" (result f32) - (f32.add - (f32.const -nan:0x34546d) - (f32.const 0) - ) - ) - (func "add4" (result f32) - (f32.add - (f32.const 0) - (f32.const -nan:0x34546d) - ) - ) - (func "sub1" (result f32) - (f32.sub - (f32.const -nan:0x34546d) - (f32.const 0) - ) - ) - (func "sub2" (result f32) - (f32.sub - (f32.const -nan:0x34546d) - (f32.const -0) - ) - ) - (func "mul_neg_one1" (param $x f32) (result f32) - (f32.mul - (local.get $x) - (f32.const -1) - ) - ) - (func "mul_neg_one2" (param $x f64) (result f64) - (f64.mul - (local.get $x) - (f64.const -1) - ) - ) - (func "abs_sub_zero1" (param $x f32) (result f32) - ;; abs(0 - x) ==> abs(x) - (f32.abs - (f32.sub - (f32.const 0) - (local.get $x) - ) - ) - ) - (func "abs_sub_zero2" (param $x f64) (result f64) - ;; abs(0 - x) ==> abs(x) - (f64.abs - (f64.sub - (f64.const 0) - (local.get $x) - ) - ) - ) -) diff --git a/test/passes/Oz.txt b/test/passes/Oz.txt deleted file mode 100644 index e46331c21..000000000 --- a/test/passes/Oz.txt +++ /dev/null @@ -1,50 +0,0 @@ -(module - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_i32_=>_i32 (func (param i32 i32 i32 i32) (result i32))) - (memory $0 100 100) - (export "localcse" (func $basics)) - (export "localcse-2" (func $8)) - (func $basics (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) - (i32.add - (i32.add - (local.get $0) - (local.get $1) - ) - (i32.add - (local.get $0) - (local.get $1) - ) - ) - ) - (func $8 (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (i32.store - (local.tee $0 - (i32.add - (local.get $1) - (i32.const 4) - ) - ) - (i32.and - (i32.load - (local.get $0) - ) - (i32.const -75) - ) - ) - (i32.store - (local.tee $0 - (i32.add - (local.get $1) - (i32.const 4) - ) - ) - (i32.or - (i32.load - (local.get $0) - ) - (i32.const 8) - ) - ) - (i32.const 0) - ) -) diff --git a/test/passes/Oz.wast b/test/passes/Oz.wast deleted file mode 100644 index 17dbf834f..000000000 --- a/test/passes/Oz.wast +++ /dev/null @@ -1,59 +0,0 @@ -(module - (memory 100 100) - (func $basics (export "localcse") (param $x i32) ($param $y i32) (result i32) ;; -O3 does localcse - (local $x2 i32) - (local $y2 i32) - (local.set $x2 - (i32.add (local.get $x) (local.get $y)) - ) - (local.set $y2 - (i32.add (local.get $x) (local.get $y)) - ) - (i32.add (local.get $x2) (local.get $y2)) - ) - (func $8 (export "localcse-2") (param $var$0 i32) - (param $var$1 i32) - (param $var$2 i32) - (param $var$3 i32) - (result i32) - (block $label$0 (result i32) - (i32.store - (local.tee $var$2 - (i32.add - (local.get $var$1) - (i32.const 4) - ) - ) - (i32.and - (i32.load - (local.get $var$2) - ) - (i32.xor - (local.tee $var$2 - (i32.const 74) - ) - (i32.const -1) - ) - ) - ) - (i32.store - (local.tee $var$1 - (i32.add - (local.get $var$1) - (i32.const 4) - ) - ) - (i32.or - (i32.load - (local.get $var$1) - ) - (i32.and - (local.get $var$2) - (i32.const 8) - ) - ) - ) - (i32.const 0) - ) - ) -) |