Changes

Jump to: navigation, search

SIMD/Operations

2 bytes added, 17:23, 2 May 2014
Load and Store
To assemble vectors of data that subsequently can be operated upon, SIMD instruction sets include loading instructions, that copy data values from consecutive memory locations into SIMD registers. After completing computation, the contents of SIMD registers can be copied to memory locations using store instructions.
In JavaScript, these instructions need to be exposed to programmers in a convenient way to instantiate SIMD data types, such as, e.g., [[SIMD/Types/uint16x8 |uint16x8]]. This can, for instance , happen by having a constructor that accepts 8 numeric values (and applying clamping etc. as needed):
var myUint16x8 = new uint16x8(1, 2, 3, 4, 5, 6, 8);
This has the distinct disadvantage of being slow, as each data value need needs to be converted to the corresponding scalar data type and written into memory to be accessible for the SIMD load instruction.
A more efficient approach may be to load data values from a fittingly typed [https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView ArrayBufferView], which is backed by a memory region containing data values in a linear fashion, as desired by the SIMD load/store instructions:
51
edits

Navigation menu