tor-browser

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

bug1770335.js (1160B)


      1 // |jit-test| skip-if: !wasmSimdEnabled()
      2 
      3 // Check if GVN indentifies two non-indentical shuffles. During value numbering
      4 // the control field/data might look the same. Shuffle or permute kind, and
      5 // operands order have to be taking into account during value numbering.
      6 // If GVN fails to recognize the following shuffles as different, the v128.xor
      7 // produces zero output.
      8 var ins = wasmEvalText(`(module
      9    (memory (export "memory") 1 1)
     10    (func $test (param v128) (result v128)
     11        local.get 0
     12        v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
     13        i8x16.shuffle 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
     14        v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000
     15        local.get 0
     16        i8x16.shuffle 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
     17        v128.xor
     18    )
     19    (func (export "run")
     20        i32.const 16
     21        i32.const 0
     22        v128.load
     23        call $test
     24        v128.store
     25    )
     26 )`);
     27 
     28 const mem64 = new BigInt64Array(ins.exports.memory.buffer, 0, 4);
     29 mem64[0] = 0x123456789n;
     30 mem64[1] = -0xFDCBA000n;
     31 ins.exports.run();
     32 assertEq(mem64[2], -0xFDCBA000n);
     33 assertEq(mem64[3], 0x123456789n);