WARDuino icon indicating copy to clipboard operation
WARDuino copied to clipboard

SIMD support

Open jay-tux opened this issue 1 year ago • 0 comments

Provides support for the following SIMD instructions (using (dim) as a placeholder for any of i8x16, i16x8, etc):

  • [x] (dim).splat (copy a single scalar value into every lane of a v128)
  • [x] (dim).extract_lane ImmIdx (extract a single lane from a v128)
  • [x] (dim).replace_lane ImmIdx (replace a single lane from a v128)
  • [x] v128.const i128 (construct a v128 from a byte buffer)
  • [x] v128.store memarg (store a v128 to memory)
  • [x] v128.load memarg (load a v128 from memory) All of these instructions are emulated (i.e. they don't use intrinsics or specialized instructions).

Provides debugger support for v128 values when dumping the stack:

  • Values are sent as {"type": "v128", "value": "i64x2.lane0 i64x2.lane1"}. The 128-bit vector is interpreted as 2 64-bit integers (i64x2.lane0 and i64x2.lane1).

Provides additional spec-tests:

  • simd_splat.wast

Implementation notes:

  • This changes sizeof(StackValue) from 16 to 24, as each stack slot now has to accommodate a 16-byte v128 argument
  • v128.load and v128.store each use 2 consecutive i64 fields in memory

Related to #25, #30

jay-tux avatar Oct 03 '24 09:10 jay-tux