summaryrefslogtreecommitdiff
path: root/test/interp/loop.txt
blob: 3a7c0e03e842dbae40501436d7e40c2cbd897ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;;; TOOL: run-interp
(module
  (func (export "loop") (result i32)
    (local i32 i32)
    ;; loop statements now require an explicit branch to the top
    loop $cont
      local.get 1
      local.get 0
      i32.add
      local.set 1
      local.get 0
      i32.const 1
      i32.add 
      local.set 0
      local.get 0
      i32.const 5
      i32.lt_s
      if
        br $cont
      end
    end
    local.get 1))
(;; STDOUT ;;;
loop() => i32:10
;;; STDOUT ;;)