summaryrefslogtreecommitdiff
path: root/test/interp/brtable.txt
blob: 85d8c4409d57d8bf8ad78421132cbe254e0b9c22 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
;;; TOOL: run-interp
(module
  (func $f (param i32) (result i32)
    block $default
      block $2
        block $1
          block $0
            local.get 0
            br_table $0 $1 $2 $default
          end
          ;; 0
          i32.const 0
          return
        end
        ;; 1
        i32.const 1
        return 
       end
      end
      ;; 2, fallthrough
      
    ;; default
    i32.const 2
    return)

  (func (export "test0") (result i32)
    i32.const 0 
    call $f)
  (func (export "test1") (result i32) 
    i32.const 1
    call $f)
  (func (export "test2") (result i32)
    i32.const 2 
    call $f)
  (func (export "test3") (result i32)
    i32.const 3
    call $f))
(;; STDOUT ;;;
test0() => i32:0
test1() => i32:1
test2() => i32:2
test3() => i32:2
;;; STDOUT ;;)