wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v1/testdata/i32.wast (about)

     1  ;; i32 operations
     2  
     3  (module
     4    (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (local.get $x) (local.get $y)))
     5    (func (export "sub") (param $x i32) (param $y i32) (result i32) (i32.sub (local.get $x) (local.get $y)))
     6    (func (export "mul") (param $x i32) (param $y i32) (result i32) (i32.mul (local.get $x) (local.get $y)))
     7    (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (local.get $x) (local.get $y)))
     8    (func (export "div_u") (param $x i32) (param $y i32) (result i32) (i32.div_u (local.get $x) (local.get $y)))
     9    (func (export "rem_s") (param $x i32) (param $y i32) (result i32) (i32.rem_s (local.get $x) (local.get $y)))
    10    (func (export "rem_u") (param $x i32) (param $y i32) (result i32) (i32.rem_u (local.get $x) (local.get $y)))
    11    (func (export "and") (param $x i32) (param $y i32) (result i32) (i32.and (local.get $x) (local.get $y)))
    12    (func (export "or") (param $x i32) (param $y i32) (result i32) (i32.or (local.get $x) (local.get $y)))
    13    (func (export "xor") (param $x i32) (param $y i32) (result i32) (i32.xor (local.get $x) (local.get $y)))
    14    (func (export "shl") (param $x i32) (param $y i32) (result i32) (i32.shl (local.get $x) (local.get $y)))
    15    (func (export "shr_s") (param $x i32) (param $y i32) (result i32) (i32.shr_s (local.get $x) (local.get $y)))
    16    (func (export "shr_u") (param $x i32) (param $y i32) (result i32) (i32.shr_u (local.get $x) (local.get $y)))
    17    (func (export "rotl") (param $x i32) (param $y i32) (result i32) (i32.rotl (local.get $x) (local.get $y)))
    18    (func (export "rotr") (param $x i32) (param $y i32) (result i32) (i32.rotr (local.get $x) (local.get $y)))
    19    (func (export "clz") (param $x i32) (result i32) (i32.clz (local.get $x)))
    20    (func (export "ctz") (param $x i32) (result i32) (i32.ctz (local.get $x)))
    21    (func (export "popcnt") (param $x i32) (result i32) (i32.popcnt (local.get $x)))
    22    (func (export "eqz") (param $x i32) (result i32) (i32.eqz (local.get $x)))
    23    (func (export "eq") (param $x i32) (param $y i32) (result i32) (i32.eq (local.get $x) (local.get $y)))
    24    (func (export "ne") (param $x i32) (param $y i32) (result i32) (i32.ne (local.get $x) (local.get $y)))
    25    (func (export "lt_s") (param $x i32) (param $y i32) (result i32) (i32.lt_s (local.get $x) (local.get $y)))
    26    (func (export "lt_u") (param $x i32) (param $y i32) (result i32) (i32.lt_u (local.get $x) (local.get $y)))
    27    (func (export "le_s") (param $x i32) (param $y i32) (result i32) (i32.le_s (local.get $x) (local.get $y)))
    28    (func (export "le_u") (param $x i32) (param $y i32) (result i32) (i32.le_u (local.get $x) (local.get $y)))
    29    (func (export "gt_s") (param $x i32) (param $y i32) (result i32) (i32.gt_s (local.get $x) (local.get $y)))
    30    (func (export "gt_u") (param $x i32) (param $y i32) (result i32) (i32.gt_u (local.get $x) (local.get $y)))
    31    (func (export "ge_s") (param $x i32) (param $y i32) (result i32) (i32.ge_s (local.get $x) (local.get $y)))
    32    (func (export "ge_u") (param $x i32) (param $y i32) (result i32) (i32.ge_u (local.get $x) (local.get $y)))
    33  )
    34  
    35  (assert_return (invoke "add" (i32.const 1) (i32.const 1)) (i32.const 2))
    36  (assert_return (invoke "add" (i32.const 1) (i32.const 0)) (i32.const 1))
    37  (assert_return (invoke "add" (i32.const -1) (i32.const -1)) (i32.const -2))
    38  (assert_return (invoke "add" (i32.const -1) (i32.const 1)) (i32.const 0))
    39  (assert_return (invoke "add" (i32.const 0x7fffffff) (i32.const 1)) (i32.const 0x80000000))
    40  (assert_return (invoke "add" (i32.const 0x80000000) (i32.const -1)) (i32.const 0x7fffffff))
    41  (assert_return (invoke "add" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
    42  (assert_return (invoke "add" (i32.const 0x3fffffff) (i32.const 1)) (i32.const 0x40000000))
    43  
    44  (assert_return (invoke "sub" (i32.const 1) (i32.const 1)) (i32.const 0))
    45  (assert_return (invoke "sub" (i32.const 1) (i32.const 0)) (i32.const 1))
    46  (assert_return (invoke "sub" (i32.const -1) (i32.const -1)) (i32.const 0))
    47  (assert_return (invoke "sub" (i32.const 0x7fffffff) (i32.const -1)) (i32.const 0x80000000))
    48  (assert_return (invoke "sub" (i32.const 0x80000000) (i32.const 1)) (i32.const 0x7fffffff))
    49  (assert_return (invoke "sub" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
    50  (assert_return (invoke "sub" (i32.const 0x3fffffff) (i32.const -1)) (i32.const 0x40000000))
    51  
    52  (assert_return (invoke "mul" (i32.const 1) (i32.const 1)) (i32.const 1))
    53  (assert_return (invoke "mul" (i32.const 1) (i32.const 0)) (i32.const 0))
    54  (assert_return (invoke "mul" (i32.const -1) (i32.const -1)) (i32.const 1))
    55  (assert_return (invoke "mul" (i32.const 0x10000000) (i32.const 4096)) (i32.const 0))
    56  (assert_return (invoke "mul" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
    57  (assert_return (invoke "mul" (i32.const 0x80000000) (i32.const -1)) (i32.const 0x80000000))
    58  (assert_return (invoke "mul" (i32.const 0x7fffffff) (i32.const -1)) (i32.const 0x80000001))
    59  (assert_return (invoke "mul" (i32.const 0x01234567) (i32.const 0x76543210)) (i32.const 0x358e7470))
    60  (assert_return (invoke "mul" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
    61  
    62  (assert_trap (invoke "div_s" (i32.const 1) (i32.const 0)) "integer divide by zero")
    63  (assert_trap (invoke "div_s" (i32.const 0) (i32.const 0)) "integer divide by zero")
    64  (assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const -1)) "integer overflow")
    65  (assert_return (invoke "div_s" (i32.const 1) (i32.const 1)) (i32.const 1))
    66  (assert_return (invoke "div_s" (i32.const 0) (i32.const 1)) (i32.const 0))
    67  (assert_return (invoke "div_s" (i32.const 0) (i32.const -1)) (i32.const 0))
    68  (assert_return (invoke "div_s" (i32.const -1) (i32.const -1)) (i32.const 1))
    69  (assert_return (invoke "div_s" (i32.const 0x80000000) (i32.const 2)) (i32.const 0xc0000000))
    70  (assert_return (invoke "div_s" (i32.const 0x80000001) (i32.const 1000)) (i32.const 0xffdf3b65))
    71  (assert_return (invoke "div_s" (i32.const 5) (i32.const 2)) (i32.const 2))
    72  (assert_return (invoke "div_s" (i32.const -5) (i32.const 2)) (i32.const -2))
    73  (assert_return (invoke "div_s" (i32.const 5) (i32.const -2)) (i32.const -2))
    74  (assert_return (invoke "div_s" (i32.const -5) (i32.const -2)) (i32.const 2))
    75  (assert_return (invoke "div_s" (i32.const 7) (i32.const 3)) (i32.const 2))
    76  (assert_return (invoke "div_s" (i32.const -7) (i32.const 3)) (i32.const -2))
    77  (assert_return (invoke "div_s" (i32.const 7) (i32.const -3)) (i32.const -2))
    78  (assert_return (invoke "div_s" (i32.const -7) (i32.const -3)) (i32.const 2))
    79  (assert_return (invoke "div_s" (i32.const 11) (i32.const 5)) (i32.const 2))
    80  (assert_return (invoke "div_s" (i32.const 17) (i32.const 7)) (i32.const 2))
    81  
    82  (assert_trap (invoke "div_u" (i32.const 1) (i32.const 0)) "integer divide by zero")
    83  (assert_trap (invoke "div_u" (i32.const 0) (i32.const 0)) "integer divide by zero")
    84  (assert_return (invoke "div_u" (i32.const 1) (i32.const 1)) (i32.const 1))
    85  (assert_return (invoke "div_u" (i32.const 0) (i32.const 1)) (i32.const 0))
    86  (assert_return (invoke "div_u" (i32.const -1) (i32.const -1)) (i32.const 1))
    87  (assert_return (invoke "div_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
    88  (assert_return (invoke "div_u" (i32.const 0x80000000) (i32.const 2)) (i32.const 0x40000000))
    89  (assert_return (invoke "div_u" (i32.const 0x8ff00ff0) (i32.const 0x10001)) (i32.const 0x8fef))
    90  (assert_return (invoke "div_u" (i32.const 0x80000001) (i32.const 1000)) (i32.const 0x20c49b))
    91  (assert_return (invoke "div_u" (i32.const 5) (i32.const 2)) (i32.const 2))
    92  (assert_return (invoke "div_u" (i32.const -5) (i32.const 2)) (i32.const 0x7ffffffd))
    93  (assert_return (invoke "div_u" (i32.const 5) (i32.const -2)) (i32.const 0))
    94  (assert_return (invoke "div_u" (i32.const -5) (i32.const -2)) (i32.const 0))
    95  (assert_return (invoke "div_u" (i32.const 7) (i32.const 3)) (i32.const 2))
    96  (assert_return (invoke "div_u" (i32.const 11) (i32.const 5)) (i32.const 2))
    97  (assert_return (invoke "div_u" (i32.const 17) (i32.const 7)) (i32.const 2))
    98  
    99  (assert_trap (invoke "rem_s" (i32.const 1) (i32.const 0)) "integer divide by zero")
   100  (assert_trap (invoke "rem_s" (i32.const 0) (i32.const 0)) "integer divide by zero")
   101  (assert_return (invoke "rem_s" (i32.const 0x7fffffff) (i32.const -1)) (i32.const 0))
   102  (assert_return (invoke "rem_s" (i32.const 1) (i32.const 1)) (i32.const 0))
   103  (assert_return (invoke "rem_s" (i32.const 0) (i32.const 1)) (i32.const 0))
   104  (assert_return (invoke "rem_s" (i32.const 0) (i32.const -1)) (i32.const 0))
   105  (assert_return (invoke "rem_s" (i32.const -1) (i32.const -1)) (i32.const 0))
   106  (assert_return (invoke "rem_s" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   107  (assert_return (invoke "rem_s" (i32.const 0x80000000) (i32.const 2)) (i32.const 0))
   108  (assert_return (invoke "rem_s" (i32.const 0x80000001) (i32.const 1000)) (i32.const -647))
   109  (assert_return (invoke "rem_s" (i32.const 5) (i32.const 2)) (i32.const 1))
   110  (assert_return (invoke "rem_s" (i32.const -5) (i32.const 2)) (i32.const -1))
   111  (assert_return (invoke "rem_s" (i32.const 5) (i32.const -2)) (i32.const 1))
   112  (assert_return (invoke "rem_s" (i32.const -5) (i32.const -2)) (i32.const -1))
   113  (assert_return (invoke "rem_s" (i32.const 7) (i32.const 3)) (i32.const 1))
   114  (assert_return (invoke "rem_s" (i32.const -7) (i32.const 3)) (i32.const -1))
   115  (assert_return (invoke "rem_s" (i32.const 7) (i32.const -3)) (i32.const 1))
   116  (assert_return (invoke "rem_s" (i32.const -7) (i32.const -3)) (i32.const -1))
   117  (assert_return (invoke "rem_s" (i32.const 11) (i32.const 5)) (i32.const 1))
   118  (assert_return (invoke "rem_s" (i32.const 17) (i32.const 7)) (i32.const 3))
   119  
   120  (assert_trap (invoke "rem_u" (i32.const 1) (i32.const 0)) "integer divide by zero")
   121  (assert_trap (invoke "rem_u" (i32.const 0) (i32.const 0)) "integer divide by zero")
   122  (assert_return (invoke "rem_u" (i32.const 1) (i32.const 1)) (i32.const 0))
   123  (assert_return (invoke "rem_u" (i32.const 0) (i32.const 1)) (i32.const 0))
   124  (assert_return (invoke "rem_u" (i32.const -1) (i32.const -1)) (i32.const 0))
   125  (assert_return (invoke "rem_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 0x80000000))
   126  (assert_return (invoke "rem_u" (i32.const 0x80000000) (i32.const 2)) (i32.const 0))
   127  (assert_return (invoke "rem_u" (i32.const 0x8ff00ff0) (i32.const 0x10001)) (i32.const 0x8001))
   128  (assert_return (invoke "rem_u" (i32.const 0x80000001) (i32.const 1000)) (i32.const 649))
   129  (assert_return (invoke "rem_u" (i32.const 5) (i32.const 2)) (i32.const 1))
   130  (assert_return (invoke "rem_u" (i32.const -5) (i32.const 2)) (i32.const 1))
   131  (assert_return (invoke "rem_u" (i32.const 5) (i32.const -2)) (i32.const 5))
   132  (assert_return (invoke "rem_u" (i32.const -5) (i32.const -2)) (i32.const -5))
   133  (assert_return (invoke "rem_u" (i32.const 7) (i32.const 3)) (i32.const 1))
   134  (assert_return (invoke "rem_u" (i32.const 11) (i32.const 5)) (i32.const 1))
   135  (assert_return (invoke "rem_u" (i32.const 17) (i32.const 7)) (i32.const 3))
   136  
   137  (assert_return (invoke "and" (i32.const 1) (i32.const 0)) (i32.const 0))
   138  (assert_return (invoke "and" (i32.const 0) (i32.const 1)) (i32.const 0))
   139  (assert_return (invoke "and" (i32.const 1) (i32.const 1)) (i32.const 1))
   140  (assert_return (invoke "and" (i32.const 0) (i32.const 0)) (i32.const 0))
   141  (assert_return (invoke "and" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   142  (assert_return (invoke "and" (i32.const 0x7fffffff) (i32.const -1)) (i32.const 0x7fffffff))
   143  (assert_return (invoke "and" (i32.const 0xf0f0ffff) (i32.const 0xfffff0f0)) (i32.const 0xf0f0f0f0))
   144  (assert_return (invoke "and" (i32.const 0xffffffff) (i32.const 0xffffffff)) (i32.const 0xffffffff))
   145  
   146  (assert_return (invoke "or" (i32.const 1) (i32.const 0)) (i32.const 1))
   147  (assert_return (invoke "or" (i32.const 0) (i32.const 1)) (i32.const 1))
   148  (assert_return (invoke "or" (i32.const 1) (i32.const 1)) (i32.const 1))
   149  (assert_return (invoke "or" (i32.const 0) (i32.const 0)) (i32.const 0))
   150  (assert_return (invoke "or" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const -1))
   151  (assert_return (invoke "or" (i32.const 0x80000000) (i32.const 0)) (i32.const 0x80000000))
   152  (assert_return (invoke "or" (i32.const 0xf0f0ffff) (i32.const 0xfffff0f0)) (i32.const 0xffffffff))
   153  (assert_return (invoke "or" (i32.const 0xffffffff) (i32.const 0xffffffff)) (i32.const 0xffffffff))
   154  
   155  (assert_return (invoke "xor" (i32.const 1) (i32.const 0)) (i32.const 1))
   156  (assert_return (invoke "xor" (i32.const 0) (i32.const 1)) (i32.const 1))
   157  (assert_return (invoke "xor" (i32.const 1) (i32.const 1)) (i32.const 0))
   158  (assert_return (invoke "xor" (i32.const 0) (i32.const 0)) (i32.const 0))
   159  (assert_return (invoke "xor" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const -1))
   160  (assert_return (invoke "xor" (i32.const 0x80000000) (i32.const 0)) (i32.const 0x80000000))
   161  (assert_return (invoke "xor" (i32.const -1) (i32.const 0x80000000)) (i32.const 0x7fffffff))
   162  (assert_return (invoke "xor" (i32.const -1) (i32.const 0x7fffffff)) (i32.const 0x80000000))
   163  (assert_return (invoke "xor" (i32.const 0xf0f0ffff) (i32.const 0xfffff0f0)) (i32.const 0x0f0f0f0f))
   164  (assert_return (invoke "xor" (i32.const 0xffffffff) (i32.const 0xffffffff)) (i32.const 0))
   165  
   166  (assert_return (invoke "shl" (i32.const 1) (i32.const 1)) (i32.const 2))
   167  (assert_return (invoke "shl" (i32.const 1) (i32.const 0)) (i32.const 1))
   168  (assert_return (invoke "shl" (i32.const 0x7fffffff) (i32.const 1)) (i32.const 0xfffffffe))
   169  (assert_return (invoke "shl" (i32.const 0xffffffff) (i32.const 1)) (i32.const 0xfffffffe))
   170  (assert_return (invoke "shl" (i32.const 0x80000000) (i32.const 1)) (i32.const 0))
   171  (assert_return (invoke "shl" (i32.const 0x40000000) (i32.const 1)) (i32.const 0x80000000))
   172  (assert_return (invoke "shl" (i32.const 1) (i32.const 31)) (i32.const 0x80000000))
   173  (assert_return (invoke "shl" (i32.const 1) (i32.const 32)) (i32.const 1))
   174  (assert_return (invoke "shl" (i32.const 1) (i32.const 33)) (i32.const 2))
   175  (assert_return (invoke "shl" (i32.const 1) (i32.const -1)) (i32.const 0x80000000))
   176  (assert_return (invoke "shl" (i32.const 1) (i32.const 0x7fffffff)) (i32.const 0x80000000))
   177  
   178  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 1)) (i32.const 0))
   179  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 0)) (i32.const 1))
   180  (assert_return (invoke "shr_s" (i32.const -1) (i32.const 1)) (i32.const -1))
   181  (assert_return (invoke "shr_s" (i32.const 0x7fffffff) (i32.const 1)) (i32.const 0x3fffffff))
   182  (assert_return (invoke "shr_s" (i32.const 0x80000000) (i32.const 1)) (i32.const 0xc0000000))
   183  (assert_return (invoke "shr_s" (i32.const 0x40000000) (i32.const 1)) (i32.const 0x20000000))
   184  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 32)) (i32.const 1))
   185  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 33)) (i32.const 0))
   186  (assert_return (invoke "shr_s" (i32.const 1) (i32.const -1)) (i32.const 0))
   187  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 0x7fffffff)) (i32.const 0))
   188  (assert_return (invoke "shr_s" (i32.const 1) (i32.const 0x80000000)) (i32.const 1))
   189  (assert_return (invoke "shr_s" (i32.const 0x80000000) (i32.const 31)) (i32.const -1))
   190  (assert_return (invoke "shr_s" (i32.const -1) (i32.const 32)) (i32.const -1))
   191  (assert_return (invoke "shr_s" (i32.const -1) (i32.const 33)) (i32.const -1))
   192  (assert_return (invoke "shr_s" (i32.const -1) (i32.const -1)) (i32.const -1))
   193  (assert_return (invoke "shr_s" (i32.const -1) (i32.const 0x7fffffff)) (i32.const -1))
   194  (assert_return (invoke "shr_s" (i32.const -1) (i32.const 0x80000000)) (i32.const -1))
   195  
   196  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 1)) (i32.const 0))
   197  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 0)) (i32.const 1))
   198  (assert_return (invoke "shr_u" (i32.const -1) (i32.const 1)) (i32.const 0x7fffffff))
   199  (assert_return (invoke "shr_u" (i32.const 0x7fffffff) (i32.const 1)) (i32.const 0x3fffffff))
   200  (assert_return (invoke "shr_u" (i32.const 0x80000000) (i32.const 1)) (i32.const 0x40000000))
   201  (assert_return (invoke "shr_u" (i32.const 0x40000000) (i32.const 1)) (i32.const 0x20000000))
   202  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 32)) (i32.const 1))
   203  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 33)) (i32.const 0))
   204  (assert_return (invoke "shr_u" (i32.const 1) (i32.const -1)) (i32.const 0))
   205  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 0x7fffffff)) (i32.const 0))
   206  (assert_return (invoke "shr_u" (i32.const 1) (i32.const 0x80000000)) (i32.const 1))
   207  (assert_return (invoke "shr_u" (i32.const 0x80000000) (i32.const 31)) (i32.const 1))
   208  (assert_return (invoke "shr_u" (i32.const -1) (i32.const 32)) (i32.const -1))
   209  (assert_return (invoke "shr_u" (i32.const -1) (i32.const 33)) (i32.const 0x7fffffff))
   210  (assert_return (invoke "shr_u" (i32.const -1) (i32.const -1)) (i32.const 1))
   211  (assert_return (invoke "shr_u" (i32.const -1) (i32.const 0x7fffffff)) (i32.const 1))
   212  (assert_return (invoke "shr_u" (i32.const -1) (i32.const 0x80000000)) (i32.const -1))
   213  
   214  (assert_return (invoke "rotl" (i32.const 1) (i32.const 1)) (i32.const 2))
   215  (assert_return (invoke "rotl" (i32.const 1) (i32.const 0)) (i32.const 1))
   216  (assert_return (invoke "rotl" (i32.const -1) (i32.const 1)) (i32.const -1))
   217  (assert_return (invoke "rotl" (i32.const 1) (i32.const 32)) (i32.const 1))
   218  (assert_return (invoke "rotl" (i32.const 0xabcd9876) (i32.const 1)) (i32.const 0x579b30ed))
   219  (assert_return (invoke "rotl" (i32.const 0xfe00dc00) (i32.const 4)) (i32.const 0xe00dc00f))
   220  (assert_return (invoke "rotl" (i32.const 0xb0c1d2e3) (i32.const 5)) (i32.const 0x183a5c76))
   221  (assert_return (invoke "rotl" (i32.const 0x00008000) (i32.const 37)) (i32.const 0x00100000))
   222  (assert_return (invoke "rotl" (i32.const 0xb0c1d2e3) (i32.const 0xff05)) (i32.const 0x183a5c76))
   223  (assert_return (invoke "rotl" (i32.const 0x769abcdf) (i32.const 0xffffffed)) (i32.const 0x579beed3))
   224  (assert_return (invoke "rotl" (i32.const 0x769abcdf) (i32.const 0x8000000d)) (i32.const 0x579beed3))
   225  (assert_return (invoke "rotl" (i32.const 1) (i32.const 31)) (i32.const 0x80000000))
   226  (assert_return (invoke "rotl" (i32.const 0x80000000) (i32.const 1)) (i32.const 1))
   227  
   228  (assert_return (invoke "rotr" (i32.const 1) (i32.const 1)) (i32.const 0x80000000))
   229  (assert_return (invoke "rotr" (i32.const 1) (i32.const 0)) (i32.const 1))
   230  (assert_return (invoke "rotr" (i32.const -1) (i32.const 1)) (i32.const -1))
   231  (assert_return (invoke "rotr" (i32.const 1) (i32.const 32)) (i32.const 1))
   232  (assert_return (invoke "rotr" (i32.const 0xff00cc00) (i32.const 1)) (i32.const 0x7f806600))
   233  (assert_return (invoke "rotr" (i32.const 0x00080000) (i32.const 4)) (i32.const 0x00008000))
   234  (assert_return (invoke "rotr" (i32.const 0xb0c1d2e3) (i32.const 5)) (i32.const 0x1d860e97))
   235  (assert_return (invoke "rotr" (i32.const 0x00008000) (i32.const 37)) (i32.const 0x00000400))
   236  (assert_return (invoke "rotr" (i32.const 0xb0c1d2e3) (i32.const 0xff05)) (i32.const 0x1d860e97))
   237  (assert_return (invoke "rotr" (i32.const 0x769abcdf) (i32.const 0xffffffed)) (i32.const 0xe6fbb4d5))
   238  (assert_return (invoke "rotr" (i32.const 0x769abcdf) (i32.const 0x8000000d)) (i32.const 0xe6fbb4d5))
   239  (assert_return (invoke "rotr" (i32.const 1) (i32.const 31)) (i32.const 2))
   240  (assert_return (invoke "rotr" (i32.const 0x80000000) (i32.const 31)) (i32.const 1))
   241  
   242  (assert_return (invoke "clz" (i32.const 0xffffffff)) (i32.const 0))
   243  (assert_return (invoke "clz" (i32.const 0)) (i32.const 32))
   244  (assert_return (invoke "clz" (i32.const 0x00008000)) (i32.const 16))
   245  (assert_return (invoke "clz" (i32.const 0xff)) (i32.const 24))
   246  (assert_return (invoke "clz" (i32.const 0x80000000)) (i32.const 0))
   247  (assert_return (invoke "clz" (i32.const 1)) (i32.const 31))
   248  (assert_return (invoke "clz" (i32.const 2)) (i32.const 30))
   249  (assert_return (invoke "clz" (i32.const 0x7fffffff)) (i32.const 1))
   250  
   251  (assert_return (invoke "ctz" (i32.const -1)) (i32.const 0))
   252  (assert_return (invoke "ctz" (i32.const 0)) (i32.const 32))
   253  (assert_return (invoke "ctz" (i32.const 0x00008000)) (i32.const 15))
   254  (assert_return (invoke "ctz" (i32.const 0x00010000)) (i32.const 16))
   255  (assert_return (invoke "ctz" (i32.const 0x80000000)) (i32.const 31))
   256  (assert_return (invoke "ctz" (i32.const 0x7fffffff)) (i32.const 0))
   257  
   258  (assert_return (invoke "popcnt" (i32.const -1)) (i32.const 32))
   259  (assert_return (invoke "popcnt" (i32.const 0)) (i32.const 0))
   260  (assert_return (invoke "popcnt" (i32.const 0x00008000)) (i32.const 1))
   261  (assert_return (invoke "popcnt" (i32.const 0x80008000)) (i32.const 2))
   262  (assert_return (invoke "popcnt" (i32.const 0x7fffffff)) (i32.const 31))
   263  (assert_return (invoke "popcnt" (i32.const 0xAAAAAAAA)) (i32.const 16))
   264  (assert_return (invoke "popcnt" (i32.const 0x55555555)) (i32.const 16))
   265  (assert_return (invoke "popcnt" (i32.const 0xDEADBEEF)) (i32.const 24))
   266  
   267  (assert_return (invoke "eqz" (i32.const 0)) (i32.const 1))
   268  (assert_return (invoke "eqz" (i32.const 1)) (i32.const 0))
   269  (assert_return (invoke "eqz" (i32.const 0x80000000)) (i32.const 0))
   270  (assert_return (invoke "eqz" (i32.const 0x7fffffff)) (i32.const 0))
   271  (assert_return (invoke "eqz" (i32.const 0xffffffff)) (i32.const 0))
   272  
   273  (assert_return (invoke "eq" (i32.const 0) (i32.const 0)) (i32.const 1))
   274  (assert_return (invoke "eq" (i32.const 1) (i32.const 1)) (i32.const 1))
   275  (assert_return (invoke "eq" (i32.const -1) (i32.const 1)) (i32.const 0))
   276  (assert_return (invoke "eq" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 1))
   277  (assert_return (invoke "eq" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
   278  (assert_return (invoke "eq" (i32.const -1) (i32.const -1)) (i32.const 1))
   279  (assert_return (invoke "eq" (i32.const 1) (i32.const 0)) (i32.const 0))
   280  (assert_return (invoke "eq" (i32.const 0) (i32.const 1)) (i32.const 0))
   281  (assert_return (invoke "eq" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
   282  (assert_return (invoke "eq" (i32.const 0) (i32.const 0x80000000)) (i32.const 0))
   283  (assert_return (invoke "eq" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   284  (assert_return (invoke "eq" (i32.const -1) (i32.const 0x80000000)) (i32.const 0))
   285  (assert_return (invoke "eq" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 0))
   286  (assert_return (invoke "eq" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   287  
   288  (assert_return (invoke "ne" (i32.const 0) (i32.const 0)) (i32.const 0))
   289  (assert_return (invoke "ne" (i32.const 1) (i32.const 1)) (i32.const 0))
   290  (assert_return (invoke "ne" (i32.const -1) (i32.const 1)) (i32.const 1))
   291  (assert_return (invoke "ne" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
   292  (assert_return (invoke "ne" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 0))
   293  (assert_return (invoke "ne" (i32.const -1) (i32.const -1)) (i32.const 0))
   294  (assert_return (invoke "ne" (i32.const 1) (i32.const 0)) (i32.const 1))
   295  (assert_return (invoke "ne" (i32.const 0) (i32.const 1)) (i32.const 1))
   296  (assert_return (invoke "ne" (i32.const 0x80000000) (i32.const 0)) (i32.const 1))
   297  (assert_return (invoke "ne" (i32.const 0) (i32.const 0x80000000)) (i32.const 1))
   298  (assert_return (invoke "ne" (i32.const 0x80000000) (i32.const -1)) (i32.const 1))
   299  (assert_return (invoke "ne" (i32.const -1) (i32.const 0x80000000)) (i32.const 1))
   300  (assert_return (invoke "ne" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1))
   301  (assert_return (invoke "ne" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 1))
   302  
   303  (assert_return (invoke "lt_s" (i32.const 0) (i32.const 0)) (i32.const 0))
   304  (assert_return (invoke "lt_s" (i32.const 1) (i32.const 1)) (i32.const 0))
   305  (assert_return (invoke "lt_s" (i32.const -1) (i32.const 1)) (i32.const 1))
   306  (assert_return (invoke "lt_s" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
   307  (assert_return (invoke "lt_s" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 0))
   308  (assert_return (invoke "lt_s" (i32.const -1) (i32.const -1)) (i32.const 0))
   309  (assert_return (invoke "lt_s" (i32.const 1) (i32.const 0)) (i32.const 0))
   310  (assert_return (invoke "lt_s" (i32.const 0) (i32.const 1)) (i32.const 1))
   311  (assert_return (invoke "lt_s" (i32.const 0x80000000) (i32.const 0)) (i32.const 1))
   312  (assert_return (invoke "lt_s" (i32.const 0) (i32.const 0x80000000)) (i32.const 0))
   313  (assert_return (invoke "lt_s" (i32.const 0x80000000) (i32.const -1)) (i32.const 1))
   314  (assert_return (invoke "lt_s" (i32.const -1) (i32.const 0x80000000)) (i32.const 0))
   315  (assert_return (invoke "lt_s" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1))
   316  (assert_return (invoke "lt_s" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   317  
   318  (assert_return (invoke "lt_u" (i32.const 0) (i32.const 0)) (i32.const 0))
   319  (assert_return (invoke "lt_u" (i32.const 1) (i32.const 1)) (i32.const 0))
   320  (assert_return (invoke "lt_u" (i32.const -1) (i32.const 1)) (i32.const 0))
   321  (assert_return (invoke "lt_u" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
   322  (assert_return (invoke "lt_u" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 0))
   323  (assert_return (invoke "lt_u" (i32.const -1) (i32.const -1)) (i32.const 0))
   324  (assert_return (invoke "lt_u" (i32.const 1) (i32.const 0)) (i32.const 0))
   325  (assert_return (invoke "lt_u" (i32.const 0) (i32.const 1)) (i32.const 1))
   326  (assert_return (invoke "lt_u" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
   327  (assert_return (invoke "lt_u" (i32.const 0) (i32.const 0x80000000)) (i32.const 1))
   328  (assert_return (invoke "lt_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 1))
   329  (assert_return (invoke "lt_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 0))
   330  (assert_return (invoke "lt_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 0))
   331  (assert_return (invoke "lt_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 1))
   332  
   333  (assert_return (invoke "le_s" (i32.const 0) (i32.const 0)) (i32.const 1))
   334  (assert_return (invoke "le_s" (i32.const 1) (i32.const 1)) (i32.const 1))
   335  (assert_return (invoke "le_s" (i32.const -1) (i32.const 1)) (i32.const 1))
   336  (assert_return (invoke "le_s" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 1))
   337  (assert_return (invoke "le_s" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
   338  (assert_return (invoke "le_s" (i32.const -1) (i32.const -1)) (i32.const 1))
   339  (assert_return (invoke "le_s" (i32.const 1) (i32.const 0)) (i32.const 0))
   340  (assert_return (invoke "le_s" (i32.const 0) (i32.const 1)) (i32.const 1))
   341  (assert_return (invoke "le_s" (i32.const 0x80000000) (i32.const 0)) (i32.const 1))
   342  (assert_return (invoke "le_s" (i32.const 0) (i32.const 0x80000000)) (i32.const 0))
   343  (assert_return (invoke "le_s" (i32.const 0x80000000) (i32.const -1)) (i32.const 1))
   344  (assert_return (invoke "le_s" (i32.const -1) (i32.const 0x80000000)) (i32.const 0))
   345  (assert_return (invoke "le_s" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1))
   346  (assert_return (invoke "le_s" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   347  
   348  (assert_return (invoke "le_u" (i32.const 0) (i32.const 0)) (i32.const 1))
   349  (assert_return (invoke "le_u" (i32.const 1) (i32.const 1)) (i32.const 1))
   350  (assert_return (invoke "le_u" (i32.const -1) (i32.const 1)) (i32.const 0))
   351  (assert_return (invoke "le_u" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 1))
   352  (assert_return (invoke "le_u" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
   353  (assert_return (invoke "le_u" (i32.const -1) (i32.const -1)) (i32.const 1))
   354  (assert_return (invoke "le_u" (i32.const 1) (i32.const 0)) (i32.const 0))
   355  (assert_return (invoke "le_u" (i32.const 0) (i32.const 1)) (i32.const 1))
   356  (assert_return (invoke "le_u" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
   357  (assert_return (invoke "le_u" (i32.const 0) (i32.const 0x80000000)) (i32.const 1))
   358  (assert_return (invoke "le_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 1))
   359  (assert_return (invoke "le_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 0))
   360  (assert_return (invoke "le_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 0))
   361  (assert_return (invoke "le_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 1))
   362  
   363  (assert_return (invoke "gt_s" (i32.const 0) (i32.const 0)) (i32.const 0))
   364  (assert_return (invoke "gt_s" (i32.const 1) (i32.const 1)) (i32.const 0))
   365  (assert_return (invoke "gt_s" (i32.const -1) (i32.const 1)) (i32.const 0))
   366  (assert_return (invoke "gt_s" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
   367  (assert_return (invoke "gt_s" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 0))
   368  (assert_return (invoke "gt_s" (i32.const -1) (i32.const -1)) (i32.const 0))
   369  (assert_return (invoke "gt_s" (i32.const 1) (i32.const 0)) (i32.const 1))
   370  (assert_return (invoke "gt_s" (i32.const 0) (i32.const 1)) (i32.const 0))
   371  (assert_return (invoke "gt_s" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
   372  (assert_return (invoke "gt_s" (i32.const 0) (i32.const 0x80000000)) (i32.const 1))
   373  (assert_return (invoke "gt_s" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   374  (assert_return (invoke "gt_s" (i32.const -1) (i32.const 0x80000000)) (i32.const 1))
   375  (assert_return (invoke "gt_s" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 0))
   376  (assert_return (invoke "gt_s" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 1))
   377  
   378  (assert_return (invoke "gt_u" (i32.const 0) (i32.const 0)) (i32.const 0))
   379  (assert_return (invoke "gt_u" (i32.const 1) (i32.const 1)) (i32.const 0))
   380  (assert_return (invoke "gt_u" (i32.const -1) (i32.const 1)) (i32.const 1))
   381  (assert_return (invoke "gt_u" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 0))
   382  (assert_return (invoke "gt_u" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 0))
   383  (assert_return (invoke "gt_u" (i32.const -1) (i32.const -1)) (i32.const 0))
   384  (assert_return (invoke "gt_u" (i32.const 1) (i32.const 0)) (i32.const 1))
   385  (assert_return (invoke "gt_u" (i32.const 0) (i32.const 1)) (i32.const 0))
   386  (assert_return (invoke "gt_u" (i32.const 0x80000000) (i32.const 0)) (i32.const 1))
   387  (assert_return (invoke "gt_u" (i32.const 0) (i32.const 0x80000000)) (i32.const 0))
   388  (assert_return (invoke "gt_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   389  (assert_return (invoke "gt_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 1))
   390  (assert_return (invoke "gt_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1))
   391  (assert_return (invoke "gt_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   392  
   393  (assert_return (invoke "ge_s" (i32.const 0) (i32.const 0)) (i32.const 1))
   394  (assert_return (invoke "ge_s" (i32.const 1) (i32.const 1)) (i32.const 1))
   395  (assert_return (invoke "ge_s" (i32.const -1) (i32.const 1)) (i32.const 0))
   396  (assert_return (invoke "ge_s" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 1))
   397  (assert_return (invoke "ge_s" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
   398  (assert_return (invoke "ge_s" (i32.const -1) (i32.const -1)) (i32.const 1))
   399  (assert_return (invoke "ge_s" (i32.const 1) (i32.const 0)) (i32.const 1))
   400  (assert_return (invoke "ge_s" (i32.const 0) (i32.const 1)) (i32.const 0))
   401  (assert_return (invoke "ge_s" (i32.const 0x80000000) (i32.const 0)) (i32.const 0))
   402  (assert_return (invoke "ge_s" (i32.const 0) (i32.const 0x80000000)) (i32.const 1))
   403  (assert_return (invoke "ge_s" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   404  (assert_return (invoke "ge_s" (i32.const -1) (i32.const 0x80000000)) (i32.const 1))
   405  (assert_return (invoke "ge_s" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 0))
   406  (assert_return (invoke "ge_s" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 1))
   407  
   408  (assert_return (invoke "ge_u" (i32.const 0) (i32.const 0)) (i32.const 1))
   409  (assert_return (invoke "ge_u" (i32.const 1) (i32.const 1)) (i32.const 1))
   410  (assert_return (invoke "ge_u" (i32.const -1) (i32.const 1)) (i32.const 1))
   411  (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const 0x80000000)) (i32.const 1))
   412  (assert_return (invoke "ge_u" (i32.const 0x7fffffff) (i32.const 0x7fffffff)) (i32.const 1))
   413  (assert_return (invoke "ge_u" (i32.const -1) (i32.const -1)) (i32.const 1))
   414  (assert_return (invoke "ge_u" (i32.const 1) (i32.const 0)) (i32.const 1))
   415  (assert_return (invoke "ge_u" (i32.const 0) (i32.const 1)) (i32.const 0))
   416  (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const 0)) (i32.const 1))
   417  (assert_return (invoke "ge_u" (i32.const 0) (i32.const 0x80000000)) (i32.const 0))
   418  (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const -1)) (i32.const 0))
   419  (assert_return (invoke "ge_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 1))
   420  (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1))
   421  (assert_return (invoke "ge_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0))
   422  
   423  
   424  (assert_invalid
   425    (module
   426      (func $type-unary-operand-empty
   427        (i32.eqz) (drop)
   428      )
   429    )
   430    "type mismatch"
   431  )
   432  (assert_invalid
   433    (module
   434      (func $type-unary-operand-empty-in-block
   435        (i32.const 0)
   436        (block (i32.eqz) (drop))
   437      )
   438    )
   439    "type mismatch"
   440  )
   441  (assert_invalid
   442    (module
   443      (func $type-unary-operand-empty-in-loop
   444        (i32.const 0)
   445        (loop (i32.eqz) (drop))
   446      )
   447    )
   448    "type mismatch"
   449  )
   450  (assert_invalid
   451    (module
   452      (func $type-unary-operand-empty-in-if
   453        (i32.const 0) (i32.const 0)
   454        (if (then (i32.eqz) (drop)))
   455      )
   456    )
   457    "type mismatch"
   458  )
   459  (assert_invalid
   460    (module
   461      (func $type-unary-operand-empty-in-else
   462        (i32.const 0) (i32.const 0)
   463        (if (result i32) (then (i32.const 0)) (else (i32.eqz))) (drop)
   464      )
   465    )
   466    "type mismatch"
   467  )
   468  (assert_invalid
   469    (module
   470      (func $type-unary-operand-empty-in-br
   471        (i32.const 0)
   472        (block (br 0 (i32.eqz)) (drop))
   473      )
   474    )
   475    "type mismatch"
   476  )
   477  (assert_invalid
   478    (module
   479      (func $type-unary-operand-empty-in-br_if
   480        (i32.const 0)
   481        (block (br_if 0 (i32.eqz) (i32.const 1)) (drop))
   482      )
   483    )
   484    "type mismatch"
   485  )
   486  (assert_invalid
   487    (module
   488      (func $type-unary-operand-empty-in-br_table
   489        (i32.const 0)
   490        (block (br_table 0 (i32.eqz)) (drop))
   491      )
   492    )
   493    "type mismatch"
   494  )
   495  (assert_invalid
   496    (module
   497      (func $type-unary-operand-empty-in-return
   498        (return (i32.eqz)) (drop)
   499      )
   500    )
   501    "type mismatch"
   502  )
   503  (assert_invalid
   504    (module
   505      (func $type-unary-operand-empty-in-select
   506        (select (i32.eqz) (i32.const 1) (i32.const 2)) (drop)
   507      )
   508    )
   509    "type mismatch"
   510  )
   511  (assert_invalid
   512    (module
   513      (func $type-unary-operand-empty-in-call
   514        (call 1 (i32.eqz)) (drop)
   515      )
   516      (func (param i32) (result i32) (local.get 0))
   517    )
   518    "type mismatch"
   519  )
   520  (assert_invalid
   521    (module
   522      (func $f (param i32) (result i32) (local.get 0))
   523      (type $sig (func (param i32) (result i32)))
   524      (table funcref (elem $f))
   525      (func $type-unary-operand-empty-in-call_indirect
   526        (block (result i32)
   527          (call_indirect (type $sig)
   528            (i32.eqz) (i32.const 0)
   529          )
   530          (drop)
   531        )
   532      )
   533    )
   534    "type mismatch"
   535  )
   536  (assert_invalid
   537    (module
   538      (func $type-unary-operand-empty-in-local.set
   539        (local i32)
   540        (local.set 0 (i32.eqz)) (local.get 0) (drop)
   541      )
   542    )
   543    "type mismatch"
   544  )
   545  (assert_invalid
   546    (module
   547      (func $type-unary-operand-empty-in-local.tee
   548        (local i32)
   549        (local.tee 0 (i32.eqz)) (drop)
   550      )
   551    )
   552    "type mismatch"
   553  )
   554  (assert_invalid
   555    (module
   556      (global $x (mut i32) (i32.const 0))
   557      (func $type-unary-operand-empty-in-global.set
   558        (global.set $x (i32.eqz)) (global.get $x) (drop)
   559      )
   560    )
   561    "type mismatch"
   562  )
   563  (assert_invalid
   564    (module
   565      (memory 0)
   566      (func $type-unary-operand-empty-in-memory.grow
   567        (memory.grow (i32.eqz)) (drop)
   568      )
   569    )
   570    "type mismatch"
   571  )
   572  (assert_invalid
   573    (module
   574      (memory 0)
   575      (func $type-unary-operand-empty-in-load
   576        (i32.load (i32.eqz)) (drop)
   577      )
   578    )
   579    "type mismatch"
   580  )
   581  (assert_invalid
   582    (module
   583      (memory 1)
   584      (func $type-unary-operand-empty-in-store
   585        (i32.store (i32.eqz) (i32.const 1))
   586      )
   587    )
   588    "type mismatch"
   589  )
   590  
   591  (assert_invalid
   592    (module
   593      (func $type-binary-1st-operand-empty
   594        (i32.add) (drop)
   595      )
   596    )
   597    "type mismatch"
   598  )
   599  (assert_invalid
   600    (module
   601      (func $type-binary-2nd-operand-empty
   602        (i32.const 0) (i32.add) (drop)
   603      )
   604    )
   605    "type mismatch"
   606  )
   607  (assert_invalid
   608    (module
   609      (func $type-binary-1st-operand-empty-in-block
   610        (i32.const 0) (i32.const 0)
   611        (block (i32.add) (drop))
   612      )
   613    )
   614    "type mismatch"
   615  )
   616  (assert_invalid
   617    (module
   618      (func $type-binary-2nd-operand-empty-in-block
   619        (i32.const 0)
   620        (block (i32.const 0) (i32.add) (drop))
   621      )
   622    )
   623    "type mismatch"
   624  )
   625  (assert_invalid
   626    (module
   627      (func $type-binary-1st-operand-empty-in-loop
   628        (i32.const 0) (i32.const 0)
   629        (loop (i32.add) (drop))
   630      )
   631    )
   632    "type mismatch"
   633  )
   634  (assert_invalid
   635    (module
   636      (func $type-binary-2nd-operand-empty-in-loop
   637        (i32.const 0)
   638        (loop (i32.const 0) (i32.add) (drop))
   639      )
   640    )
   641    "type mismatch"
   642  )
   643  (assert_invalid
   644    (module
   645      (func $type-binary-1st-operand-empty-in-if
   646        (i32.const 0) (i32.const 0) (i32.const 0)
   647        (if (i32.add) (then (drop)))
   648      )
   649    )
   650    "type mismatch"
   651  )
   652  (assert_invalid
   653    (module
   654      (func $type-binary-2nd-operand-empty-in-if
   655        (i32.const 0) (i32.const 0)
   656        (if (i32.const 0) (then (i32.add)) (else (drop)))
   657      )
   658    )
   659    "type mismatch"
   660  )
   661  (assert_invalid
   662    (module
   663      (func $type-binary-1st-operand-empty-in-else
   664        (i32.const 0) (i32.const 0) (i32.const 0)
   665        (if (result i32) (then (i32.const 0)) (else (i32.add) (i32.const 0)))
   666        (drop) (drop)
   667      )
   668    )
   669    "type mismatch"
   670  )
   671  (assert_invalid
   672    (module
   673      (func $type-binary-2nd-operand-empty-in-else
   674        (i32.const 0) (i32.const 0)
   675        (if (result i32) (then (i32.const 0)) (else (i32.add)))
   676        (drop)
   677      )
   678    )
   679    "type mismatch"
   680  )
   681  (assert_invalid
   682    (module
   683      (func $type-binary-1st-operand-empty-in-br
   684        (i32.const 0) (i32.const 0)
   685        (block (br 0 (i32.add)) (drop))
   686      )
   687    )
   688    "type mismatch"
   689  )
   690  (assert_invalid
   691    (module
   692      (func $type-binary-2nd-operand-empty-in-br
   693        (i32.const 0)
   694        (block (br 0 (i32.const 0) (i32.add)) (drop))
   695      )
   696    )
   697    "type mismatch"
   698  )
   699  (assert_invalid
   700    (module
   701      (func $type-binary-1st-operand-empty-in-br_if
   702        (i32.const 0) (i32.const 0)
   703        (block (br_if 0 (i32.add) (i32.const 1)) (drop))
   704      )
   705    )
   706    "type mismatch"
   707  )
   708  (assert_invalid
   709    (module
   710      (func $type-binary-2nd-operand-empty-in-br_if
   711        (i32.const 0)
   712        (block (br_if 0 (i32.const 0) (i32.add) (i32.const 1)) (drop))
   713      )
   714    )
   715    "type mismatch"
   716  )
   717  (assert_invalid
   718    (module
   719      (func $type-binary-1st-operand-empty-in-br_table
   720        (i32.const 0) (i32.const 0)
   721        (block (br_table 0 (i32.add)) (drop))
   722      )
   723    )
   724    "type mismatch"
   725  )
   726  (assert_invalid
   727    (module
   728      (func $type-binary-2nd-operand-empty-in-br_table
   729        (i32.const 0)
   730        (block (br_table 0 (i32.const 0) (i32.add)) (drop))
   731      )
   732    )
   733    "type mismatch"
   734  )
   735  (assert_invalid
   736    (module
   737      (func $type-binary-1st-operand-empty-in-return
   738        (return (i32.add)) (drop)
   739      )
   740    )
   741    "type mismatch"
   742  )
   743  (assert_invalid
   744    (module
   745      (func $type-binary-2nd-operand-empty-in-return
   746        (return (i32.const 0) (i32.add)) (drop)
   747      )
   748    )
   749    "type mismatch"
   750  )
   751  (assert_invalid
   752    (module
   753      (func $type-binary-1st-operand-empty-in-select
   754        (select (i32.add) (i32.const 1) (i32.const 2)) (drop)
   755      )
   756    )
   757    "type mismatch"
   758  )
   759  (assert_invalid
   760    (module
   761      (func $type-binary-2nd-operand-empty-in-select
   762        (select (i32.const 0) (i32.add) (i32.const 1) (i32.const 2)) (drop)
   763      )
   764    )
   765    "type mismatch"
   766  )
   767  (assert_invalid
   768    (module
   769      (func $type-binary-1st-operand-empty-in-call
   770        (call 1 (i32.add)) (drop)
   771      )
   772      (func (param i32 i32) (result i32) (local.get 0))
   773    )
   774    "type mismatch"
   775  )
   776  (assert_invalid
   777    (module
   778      (func $type-binary-2nd-operand-empty-in-call
   779        (call 1 (i32.const 0) (i32.add)) (drop)
   780      )
   781      (func (param i32 i32) (result i32) (local.get 0))
   782    )
   783    "type mismatch"
   784  )
   785  (assert_invalid
   786    (module
   787      (func $f (param i32) (result i32) (local.get 0))
   788      (type $sig (func (param i32) (result i32)))
   789      (table funcref (elem $f))
   790      (func $type-binary-1st-operand-empty-in-call_indirect
   791        (block (result i32)
   792          (call_indirect (type $sig)
   793            (i32.add) (i32.const 0)
   794          )
   795          (drop)
   796        )
   797      )
   798    )
   799    "type mismatch"
   800  )
   801  (assert_invalid
   802    (module
   803      (func $f (param i32) (result i32) (local.get 0))
   804      (type $sig (func (param i32) (result i32)))
   805      (table funcref (elem $f))
   806      (func $type-binary-2nd-operand-empty-in-call_indirect
   807        (block (result i32)
   808          (call_indirect (type $sig)
   809            (i32.const 0) (i32.add) (i32.const 0)
   810          )
   811          (drop)
   812        )
   813      )
   814    )
   815    "type mismatch"
   816  )
   817  (assert_invalid
   818    (module
   819      (func $type-binary-1st-operand-empty-in-local.set
   820        (local i32)
   821        (local.set 0 (i32.add)) (local.get 0) (drop)
   822      )
   823    )
   824    "type mismatch"
   825  )
   826  (assert_invalid
   827    (module
   828      (func $type-binary-2nd-operand-empty-in-local.set
   829        (local i32)
   830        (local.set 0 (i32.const 0) (i32.add)) (local.get 0) (drop)
   831      )
   832    )
   833    "type mismatch"
   834  )
   835  (assert_invalid
   836    (module
   837      (func $type-binary-1st-operand-empty-in-local.tee
   838        (local i32)
   839        (local.tee 0 (i32.add)) (drop)
   840      )
   841    )
   842    "type mismatch"
   843  )
   844  (assert_invalid
   845    (module
   846      (func $type-binary-2nd-operand-empty-in-local.tee
   847        (local i32)
   848        (local.tee 0 (i32.const 0) (i32.add)) (drop)
   849      )
   850    )
   851    "type mismatch"
   852  )
   853  (assert_invalid
   854    (module
   855      (global $x (mut i32) (i32.const 0))
   856      (func $type-binary-1st-operand-empty-in-global.set
   857        (global.set $x (i32.add)) (global.get $x) (drop)
   858      )
   859    )
   860    "type mismatch"
   861  )
   862  (assert_invalid
   863    (module
   864      (global $x (mut i32) (i32.const 0))
   865      (func $type-binary-2nd-operand-empty-in-global.set
   866        (global.set $x (i32.const 0) (i32.add)) (global.get $x) (drop)
   867      )
   868    )
   869    "type mismatch"
   870  )
   871  (assert_invalid
   872    (module
   873      (memory 0)
   874      (func $type-binary-1st-operand-empty-in-memory.grow
   875        (memory.grow (i32.add)) (drop)
   876      )
   877    )
   878    "type mismatch"
   879  )
   880  (assert_invalid
   881    (module
   882      (memory 0)
   883      (func $type-binary-2nd-operand-empty-in-memory.grow
   884        (memory.grow (i32.const 0) (i32.add)) (drop)
   885      )
   886    )
   887    "type mismatch"
   888  )
   889  (assert_invalid
   890    (module
   891      (memory 0)
   892      (func $type-binary-1st-operand-empty-in-load
   893        (i32.load (i32.add)) (drop)
   894      )
   895    )
   896    "type mismatch"
   897  )
   898  (assert_invalid
   899    (module
   900      (memory 0)
   901      (func $type-binary-2nd-operand-empty-in-load
   902        (i32.load (i32.const 0) (i32.add)) (drop)
   903      )
   904    )
   905    "type mismatch"
   906  )
   907  (assert_invalid
   908    (module
   909      (memory 1)
   910      (func $type-binary-1st-operand-empty-in-store
   911        (i32.store (i32.add) (i32.const 1))
   912      )
   913    )
   914    "type mismatch"
   915  )
   916  (assert_invalid
   917    (module
   918      (memory 1)
   919      (func $type-binary-2nd-operand-empty-in-store
   920        (i32.store (i32.const 1) (i32.add) (i32.const 0))
   921      )
   922    )
   923    "type mismatch"
   924  )
   925  
   926  
   927  ;; Type check
   928  
   929  (assert_invalid (module (func (result i32) (i32.add (i64.const 0) (f32.const 0)))) "type mismatch")
   930  (assert_invalid (module (func (result i32) (i32.and (i64.const 0) (f32.const 0)))) "type mismatch")
   931  (assert_invalid (module (func (result i32) (i32.div_s (i64.const 0) (f32.const 0)))) "type mismatch")
   932  (assert_invalid (module (func (result i32) (i32.div_u (i64.const 0) (f32.const 0)))) "type mismatch")
   933  (assert_invalid (module (func (result i32) (i32.mul (i64.const 0) (f32.const 0)))) "type mismatch")
   934  (assert_invalid (module (func (result i32) (i32.or (i64.const 0) (f32.const 0)))) "type mismatch")
   935  (assert_invalid (module (func (result i32) (i32.rem_s (i64.const 0) (f32.const 0)))) "type mismatch")
   936  (assert_invalid (module (func (result i32) (i32.rem_u (i64.const 0) (f32.const 0)))) "type mismatch")
   937  (assert_invalid (module (func (result i32) (i32.rotl (i64.const 0) (f32.const 0)))) "type mismatch")
   938  (assert_invalid (module (func (result i32) (i32.rotr (i64.const 0) (f32.const 0)))) "type mismatch")
   939  (assert_invalid (module (func (result i32) (i32.shl (i64.const 0) (f32.const 0)))) "type mismatch")
   940  (assert_invalid (module (func (result i32) (i32.shr_s (i64.const 0) (f32.const 0)))) "type mismatch")
   941  (assert_invalid (module (func (result i32) (i32.shr_u (i64.const 0) (f32.const 0)))) "type mismatch")
   942  (assert_invalid (module (func (result i32) (i32.sub (i64.const 0) (f32.const 0)))) "type mismatch")
   943  (assert_invalid (module (func (result i32) (i32.xor (i64.const 0) (f32.const 0)))) "type mismatch")
   944  (assert_invalid (module (func (result i32) (i32.eqz (i64.const 0)))) "type mismatch")
   945  (assert_invalid (module (func (result i32) (i32.clz (i64.const 0)))) "type mismatch")
   946  (assert_invalid (module (func (result i32) (i32.ctz (i64.const 0)))) "type mismatch")
   947  (assert_invalid (module (func (result i32) (i32.popcnt (i64.const 0)))) "type mismatch")
   948  (assert_invalid (module (func (result i32) (i32.eq (i64.const 0) (f32.const 0)))) "type mismatch")
   949  (assert_invalid (module (func (result i32) (i32.ge_s (i64.const 0) (f32.const 0)))) "type mismatch")
   950  (assert_invalid (module (func (result i32) (i32.ge_u (i64.const 0) (f32.const 0)))) "type mismatch")
   951  (assert_invalid (module (func (result i32) (i32.gt_s (i64.const 0) (f32.const 0)))) "type mismatch")
   952  (assert_invalid (module (func (result i32) (i32.gt_u (i64.const 0) (f32.const 0)))) "type mismatch")
   953  (assert_invalid (module (func (result i32) (i32.le_s (i64.const 0) (f32.const 0)))) "type mismatch")
   954  (assert_invalid (module (func (result i32) (i32.le_u (i64.const 0) (f32.const 0)))) "type mismatch")
   955  (assert_invalid (module (func (result i32) (i32.lt_s (i64.const 0) (f32.const 0)))) "type mismatch")
   956  (assert_invalid (module (func (result i32) (i32.lt_u (i64.const 0) (f32.const 0)))) "type mismatch")
   957  (assert_invalid (module (func (result i32) (i32.ne (i64.const 0) (f32.const 0)))) "type mismatch")