summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-09-23 18:15:14 -0700
committerGitHub <noreply@github.com>2019-09-23 18:15:14 -0700
commit835581f58eb5040656243f7345ebcacf6d7deee5 (patch)
treed5f8878015be2edcdf3d69306c0a8bc20ecd9bf6 /src/js
parentfb217c80c6d9c4b52d90571c435fc52dc868df47 (diff)
downloadbinaryen-835581f58eb5040656243f7345ebcacf6d7deee5.tar.gz
binaryen-835581f58eb5040656243f7345ebcacf6d7deee5.tar.bz2
binaryen-835581f58eb5040656243f7345ebcacf6d7deee5.zip
vNxM.load_splat instructions (#2350)
Introduces a new instruction class, `SIMDLoad`. Implements encoding, decoding, parsing, printing, and interpretation of the load and splat instructions, including in the C and JS APIs. `v128.load` remains in the `Load` instruction class for now because the interpreter code expects a `Load` to be able to load any memory value type.
Diffstat (limited to 'src/js')
-rw-r--r--src/js/binaryen.js-post.js51
1 files changed, 43 insertions, 8 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 3cf3e1197..c82aaaf6d 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -76,6 +76,7 @@ Module['SIMDReplaceId'] = Module['_BinaryenSIMDReplaceId']();
Module['SIMDShuffleId'] = Module['_BinaryenSIMDShuffleId']();
Module['SIMDTernaryId'] = Module['_BinaryenSIMDTernaryId']();
Module['SIMDShiftId'] = Module['_BinaryenSIMDShiftId']();
+Module['SIMDLoadId'] = Module['_BinaryenSIMDLoadId']();
Module['MemoryInitId'] = Module['_BinaryenMemoryInitId']();
Module['DataDropId'] = Module['_BinaryenDataDropId']();
Module['MemoryCopyId'] = Module['_BinaryenMemoryCopyId']();
@@ -394,6 +395,10 @@ Module['ConvertSVecI32x4ToVecF32x4'] = Module['_BinaryenConvertSVecI32x4ToVecF32
Module['ConvertUVecI32x4ToVecF32x4'] = Module['_BinaryenConvertUVecI32x4ToVecF32x4']();
Module['ConvertSVecI64x2ToVecF64x2'] = Module['_BinaryenConvertSVecI64x2ToVecF64x2']();
Module['ConvertUVecI64x2ToVecF64x2'] = Module['_BinaryenConvertUVecI64x2ToVecF64x2']();
+Module['LoadSplatVec8x16'] = Module['_BinaryenLoadSplatVec8x16']();
+Module['LoadSplatVec16x8'] = Module['_BinaryenLoadSplatVec16x8']();
+Module['LoadSplatVec32x4'] = Module['_BinaryenLoadSplatVec32x4']();
+Module['LoadSplatVec64x2'] = Module['_BinaryenLoadSplatVec64x2']();
Module['NarrowSVecI16x8ToVecI8x16'] = Module['_BinaryenNarrowSVecI16x8ToVecI8x16']();
Module['NarrowUVecI16x8ToVecI8x16'] = Module['_BinaryenNarrowUVecI16x8ToVecI8x16']();
Module['NarrowSVecI32x4ToVecI16x8'] = Module['_BinaryenNarrowSVecI32x4ToVecI16x8']();
@@ -1347,14 +1352,6 @@ function wrapModule(module, self) {
}
};
- self['v8x16'] = {
- 'shuffle': function(left, right, mask) {
- return preserveStack(function() {
- return Module['_BinaryenSIMDShuffle'](module, left, right, i8sToStack(mask));
- });
- },
- };
-
self['i8x16'] = {
'splat': function(value) {
return Module['_BinaryenUnary'](module, Module['SplatVecI8x16'], value);
@@ -1814,6 +1811,35 @@ function wrapModule(module, self) {
},
};
+ self['v8x16'] = {
+ 'shuffle': function(left, right, mask) {
+ return preserveStack(function() {
+ return Module['_BinaryenSIMDShuffle'](module, left, right, i8sToStack(mask));
+ });
+ },
+ 'load_splat': function(offset, align, ptr) {
+ return Module['_BinaryenSIMDLoad'](module, Module['LoadSplatVec8x16'], offset, align, ptr);
+ },
+ };
+
+ self['v16x8'] = {
+ 'load_splat': function(offset, align, ptr) {
+ return Module['_BinaryenSIMDLoad'](module, Module['LoadSplatVec16x8'], offset, align, ptr);
+ },
+ };
+
+ self['v32x4'] = {
+ 'load_splat': function(offset, align, ptr) {
+ return Module['_BinaryenSIMDLoad'](module, Module['LoadSplatVec32x4'], offset, align, ptr);
+ },
+ };
+
+ self['v64x2'] = {
+ 'load_splat': function(offset, align, ptr) {
+ return Module['_BinaryenSIMDLoad'](module, Module['LoadSplatVec64x2'], offset, align, ptr);
+ },
+ };
+
self['exnref'] = {
'pop': function() {
return Module['_BinaryenPop'](module, Module['exnref']);
@@ -2452,6 +2478,15 @@ Module['getExpressionInfo'] = function(expr) {
'vec': Module['_BinaryenSIMDShiftGetVec'](expr),
'shift': Module['_BinaryenSIMDShiftGetShift'](expr)
};
+ case Module['SIMDLoadId']:
+ return {
+ 'id': id,
+ 'type': type,
+ 'op': Module['_BinaryenSIMDLoadGetOp'](expr),
+ 'offset': Module['_BinaryenSIMDLoadGetOffset'](expr),
+ 'align': Module['_BinaryenSIMDLoadGetAlign'](expr),
+ 'ptr': Module['_BinaryenSIMDLoadGetPtr'](expr)
+ };
case Module['MemoryInitId']:
return {
'id': id,