Skip to content

relaxed i8x16.swizzle #22

@ngzhian

Description

@ngzhian
  1. What are the instructions being proposed?

relaxed i8x16.swizzle

  1. What are the semantics of these instructions?

relaxed i8x16.swizzle(a, s) selects lanes from a using indices in s, indices in the range [0,15] will select the i-th element of a, the result for any out of range indices is implementation-defined (i.e. if the index is [16-255].

  1. How will these instructions be implemented? Give examples for at least
    x86-64 and ARM64. Also provide reference implementation in terms of 128-bit
    Wasm SIMD.

x86/64, pshufb, out of range indices will return different results:

  • if top bit of index is set, return 0
  • else select the i % 16-th element

ARM/ARM64, vtbl and tbl, out of range indices return 0.

RISC-V V vrgather.vv a, b, out of range return 0 (assuming VEW set to 8, LMUL set to 1, VLEN set to 128, so VLMAX = 16).

Simd128, i8x16.swizzle

  1. How does behavior differ across processors? What new fingerprinting surfaces will be exposed?

Difference between x86/64 and ARM/ARM64

  1. What use cases are there?

Swizzle is quite a common operation, e.g. used in multiple places in meshoptimizer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions