tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

integer.js (18989B)


      1 assertEq(wasmEvalText('(module (func (result i32) (i32.const -1)) (export "" (func 0)))').exports[""](), -1);
      2 assertEq(wasmEvalText('(module (func (result i32) (i32.const -2147483648)) (export "" (func 0)))').exports[""](), -2147483648);
      3 assertEq(wasmEvalText('(module (func (result i32) (i32.const 4294967295)) (export "" (func 0)))').exports[""](), -1);
      4 
      5 function testUnary(type, opcode, op, expect) {
      6    if (type === 'i64') {
      7        // Test with constant
      8        wasmFullPassI64(`(module (func $run (result ${type}) (${type}.${opcode} (${type}.const ${op}))))`, expect);
      9        // Test with param
     10        wasmFullPassI64(`(module (func $run (param ${type}) (result ${type}) (${type}.${opcode} (local.get 0))))`, expect, {}, `i64.const ${op}`);
     11        return;
     12    }
     13    // Test with constant
     14    wasmFullPass(`(module (func (result ${type}) (${type}.${opcode} (${type}.const ${op}))) (export "run" (func 0)))`, expect);
     15    // Test with param
     16    wasmFullPass(`(module (func (param ${type}) (result ${type}) (${type}.${opcode} (local.get 0))) (export "run" (func 0)))`, expect, {}, op);
     17 }
     18 
     19 function testBinary64(opcode, lhs, rhs, expect) {
     20    let lsrc = `i64.const ${lhs}`;
     21    let rsrc = `i64.const ${rhs}`;
     22    wasmFullPassI64(`(module (func $run (param i64) (param i64) (result i64) (i64.${opcode} (local.get 0) (local.get 1))))`, expect, {}, lsrc, rsrc);
     23    // The same, but now the RHS is a constant.
     24    wasmFullPassI64(`(module (func $run (param i64) (result i64) (i64.${opcode} (local.get 0) (i64.const ${rhs}))))`, expect, {}, lsrc);
     25    // LHS and RHS are constants.
     26    wasmFullPassI64(`(module (func $run (result i64) (i64.${opcode} (i64.const ${lhs}) (i64.const ${rhs}))))`, expect);
     27 }
     28 
     29 function testBinary32(opcode, lhs, rhs, expect) {
     30    wasmFullPass(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (local.get 0) (local.get 1))) (export "run" (func 0)))`, expect, {}, lhs, rhs);
     31    // The same, but now the RHS is a constant.
     32    wasmFullPass(`(module (func (param i32) (result i32) (i32.${opcode} (local.get 0) (i32.const ${rhs}))) (export "run" (func 0)))`, expect, {}, lhs);
     33    // LHS and RHS are constants.
     34    wasmFullPass(`(module (func (result i32) (i32.${opcode} (i32.const ${lhs}) (i32.const ${rhs}))) (export "run" (func 0)))`, expect);
     35 }
     36 
     37 function testComparison32(opcode, lhs, rhs, expect) {
     38    wasmFullPass(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (local.get 0) (local.get 1))) (export "run" (func 0)))`, expect, {}, lhs, rhs);
     39 }
     40 function testComparison64(opcode, lhs, rhs, expect) {
     41    let lsrc = `i64.const ${lhs}`;
     42    let rsrc = `i64.const ${rhs}`;
     43 
     44    wasmFullPass(`(module
     45                    (func $cmp (param i64) (param i64) (result i32) (i64.${opcode} (local.get 0) (local.get 1)))
     46                    (func $assert (result i32)
     47                     i64.const ${lhs}
     48                     i64.const ${rhs}
     49                     call $cmp
     50                    )
     51                    (export "run" (func $assert)))`, expect);
     52 
     53    // Also test `if`, for the compare-and-branch path.
     54    wasmFullPass(`(module
     55                    (func $cmp (param i64) (param i64) (result i32)
     56                      (if (result i32) (i64.${opcode} (local.get 0) (local.get 1))
     57                       (then (i32.const 1))
     58                       (else (i32.const 0))))
     59                    (func $assert (result i32)
     60                     i64.const ${lhs}
     61                     i64.const ${rhs}
     62                     call $cmp
     63                    )
     64                    (export "run" (func $assert)))`, expect);
     65 }
     66 
     67 function testI64Eqz(input, expect) {
     68    wasmFullPass(`(module (func (result i32) (i64.eqz (i64.const ${input}))) (export "run" (func 0)))`, expect, {});
     69    wasmFullPass(`(module
     70        (func (param i64) (result i32) (i64.eqz (local.get 0)))
     71        (func $assert (result i32) (i64.const ${input}) (call 0))
     72        (export "run" (func $assert)))`, expect);
     73 }
     74 
     75 function testTrap32(opcode, lhs, rhs, expect) {
     76    assertErrorMessage(() => wasmEvalText(`(module (func (param i32) (param i32) (result i32) (i32.${opcode} (local.get 0) (local.get 1))) (export "" (func 0)))`).exports[""](lhs, rhs), Error, expect);
     77    // The same, but now the RHS is a constant.
     78    assertErrorMessage(() => wasmEvalText(`(module (func (param i32) (result i32) (i32.${opcode} (local.get 0) (i32.const ${rhs}))) (export "" (func 0)))`).exports[""](lhs), Error, expect);
     79    // LHS and RHS are constants.
     80    assertErrorMessage(wasmEvalText(`(module (func (result i32) (i32.${opcode} (i32.const ${lhs}) (i32.const ${rhs}))) (export "" (func 0)))`).exports[""], Error, expect);
     81 }
     82 
     83 function testTrap64(opcode, lhs, rhs, expect) {
     84    let $call = ``;
     85 
     86    assertErrorMessage(wasmEvalText(`(module
     87        (func (param i64) (param i64) (result i64) (i64.${opcode} (local.get 0) (local.get 1)))
     88        (func $f (export "") (i64.const ${lhs}) (i64.const ${rhs}) (call 0) drop)
     89    )`).exports[""], Error, expect);
     90    // The same, but now the RHS is a constant.
     91    assertErrorMessage(wasmEvalText(`(module
     92        (func (param i64) (result i64) (i64.${opcode} (local.get 0) (i64.const ${rhs})))
     93        (func $f (export "") (i64.const ${lhs}) (call 0) drop)
     94    )`).exports[""], Error, expect);
     95    // LHS and RHS are constants.
     96    assertErrorMessage(wasmEvalText(`(module
     97        (func (result i64) (i64.${opcode} (i64.const ${lhs}) (i64.const ${rhs})))
     98        (func $f (export "") (call 0) drop)
     99    )`).exports[""], Error, expect);
    100 }
    101 
    102 testUnary('i32', 'clz', 40, 26);
    103 testUnary('i32', 'clz', 0, 32);
    104 testUnary('i32', 'clz', 0xFFFFFFFF, 0);
    105 testUnary('i32', 'clz', -2147483648, 0);
    106 
    107 testUnary('i32', 'ctz', 40, 3);
    108 testUnary('i32', 'ctz', 0, 32);
    109 testUnary('i32', 'ctz', -2147483648, 31);
    110 
    111 testUnary('i32', 'popcnt', 40, 2);
    112 testUnary('i32', 'popcnt', 0, 0);
    113 testUnary('i32', 'popcnt', 0xFFFFFFFF, 32);
    114 
    115 testUnary('i32', 'eqz', 0, 1);
    116 testUnary('i32', 'eqz', 1, 0);
    117 testUnary('i32', 'eqz', 0xFFFFFFFF, 0);
    118 
    119 testBinary32('add', 40, 2, 42);
    120 testBinary32('sub', 40, 2, 38);
    121 testBinary32('mul', 40, 2, 80);
    122 testBinary32('div_s', -40, 2, -20);
    123 testBinary32('div_s', -40, 8, -5);
    124 testBinary32('div_s', -40, 7, -5);
    125 testBinary32('div_s', 40, 8, 5);
    126 testBinary32('div_s', 40, 7, 5);
    127 testBinary32('div_u', -40, 2, 2147483628);
    128 testBinary32('div_u', 40, 2, 20);
    129 testBinary32('div_u', 40, 8, 5);
    130 testBinary32('rem_s', 40, -3, 1);
    131 testBinary32('rem_s', 0, -3, 0);
    132 testBinary32('rem_s', 5, 2, 1);
    133 testBinary32('rem_s', 65, 64, 1);
    134 testBinary32('rem_s', -65, 64, -1);
    135 testBinary32('rem_u', 40, -3, 40);
    136 testBinary32('rem_u', 41, 8, 1);
    137 testBinary32('and', 42, 6, 2);
    138 testBinary32('or', 42, 6, 46);
    139 testBinary32('xor', 42, 2, 40);
    140 testBinary32('xor', -1, 1739168047, -1739168048);
    141 testBinary32('xor', -1739168043, -1, 1739168042);
    142 testBinary32('shl', 40, 0, 40);
    143 testBinary32('shl', 40, 2, 160);
    144 testBinary32('shr_s', -40, 0, -40);
    145 testBinary32('shr_s', -40, 2, -10);
    146 testBinary32('shr_u', -40, 0, -40);
    147 testBinary32('shr_u', -40, 2, 1073741814);
    148 
    149 testTrap32('div_s', 42, 0, /integer divide by zero/);
    150 testTrap32('div_s', 0x80000000 | 0, -1, /integer overflow/);
    151 testTrap32('div_u', 42, 0, /integer divide by zero/);
    152 testTrap32('rem_s', 42, 0, /integer divide by zero/);
    153 testTrap32('rem_u', 42, 0, /integer divide by zero/);
    154 
    155 testBinary32('rotl', 40, 2, 160);
    156 testBinary32('rotl', 40, 34, 160);
    157 testBinary32('rotr', 40, 2, 10);
    158 testBinary32('rotr', 40, 34, 10);
    159 testBinary32('rotr', 40, 0, 40);
    160 testBinary32('rotl', 40, 0, 40);
    161 
    162 testComparison32('eq', 40, 40, 1);
    163 testComparison32('ne', 40, 40, 0);
    164 testComparison32('lt_s', 40, 40, 0);
    165 testComparison32('lt_u', 40, 40, 0);
    166 testComparison32('le_s', 40, 40, 1);
    167 testComparison32('le_u', 40, 40, 1);
    168 testComparison32('gt_s', 40, 40, 0);
    169 testComparison32('gt_u', 40, 40, 0);
    170 testComparison32('ge_s', 40, 40, 1);
    171 testComparison32('ge_u', 40, 40, 1);
    172 
    173 // On 32-bit debug builds, with --ion-eager, this test can run into our
    174 // per-process JIT code limits and OOM. Trigger a GC to discard code.
    175 if (getJitCompilerOptions()["ion.warmup.trigger"] === 0)
    176    gc();
    177 
    178 // Test MTest's GVN branch inversion.
    179 var testTrunc = wasmEvalText(`(module (func (param f32) (result i32) (if (result i32) (i32.eqz (i32.trunc_f32_s (local.get 0))) (then (i32.const 0)) (else (i32.const 1)))) (export "" (func 0)))`).exports[""];
    180 assertEq(testTrunc(0), 0);
    181 assertEq(testTrunc(13.37), 1);
    182 
    183 testBinary64('add', 40, 2, 42);
    184 testBinary64('add', "0x1234567887654321", -1, "0x1234567887654320");
    185 testBinary64('add', "0xffffffffffffffff", 1, 0);
    186 testBinary64('sub', 40, 2, 38);
    187 testBinary64('sub', "0x1234567887654321", "0x123456789", "0x12345677641fdb98");
    188 testBinary64('sub', 3, 5, -2);
    189 testBinary64('mul', 40, 2, 80);
    190 testBinary64('mul', -1, 2, -2);
    191 testBinary64('mul', 0x123456, "0x9876543210", "0xad77d2c5f941160");
    192 testBinary64('mul', 2, -1, -2);
    193 testBinary64('mul', "0x80000000", -1, -2147483648);
    194 testBinary64('mul', "0x7fffffff", -1, -2147483647);
    195 testBinary64('mul', "0x7fffffffffffffff", -1, "0x8000000000000001");
    196 testBinary64('mul', 2, 2, 4);
    197 testBinary64('mul', "0x80000000", 2, "0x100000000");
    198 testBinary64('mul', "0x7fffffff", 2, "0xfffffffe");
    199 testBinary64('div_s', -40, 2, -20);
    200 testBinary64('div_s', -40, 8, -5);
    201 testBinary64('div_s', -40, 7, -5);
    202 testBinary64('div_s', 40, 8, 5);
    203 testBinary64('div_s', 40, 7, 5);
    204 testBinary64('div_s', "0x1234567887654321", 2, "0x91a2b3c43b2a190");
    205 testBinary64('div_s', "0x1234567887654321", "0x1000000000", "0x1234567");
    206 testBinary64('div_s', -1, "0x100000000", 0);
    207 testBinary64('div_u', -40, 2, "0x7fffffffffffffec");
    208 testBinary64('div_u', "0x1234567887654321", 9, "0x205d0b80f0b4059");
    209 testBinary64('div_u', 40, 2, 20);
    210 testBinary64('div_u', 40, 8, 5);
    211 testBinary64('rem_s', 40, -3, 1);
    212 testBinary64('rem_s', 0, -3, 0);
    213 testBinary64('rem_s', 5, 2, 1);
    214 testBinary64('rem_s', 65, 64, 1);
    215 testBinary64('rem_s', "0x1234567887654321", "0x1000000000", "0x887654321");
    216 testBinary64('rem_s', "0x7fffffffffffffff", -1, 0);
    217 testBinary64('rem_s', "0x8000000000000001", 1000, -807);
    218 testBinary64('rem_s', "0x8000000000000000", -1, 0);
    219 testBinary64('rem_u', 40, -3, 40);
    220 testBinary64('rem_u', 41, 8, 1);
    221 testBinary64('rem_u', "0x1234567887654321", "0x1000000000", "0x887654321");
    222 testBinary64('rem_u', "0x8000000000000000", -1, "0x8000000000000000");
    223 testBinary64('rem_u', "0x8ff00ff00ff00ff0", "0x100000001", "0x80000001");
    224 
    225 testTrap64('div_s', 10, 0, /integer divide by zero/);
    226 testTrap64('div_s', "0x8000000000000000", -1, /integer overflow/);
    227 testTrap64('div_u', 0, 0, /integer divide by zero/);
    228 testTrap64('rem_s', 10, 0, /integer divide by zero/);
    229 testTrap64('rem_u', 10, 0, /integer divide by zero/);
    230 
    231 // Bitops.
    232 testBinary64('or', 42, 6, 46);
    233 testBinary64('or', "0x8765432112345678", "0xffff0000ffff0000", "0xffff4321ffff5678");
    234 
    235 testBinary64('xor', 42, 2, 40);
    236 testBinary64('xor', "0x8765432112345678", "0xffff0000ffff0000", "0x789a4321edcb5678");
    237 testBinary64('xor', "0xffffffffffffffff", "0x2c73173d985666d0", "0xd38ce8c267a9992f");
    238 testBinary64('xor', "0xe8f3437fe059746a", "0xffffffffffffffff", "0x170cbc801fa68b95");
    239 
    240 testBinary64('shl', 0xff00ff, 28, "0x0ff00ff0000000");
    241 testBinary64('shl', 0xff00ff, 30, "0x3fc03fc0000000");
    242 testBinary64('shl', 0xff00ff, 31, "0x7f807f80000000");
    243 testBinary64('shl', 0xff00ff, 32, "0xff00ff00000000");
    244 testBinary64('shl', 1, 63, "0x8000000000000000");
    245 testBinary64('shl', 1, 64, 1);
    246 testBinary64('shl', 40, 2, 160);
    247 testBinary64('shl', 40, 0, 40);
    248 
    249 testBinary64('shr_s', -40, 0, -40);
    250 testBinary64('shr_s', -40, 2, -10);
    251 testBinary64('shr_s', "0xff00ff0000000", 28, 0xff00ff);
    252 testBinary64('shr_s', "0xff00ff0000000", 30, 0x3fc03f);
    253 testBinary64('shr_s', "0xff00ff0000000", 31, 0x1fe01f);
    254 testBinary64('shr_s', "0xff00ff0000000", 32, 0x0ff00f);
    255 
    256 testBinary64('shr_u', -40, 0, -40);
    257 testBinary64('shr_u', -40, 2, "0x3ffffffffffffff6");
    258 testBinary64('shr_u', "0x8ffff00ff0000000", 30, "0x23fffc03f");
    259 testBinary64('shr_u', "0x8ffff00ff0000000", 31, "0x11fffe01f");
    260 testBinary64('shr_u', "0x8ffff00ff0000000", 32, "0x08ffff00f");
    261 testBinary64('shr_u', "0x8ffff00ff0000000", 56, 0x8f);
    262 
    263 testBinary64('and', 42, 0, 0);
    264 testBinary64('and', 42, 6, 2);
    265 testBinary64('and', "0x0000000012345678", "0xffff0000ffff0000", "0x0000000012340000");
    266 testBinary64('and', "0x8765432112345678", "0xffff0000ffff0000", "0x8765000012340000");
    267 
    268 // Rotations.
    269 testBinary64('rotl', 40, 0, 0x28);
    270 testBinary64('rotl', 40, 2, 0xA0);
    271 testBinary64('rotl', 40, 8, 0x2800);
    272 testBinary64('rotl', 40, 30, "0xA00000000");
    273 testBinary64('rotl', 40, 31, "0x1400000000");
    274 testBinary64('rotl', 40, 32, "0x2800000000");
    275 
    276 testBinary64('rotl', "0x1234567812345678", 4, "0x2345678123456781");
    277 testBinary64('rotl', "0x1234567812345678", 30, "0x048D159E048D159E");
    278 testBinary64('rotl', "0x1234567812345678", 31, "0x091A2B3C091A2B3C");
    279 testBinary64('rotl', "0x1234567812345678", 32, "0x1234567812345678");
    280 
    281 testBinary64('rotl', "0x0000000000001000", 127, "0x0000000000000800");
    282 
    283 testBinary64('rotr', 40, 0, 0x28);
    284 testBinary64('rotr', 40, 2, 0x0A);
    285 testBinary64('rotr', 40, 30, "0xA000000000");
    286 testBinary64('rotr', 40, 31, "0x5000000000");
    287 testBinary64('rotr', 40, 32, "0x2800000000");
    288 
    289 testBinary64('rotr', "0x1234567812345678", 4, "0x8123456781234567");
    290 testBinary64('rotr', "0x1234567812345678", 30, "0x48D159E048D159E0");
    291 testBinary64('rotr', "0x1234567812345678", 31, "0x2468ACF02468ACF0");
    292 testBinary64('rotr', "0x1234567812345678", 32, "0x1234567812345678");
    293 testBinary64('rotr', "0x1234567812345678", 60, "0x2345678123456781");
    294 
    295 testBinary64('rotr', "0x0000000000001000", 127, "0x0000000000002000");
    296 
    297 // Comparisons.
    298 testComparison64('eq', 40, 40, 1);
    299 testComparison64('ne', 40, 40, 0);
    300 testComparison64('lt_s', 40, 40, 0);
    301 testComparison64('lt_u', 40, 40, 0);
    302 testComparison64('le_s', 40, 40, 1);
    303 testComparison64('le_u', 40, 40, 1);
    304 testComparison64('gt_s', 40, 40, 0);
    305 testComparison64('gt_u', 40, 40, 0);
    306 testComparison64('ge_s', 40, 40, 1);
    307 testComparison64('ge_u', 40, 40, 1);
    308 testComparison64('eq', "0x400012345678", "0x400012345678", 1);
    309 testComparison64('eq', "0x400012345678", "0x500012345678", 0);
    310 testComparison64('ne', "0x400012345678", "0x400012345678", 0);
    311 testComparison64('ne', "0x400012345678", "0x500012345678", 1);
    312 testComparison64('eq', "0xffffffffffffffff", -1, 1);
    313 testComparison64('lt_s', "0x8000000012345678", "0x1", 1);
    314 testComparison64('lt_s', "0x1", "0x8000000012345678", 0);
    315 testComparison64('lt_u', "0x8000000012345678", "0x1", 0);
    316 testComparison64('lt_u', "0x1", "0x8000000012345678", 1);
    317 testComparison64('le_s', -1, 0, 1);
    318 testComparison64('le_s', -1, -1, 1);
    319 testComparison64('le_s', 0, -1, 0);
    320 testComparison64('le_u', -1, 0, 0);
    321 testComparison64('le_u', -1, -1, 1);
    322 testComparison64('le_u', 0, -1, 1);
    323 testComparison64('gt_s', 1, "0x8000000000000000", 1);
    324 testComparison64('gt_s', "0x8000000000000000", 1, 0);
    325 testComparison64('gt_u', 1, "0x8000000000000000", 0);
    326 testComparison64('gt_u', "0x8000000000000000", 1, 1);
    327 testComparison64('ge_s', 1, "0x8000000000000000", 1);
    328 testComparison64('ge_s', "0x8000000000000000", 1, 0);
    329 testComparison64('ge_u', 1, "0x8000000000000000", 0);
    330 testComparison64('ge_u', "0x8000000000000000", 1, 1);
    331 
    332 testUnary('i64', 'clz', 40, 58);
    333 testUnary('i64', 'clz', "0x8000000000000000", 0);
    334 testUnary('i64', 'clz', "0x7fffffffffffffff", 1);
    335 testUnary('i64', 'clz', "0x4000000000000000", 1);
    336 testUnary('i64', 'clz', "0x3000000000000000", 2);
    337 testUnary('i64', 'clz', "0x2000000000000000", 2);
    338 testUnary('i64', 'clz', "0x1000000000000000", 3);
    339 testUnary('i64', 'clz', "0x0030000000000000", 10);
    340 testUnary('i64', 'clz', "0x0000800000000000", 16);
    341 testUnary('i64', 'clz', "0x00000000ffffffff", 32);
    342 testUnary('i64', 'clz', -1, 0);
    343 testUnary('i64', 'clz', 0, 64);
    344 
    345 testUnary('i64', 'ctz', 40, 3);
    346 testUnary('i64', 'ctz', "0x8000000000000000", 63);
    347 testUnary('i64', 'ctz', "0x7fffffffffffffff", 0);
    348 testUnary('i64', 'ctz', "0x4000000000000000", 62);
    349 testUnary('i64', 'ctz', "0x3000000000000000", 60);
    350 testUnary('i64', 'ctz', "0x2000000000000000", 61);
    351 testUnary('i64', 'ctz', "0x1000000000000000", 60);
    352 testUnary('i64', 'ctz', "0x0030000000000000", 52);
    353 testUnary('i64', 'ctz', "0x0000800000000000", 47);
    354 testUnary('i64', 'ctz', "0x00000000ffffffff", 0);
    355 testUnary('i64', 'ctz', -1, 0);
    356 testUnary('i64', 'ctz', 0, 64);
    357 
    358 testUnary('i64', 'popcnt', 40, 2);
    359 testUnary('i64', 'popcnt', 0, 0);
    360 testUnary('i64', 'popcnt', "0x8000000000000000", 1);
    361 testUnary('i64', 'popcnt', "0x7fffffffffffffff", 63);
    362 testUnary('i64', 'popcnt', "0x4000000000000000", 1);
    363 testUnary('i64', 'popcnt', "0x3000000000000000", 2);
    364 testUnary('i64', 'popcnt', "0x2000000000000000", 1);
    365 testUnary('i64', 'popcnt', "0x1000000000000000", 1);
    366 testUnary('i64', 'popcnt', "0x0030000000000000", 2);
    367 testUnary('i64', 'popcnt', "0x0000800000000000", 1);
    368 testUnary('i64', 'popcnt', "0x00000000ffffffff", 32);
    369 testUnary('i64', 'popcnt', -1, 64);
    370 testUnary('i64', 'popcnt', 0, 0);
    371 
    372 testI64Eqz(40, 0);
    373 testI64Eqz(0, 1);
    374 
    375 wasmAssert(`(module (func $run (param i64) (result i64) (local i64) (local.set 1 (i64.shl (local.get 0) (local.get 0))) (i64.shl (local.get 1) (local.get 1))))`,
    376           [{ type: 'i64', func: '$run', args: ['i64.const 2'], expected: 2048}]);
    377 
    378 // Test MTest's GVN branch inversion.
    379 var testTrunc = wasmEvalText(`(module (func (param f32) (result i32) (if (result i32) (i64.eqz (i64.trunc_f32_s (local.get 0))) (then (i32.const 0)) (else (i32.const 1)))) (export "" (func 0)))`).exports[""];
    380 assertEq(testTrunc(0), 0);
    381 assertEq(testTrunc(13.37), 1);
    382 
    383 wasmAssert(`(module (func $run (result i64) (local i64) (local.set 0 (i64.rem_s (i64.const 1) (i64.const 0xf))) (i64.rem_s (local.get 0) (local.get 0))))`,
    384           [{ type: 'i64', func: '$run', expected: 0 }]);
    385 
    386 wasmFailValidateText('(module (func (param f32) (result i32) (i32.clz (local.get 0))))', mismatchError("f32", "i32"));
    387 wasmFailValidateText('(module (func (param i32) (result f32) (i32.clz (local.get 0))))', mismatchError("i32", "f32"));
    388 wasmFailValidateText('(module (func (param f32) (result f32) (i32.clz (local.get 0))))', mismatchError("f32", "i32"));
    389 
    390 wasmFailValidateText('(module (func (param f32) (param i32) (result i32) (i32.add (local.get 0) (local.get 1))))', mismatchError("f32", "i32"));
    391 wasmFailValidateText('(module (func (param i32) (param f32) (result i32) (i32.add (local.get 0) (local.get 1))))', mismatchError("f32", "i32"));
    392 wasmFailValidateText('(module (func (param i32) (param i32) (result f32) (i32.add (local.get 0) (local.get 1))))', mismatchError("i32", "f32"));
    393 wasmFailValidateText('(module (func (param f32) (param f32) (result f32) (i32.add (local.get 0) (local.get 1))))', mismatchError("f32", "i32"));
    394 
    395 wasmFailValidateText('(module (func (param f32) (param i32) (result i32) (i32.eq (local.get 0) (local.get 1))))', mismatchError("f32", "i32"));
    396 wasmFailValidateText('(module (func (param i32) (param f32) (result i32) (i32.eq (local.get 0) (local.get 1))))', mismatchError("f32", "i32"));
    397 wasmFailValidateText('(module (func (param i32) (param i32) (result f32) (i32.eq (local.get 0) (local.get 1))))', mismatchError("i32", "f32"));