From 9c7efb790840df18de25a21c78d7fba5c5b1d1b3 Mon Sep 17 00:00:00 2001 From: dcode Date: Wed, 13 Nov 2019 01:40:48 +0100 Subject: [PATCH 1/2] Add new min/max/dot SIMD instructions --- package-lock.json | 31 +- package.json | 2 +- src/builtins.ts | 78 ++++ src/glue/binaryen.d.ts | 21 + src/module.ts | 13 + std/assembly/builtins.ts | 60 ++- std/assembly/index.d.ts | 422 +++++++++++---------- tests/compiler/features/simd.ts | 104 +++++ tests/compiler/features/simd.untouched.wat | 220 +++++------ 9 files changed, 621 insertions(+), 330 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9025057041..2c4f6830e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "assemblyscript", - "version": "0.7.0", + "version": "0.8.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -434,8 +434,7 @@ "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" }, "asn1.js": { "version": "4.10.1", @@ -572,9 +571,9 @@ "dev": true }, "binaryen": { - "version": "89.0.0-nightly.20191012", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20191012.tgz", - "integrity": "sha512-ipKFZEyrMnFuEPCzEsXZ80DwZhGzrPldQ+vtcyCfdr8O75PKawfll1gmdWg4sUtzjSnfdvK9NiYfzm021lDNUg==" + "version": "89.0.0-nightly.20191112", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20191112.tgz", + "integrity": "sha512-jxVgLf19L4cJFXepTaKjl6PoE9SsZeZstFXWBm1XZjfFbA3G5oh2CPxyDiPKVJlfmhOT1G15YukeBwmCRpsN0A==" }, "bluebird": { "version": "3.7.1", @@ -2771,8 +2770,7 @@ "make-error": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", - "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", - "dev": true + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==" }, "mamacro": { "version": "0.0.3", @@ -2885,8 +2883,7 @@ "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "mississippi": { "version": "3.0.0", @@ -2931,7 +2928,6 @@ "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, "requires": { "minimist": "0.0.8" }, @@ -2939,8 +2935,7 @@ "minimist": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" } } }, @@ -4177,7 +4172,6 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.2.0.tgz", "integrity": "sha512-ZNT+OEGfUNVMGkpIaDJJ44Zq3Yr0bkU/ugN1PHbU+/01Z7UV1fsELRiTx1KuQNvQ1A3pGh3y25iYF6jXgxV21A==", - "dev": true, "requires": { "arrify": "^1.0.0", "buffer-from": "^1.1.0", @@ -4192,8 +4186,7 @@ "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" } } }, @@ -4254,8 +4247,7 @@ "typescript": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.2.tgz", - "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==", - "dev": true + "integrity": "sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ==" }, "union-value": { "version": "1.0.1", @@ -4676,8 +4668,7 @@ "yn": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", - "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", - "dev": true + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=" } } } diff --git a/package.json b/package.json index 433c8a224b..ff74d8c649 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "89.0.0-nightly.20191012", + "binaryen": "89.0.0-nightly.20191112", "glob": "^7.1.5", "long": "^4.0.0", "source-map-support": "^0.5.16", diff --git a/src/builtins.ts b/src/builtins.ts index 69b35cfba9..0578325ec5 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -323,6 +323,7 @@ export namespace BuiltinSymbols { export const v128_all_true = "~lib/builtins/v128.all_true"; export const v128_min = "~lib/builtins/v128.min"; export const v128_max = "~lib/builtins/v128.max"; + export const v128_dot = "~lib/builtins/v128.dot"; export const v128_abs = "~lib/builtins/v128.abs"; export const v128_sqrt = "~lib/builtins/v128.sqrt"; export const v128_eq = "~lib/builtins/v128.eq"; @@ -353,6 +354,10 @@ export namespace BuiltinSymbols { export const i8x16_add = "~lib/builtins/i8x16.add"; export const i8x16_sub = "~lib/builtins/i8x16.sub"; export const i8x16_mul = "~lib/builtins/i8x16.mul"; + export const i8x16_min_s = "~lib/builtins/i8x16.min_s"; + export const i8x16_min_u = "~lib/builtins/i8x16.min_u"; + export const i8x16_max_s = "~lib/builtins/i8x16.max_s"; + export const i8x16_max_u = "~lib/builtins/i8x16.max_u"; export const i8x16_neg = "~lib/builtins/i8x16.neg"; export const i8x16_add_saturate_s = "~lib/builtins/i8x16.add_saturate_s"; export const i8x16_add_saturate_u = "~lib/builtins/i8x16.add_saturate_u"; @@ -383,6 +388,10 @@ export namespace BuiltinSymbols { export const i16x8_add = "~lib/builtins/i16x8.add"; export const i16x8_sub = "~lib/builtins/i16x8.sub"; export const i16x8_mul = "~lib/builtins/i16x8.mul"; + export const i16x8_min_s = "~lib/builtins/i16x8.min_s"; + export const i16x8_min_u = "~lib/builtins/i16x8.min_u"; + export const i16x8_max_s = "~lib/builtins/i16x8.max_s"; + export const i16x8_max_u = "~lib/builtins/i16x8.max_u"; export const i16x8_neg = "~lib/builtins/i16x8.neg"; export const i16x8_add_saturate_s = "~lib/builtins/i16x8.add_saturate_s"; export const i16x8_add_saturate_u = "~lib/builtins/i16x8.add_saturate_u"; @@ -418,6 +427,11 @@ export namespace BuiltinSymbols { export const i32x4_add = "~lib/builtins/i32x4.add"; export const i32x4_sub = "~lib/builtins/i32x4.sub"; export const i32x4_mul = "~lib/builtins/i32x4.mul"; + export const i32x4_min_s = "~lib/builtins/i32x4.min_s"; + export const i32x4_min_u = "~lib/builtins/i32x4.min_u"; + export const i32x4_max_s = "~lib/builtins/i32x4.max_s"; + export const i32x4_max_u = "~lib/builtins/i32x4.max_u"; + export const i32x4_dot_i16x8_s = "~lib/builtins/i32x4.dot_i16x8_s"; export const i32x4_neg = "~lib/builtins/i32x4.neg"; export const i32x4_shl = "~lib/builtins/i32x4.shl"; export const i32x4_shr_s = "~lib/builtins/i32x4.shr_s"; @@ -3332,6 +3346,20 @@ export function compileCall( let arg1 = compiler.compileExpression(operands[1], Type.v128, Constraints.CONV_IMPLICIT); if (!type.is(TypeFlags.REFERENCE)) { switch (type.kind) { + case TypeKind.I8: return module.binary(BinaryOp.MinI8x16, arg0, arg1); + case TypeKind.U8: return module.binary(BinaryOp.MinU8x16, arg0, arg1); + case TypeKind.I16: return module.binary(BinaryOp.MinI16x8, arg0, arg1); + case TypeKind.U16: return module.binary(BinaryOp.MinU16x8, arg0, arg1); + case TypeKind.ISIZE: { + if (compiler.options.isWasm64) break; + // fall-through + } + case TypeKind.I32: return module.binary(BinaryOp.MinI32x4, arg0, arg1); + case TypeKind.USIZE: { + if (compiler.options.isWasm64) break; + // fall-through + } + case TypeKind.U32: return module.binary(BinaryOp.MinU32x4, arg0, arg1); case TypeKind.F32: return module.binary(BinaryOp.MinF32x4, arg0, arg1); case TypeKind.F64: return module.binary(BinaryOp.MinF64x2, arg0, arg1); } @@ -3356,6 +3384,20 @@ export function compileCall( let arg1 = compiler.compileExpression(operands[1], Type.v128, Constraints.CONV_IMPLICIT); if (!type.is(TypeFlags.REFERENCE)) { switch (type.kind) { + case TypeKind.I8: return module.binary(BinaryOp.MaxI8x16, arg0, arg1); + case TypeKind.U8: return module.binary(BinaryOp.MaxU8x16, arg0, arg1); + case TypeKind.I16: return module.binary(BinaryOp.MaxI16x8, arg0, arg1); + case TypeKind.U16: return module.binary(BinaryOp.MaxU16x8, arg0, arg1); + case TypeKind.ISIZE: { + if (compiler.options.isWasm64) break; + // fall-through + } + case TypeKind.I32: return module.binary(BinaryOp.MaxI32x4, arg0, arg1); + case TypeKind.USIZE: { + if (compiler.options.isWasm64) break; + // fall-through + } + case TypeKind.U32: return module.binary(BinaryOp.MaxU32x4, arg0, arg1); case TypeKind.F32: return module.binary(BinaryOp.MaxF32x4, arg0, arg1); case TypeKind.F64: return module.binary(BinaryOp.MaxF64x2, arg0, arg1); } @@ -3366,6 +3408,29 @@ export function compileCall( ); return module.unreachable(); } + case BuiltinSymbols.v128_dot: { // dot(a: v128, b: v128) -> v128 + if ( + checkFeatureEnabled(Feature.SIMD, reportNode, compiler) | + checkTypeRequired(typeArguments, reportNode, compiler) | + checkArgsRequired(operands, 2, reportNode, compiler) + ) { + compiler.currentType = Type.v128; + return module.unreachable(); + } + let type = typeArguments![0]; + let arg0 = compiler.compileExpression(operands[0], Type.v128, Constraints.CONV_IMPLICIT); + let arg1 = compiler.compileExpression(operands[1], Type.v128, Constraints.CONV_IMPLICIT); + if (!type.is(TypeFlags.REFERENCE)) { + switch (type.kind) { + case TypeKind.I16: return module.binary(BinaryOp.DotI16x8, arg0, arg1); + } + } + compiler.error( + DiagnosticCode.Operation_0_cannot_be_applied_to_type_1, + reportNode.typeArgumentsRange, "v128.dot", type.toString() + ); + return module.unreachable(); + } case BuiltinSymbols.v128_eq: { // eq(a: v128, b: v128) -> v128 if ( checkFeatureEnabled(Feature.SIMD, reportNode, compiler) | @@ -4501,6 +4566,10 @@ function tryDeferASM( case BuiltinSymbols.i8x16_add: return deferASM(BuiltinSymbols.v128_add, compiler, Type.i8, operands, Type.v128, reportNode); case BuiltinSymbols.i8x16_sub: return deferASM(BuiltinSymbols.v128_sub, compiler, Type.i8, operands, Type.v128, reportNode); case BuiltinSymbols.i8x16_mul: return deferASM(BuiltinSymbols.v128_mul, compiler, Type.i8, operands, Type.v128, reportNode); + case BuiltinSymbols.i8x16_min_s: return deferASM(BuiltinSymbols.v128_min, compiler, Type.i8, operands, Type.v128, reportNode); + case BuiltinSymbols.i8x16_min_u: return deferASM(BuiltinSymbols.v128_min, compiler, Type.u8, operands, Type.v128, reportNode); + case BuiltinSymbols.i8x16_max_s: return deferASM(BuiltinSymbols.v128_max, compiler, Type.i8, operands, Type.v128, reportNode); + case BuiltinSymbols.i8x16_max_u: return deferASM(BuiltinSymbols.v128_max, compiler, Type.u8, operands, Type.v128, reportNode); case BuiltinSymbols.i8x16_neg: return deferASM(BuiltinSymbols.v128_neg, compiler, Type.i8, operands, Type.v128, reportNode); case BuiltinSymbols.i8x16_add_saturate_s: return deferASM(BuiltinSymbols.v128_add_saturate, compiler, Type.i8, operands, Type.v128, reportNode); case BuiltinSymbols.i8x16_add_saturate_u: return deferASM(BuiltinSymbols.v128_add_saturate, compiler, Type.u8, operands, Type.v128, reportNode); @@ -4531,6 +4600,10 @@ function tryDeferASM( case BuiltinSymbols.i16x8_add: return deferASM(BuiltinSymbols.v128_add, compiler, Type.i16, operands, Type.v128, reportNode); case BuiltinSymbols.i16x8_sub: return deferASM(BuiltinSymbols.v128_sub, compiler, Type.i16, operands, Type.v128, reportNode); case BuiltinSymbols.i16x8_mul: return deferASM(BuiltinSymbols.v128_mul, compiler, Type.i16, operands, Type.v128, reportNode); + case BuiltinSymbols.i16x8_min_s: return deferASM(BuiltinSymbols.v128_min, compiler, Type.i16, operands, Type.v128, reportNode); + case BuiltinSymbols.i16x8_min_u: return deferASM(BuiltinSymbols.v128_min, compiler, Type.u16, operands, Type.v128, reportNode); + case BuiltinSymbols.i16x8_max_s: return deferASM(BuiltinSymbols.v128_max, compiler, Type.i16, operands, Type.v128, reportNode); + case BuiltinSymbols.i16x8_max_u: return deferASM(BuiltinSymbols.v128_max, compiler, Type.u16, operands, Type.v128, reportNode); case BuiltinSymbols.i16x8_neg: return deferASM(BuiltinSymbols.v128_neg, compiler, Type.i16, operands, Type.v128, reportNode); case BuiltinSymbols.i16x8_add_saturate_s: return deferASM(BuiltinSymbols.v128_add_saturate, compiler, Type.i16, operands, Type.v128, reportNode); case BuiltinSymbols.i16x8_add_saturate_u: return deferASM(BuiltinSymbols.v128_add_saturate, compiler, Type.u16, operands, Type.v128, reportNode); @@ -4566,6 +4639,11 @@ function tryDeferASM( case BuiltinSymbols.i32x4_add: return deferASM(BuiltinSymbols.v128_add, compiler, Type.i32, operands, Type.v128, reportNode); case BuiltinSymbols.i32x4_sub: return deferASM(BuiltinSymbols.v128_sub, compiler, Type.i32, operands, Type.v128, reportNode); case BuiltinSymbols.i32x4_mul: return deferASM(BuiltinSymbols.v128_mul, compiler, Type.i32, operands, Type.v128, reportNode); + case BuiltinSymbols.i32x4_min_s: return deferASM(BuiltinSymbols.v128_min, compiler, Type.i32, operands, Type.v128, reportNode); + case BuiltinSymbols.i32x4_min_u: return deferASM(BuiltinSymbols.v128_min, compiler, Type.u32, operands, Type.v128, reportNode); + case BuiltinSymbols.i32x4_max_s: return deferASM(BuiltinSymbols.v128_max, compiler, Type.i32, operands, Type.v128, reportNode); + case BuiltinSymbols.i32x4_max_u: return deferASM(BuiltinSymbols.v128_max, compiler, Type.u32, operands, Type.v128, reportNode); + case BuiltinSymbols.i32x4_dot_i16x8_s: return deferASM(BuiltinSymbols.v128_dot, compiler, Type.i16, operands, Type.v128, reportNode); case BuiltinSymbols.i32x4_neg: return deferASM(BuiltinSymbols.v128_neg, compiler, Type.i32, operands, Type.v128, reportNode); case BuiltinSymbols.i32x4_shl: return deferASM(BuiltinSymbols.v128_shl, compiler, Type.i32, operands, Type.v128, reportNode); case BuiltinSymbols.i32x4_shr_s: return deferASM(BuiltinSymbols.v128_shr, compiler, Type.i32, operands, Type.v128, reportNode); diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index e684fb7d5a..ccc885b66d 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -331,6 +331,10 @@ declare function _BinaryenSubVecI8x16(): BinaryenOp; declare function _BinaryenSubSatSVecI8x16(): BinaryenOp; declare function _BinaryenSubSatUVecI8x16(): BinaryenOp; declare function _BinaryenMulVecI8x16(): BinaryenOp; +declare function _BinaryenMinSVecI8x16(): BinaryenOp; +declare function _BinaryenMinUVecI8x16(): BinaryenOp; +declare function _BinaryenMaxSVecI8x16(): BinaryenOp; +declare function _BinaryenMaxUVecI8x16(): BinaryenOp; declare function _BinaryenNegVecI16x8(): BinaryenOp; declare function _BinaryenAnyTrueVecI16x8(): BinaryenOp; declare function _BinaryenAllTrueVecI16x8(): BinaryenOp; @@ -344,6 +348,10 @@ declare function _BinaryenSubVecI16x8(): BinaryenOp; declare function _BinaryenSubSatSVecI16x8(): BinaryenOp; declare function _BinaryenSubSatUVecI16x8(): BinaryenOp; declare function _BinaryenMulVecI16x8(): BinaryenOp; +declare function _BinaryenMinSVecI16x8(): BinaryenOp; +declare function _BinaryenMinUVecI16x8(): BinaryenOp; +declare function _BinaryenMaxSVecI16x8(): BinaryenOp; +declare function _BinaryenMaxUVecI16x8(): BinaryenOp; declare function _BinaryenNegVecI32x4(): BinaryenOp; declare function _BinaryenAnyTrueVecI32x4(): BinaryenOp; declare function _BinaryenAllTrueVecI32x4(): BinaryenOp; @@ -353,6 +361,11 @@ declare function _BinaryenShrUVecI32x4(): BinaryenOp; declare function _BinaryenAddVecI32x4(): BinaryenOp; declare function _BinaryenSubVecI32x4(): BinaryenOp; declare function _BinaryenMulVecI32x4(): BinaryenOp; +declare function _BinaryenMinSVecI32x4(): BinaryenOp; +declare function _BinaryenMinUVecI32x4(): BinaryenOp; +declare function _BinaryenMaxSVecI32x4(): BinaryenOp; +declare function _BinaryenMaxUVecI32x4(): BinaryenOp; +declare function _BinaryenDotSVecI16x8ToVecI32x4(): BinaryenOp; declare function _BinaryenNegVecI64x2(): BinaryenOp; declare function _BinaryenAnyTrueVecI64x2(): BinaryenOp; declare function _BinaryenAllTrueVecI64x2(): BinaryenOp; @@ -650,6 +663,8 @@ declare type BinaryenFunctionRef = usize; declare function _BinaryenAddFunction(module: BinaryenModuleRef, name: usize, type: BinaryenFunctionTypeRef, varTypes: usize, numVarTypes: BinaryenIndex, body: BinaryenExpressionRef): BinaryenFunctionRef; declare function _BinaryenGetFunction(module: BinaryenModuleRef, name: usize): BinaryenFunctionRef; declare function _BinaryenRemoveFunction(module: BinaryenModuleRef, name: usize): void; +declare function _BinaryenGetNumFunctions(module: BinaryenModuleRef): BinaryenIndex; +declare function _BinaryenGetFunctionByIndex(module: BinaryenModuleRef, index: BinaryenIndex): BinaryenFunctionRef; declare function _BinaryenFunctionGetName(func: BinaryenFunctionRef): usize; declare function _BinaryenFunctionGetType(func: BinaryenFunctionRef): BinaryenFunctionTypeRef; @@ -679,6 +694,8 @@ declare function _BinaryenAddMemoryExport(module: BinaryenModuleRef, internalNam declare function _BinaryenAddGlobalExport(module: BinaryenModuleRef, internalName: usize, externalName: usize): BinaryenExportRef; declare function _BinaryenAddEventExport(module: BinaryenModuleRef, internalName: usize, externalName: usize): BinaryenExportRef; declare function _BinaryenRemoveExport(module: BinaryenModuleRef, externalName: usize): void; +declare function _BinaryenGetNumExports(module: BinaryenModuleRef): BinaryenIndex; +declare function _BinaryenGetExportByIndex(module: BinaryenModuleRef, index: BinaryenIndex): BinaryenExportRef; declare type BinaryenGlobalRef = usize; @@ -700,6 +717,10 @@ declare function _BinaryenEventGetParam(event: BinaryenEventRef, index: Binaryen declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, funcs: usize, numFuncs: BinaryenIndex, offset: BinaryenExpressionRef): void; declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentPassive: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex, shared: bool): void; +declare function _BinaryenGetNumMemorySegments(module: BinaryenModuleRef): BinaryenIndex; +// declare function _BinaryenGetMemorySegmentByteOffset(module: BinaryenModuleRef, index: BinaryenIndex): i64; +declare function _BinaryenGetMemorySegmentByteLength(module: BinaryenModuleRef, id: BinaryenIndex): usize; +declare function _BinaryenCopyMemorySegmentData(module: BinaryenModuleRef, id: BinaryenIndex, buffer: usize): void; declare function _BinaryenSetStart(module: BinaryenModuleRef, start: BinaryenFunctionRef): void; diff --git a/src/module.ts b/src/module.ts index b2a1ee6d97..22e98b4cbb 100644 --- a/src/module.ts +++ b/src/module.ts @@ -333,6 +333,10 @@ export enum BinaryOp { SubSatI8x16 = _BinaryenSubSatSVecI8x16(), SubSatU8x16 = _BinaryenSubSatUVecI8x16(), MulI8x16 = _BinaryenMulVecI8x16(), + MinI8x16 = _BinaryenMinSVecI8x16(), + MinU8x16 = _BinaryenMinUVecI8x16(), + MaxI8x16 = _BinaryenMaxSVecI8x16(), + MaxU8x16 = _BinaryenMaxUVecI8x16(), AddI16x8 = _BinaryenAddVecI16x8(), AddSatI16x8 = _BinaryenAddSatSVecI16x8(), AddSatU16x8 = _BinaryenAddSatUVecI16x8(), @@ -340,9 +344,18 @@ export enum BinaryOp { SubSatI16x8 = _BinaryenSubSatSVecI16x8(), SubSatU16x8 = _BinaryenSubSatUVecI16x8(), MulI16x8 = _BinaryenMulVecI16x8(), + MinI16x8 = _BinaryenMinSVecI16x8(), + MinU16x8 = _BinaryenMinUVecI16x8(), + MaxI16x8 = _BinaryenMaxSVecI16x8(), + MaxU16x8 = _BinaryenMaxUVecI16x8(), AddI32x4 = _BinaryenAddVecI32x4(), SubI32x4 = _BinaryenSubVecI32x4(), MulI32x4 = _BinaryenMulVecI32x4(), + MinI32x4 = _BinaryenMinSVecI32x4(), + MinU32x4 = _BinaryenMinUVecI32x4(), + MaxI32x4 = _BinaryenMaxSVecI32x4(), + MaxU32x4 = _BinaryenMaxUVecI32x4(), + DotI16x8 = _BinaryenDotSVecI16x8ToVecI32x4(), AddI64x2 = _BinaryenAddVecI64x2(), SubI64x2 = _BinaryenSubVecI64x2(), AddF32x4 = _BinaryenAddVecF32x4(), diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index 268bc64f4b..43f2366e73 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -1091,11 +1091,15 @@ export namespace v128 { // @ts-ignore: decorator @builtin - export declare function min(a: v128, b: v128): v128; // f32, f64 only + export declare function min(a: v128, b: v128): v128; // @ts-ignore: decorator @builtin - export declare function max(a: v128, b: v128): v128; // f32, f64 only + export declare function max(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function dot(a: v128, b: v128): v128; // i16 only // @ts-ignore: decorator @builtin @@ -1195,6 +1199,22 @@ export namespace i8x16 { @builtin export declare function mul(a: v128, b: v128): v128; + // @ts-ignore: decorator + @builtin + export declare function min_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function min_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_u(a: v128, b: v128): v128; + // @ts-ignore: decorator @builtin export declare function neg(a: v128): v128; @@ -1318,6 +1338,22 @@ export namespace i16x8 { @builtin export declare function mul(a: v128, b: v128): v128; + // @ts-ignore: decorator + @builtin + export declare function min_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function min_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_u(a: v128, b: v128): v128; + // @ts-ignore: decorator @builtin export declare function neg(a: v128): v128; @@ -1461,6 +1497,26 @@ export namespace i32x4 { @builtin export declare function mul(a: v128, b: v128): v128; + // @ts-ignore: decorator + @builtin + export declare function min_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function min_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_s(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function max_u(a: v128, b: v128): v128; + + // @ts-ignore: decorator + @builtin + export declare function dot_i16x8_s(a: v128, b: v128): v128; + // @ts-ignore: decorator @builtin export declare function neg(a: v128): v128; diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index a841c2fde6..1d4fdddd6e 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -537,91 +537,93 @@ declare namespace f64 { /** Initializes a 128-bit vector from sixteen 8-bit integer values. Arguments must be compile-time constants. */ declare function v128(a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8, i: i8, j: i8, k: i8, l: i8, m: i8, n: i8, o: i8, p: i8): v128; declare namespace v128 { - /** Creates a 128-bit vector with identical lanes. */ + /** Creates a vector with identical lanes. */ export function splat(x: T): v128; - /** Extracts one lane from a 128-bit vector as a scalar. */ + /** Extracts one lane as a scalar. */ export function extract_lane(x: v128, idx: u8): T; - /** Replaces one lane in a 128-bit vector. */ + /** Replaces one lane. */ export function replace_lane(x: v128, idx: u8, value: T): v128; - /** Selects lanes from either 128-bit vector according to the specified lane indexes. */ + /** Selects lanes from either vector according to the specified lane indexes. */ export function shuffle(a: v128, b: v128, ...lanes: u8[]): v128; - /** Selects 8-bit lanes from the first 128-bit vector according to the indexes [0-15] specified by the 8-bit lanes of the second 128-bit vector. */ + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ export function swizzle(a: v128, s: v128): v128; - /** Loads a 128-bit vector from memory. */ + /** Loads a vector from memory. */ export function load(ptr: usize, immOffset?: usize, immAlign?: usize): v128; - /** Creates a 128-bit vector with identical lanes by loading the splatted value. */ + /** Creates a vector with identical lanes by loading the splatted value. */ export function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128 - /** Creates a 128-bit vector by loading the lanes of the specified type and extending each to the next larger type. */ + /** Creates a vector by loading the lanes of the specified type and extending each to the next larger type. */ export function load_ext(ptr: usize, immOffset?: usize, immAlign?: usize): v128 - /** Stores a 128-bit vector to memory. */ + /** Stores a vector to memory. */ export function store(ptr: usize, value: v128, immOffset?: usize, immAlign?: usize): void; - /** Adds each lane of two 128-bit vectors. */ + /** Adds each lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each lane of two 128-bit vectors. */ + /** Subtracts each lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each lane of two 128-bit vectors. */ + /** Multiplies each lane. */ export function mul(a: v128, b: v128): v128; // except i64 - /** Divides each lane of two 128-bit vectors. */ + /** Divides each lane. */ export function div(a: v128, b: v128): v128; - /** Negates each lane of a 128-bit vector. */ + /** Negates each lane of a vector. */ export function neg(a: v128): v128; - /** Adds each lane of two 128-bit vectors using saturation. */ + /** Adds each lane using saturation. */ export function add_saturate(a: v128, b: v128): v128; - /** Subtracts each lane of two 128-bit vectors using saturation. */ + /** Subtracts each lane using saturation. */ export function sub_saturate(a: v128, b: v128): v128; - /** Performs a bitwise left shift on each lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise left shift on each lane of a vector by a scalar. */ export function shl(a: v128, b: i32): v128; - /** Performs a bitwise right shift on each lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise right shift on each lane of a vector by a scalar. */ export function shr(a: v128, b: i32): v128; - /** Performs the bitwise AND operation on two 128-bit vectors. */ + /** Performs the bitwise AND operation on two vectors. */ export function and(a: v128, b: v128): v128; - /** Performs the bitwise OR operation on two 128-bit vectors. */ + /** Performs the bitwise OR operation on two vectors. */ export function or(a: v128, b: v128): v128; - /** Performs the bitwise XOR operation on two 128-bit vectors. */ + /** Performs the bitwise XOR operation on two vectors. */ export function xor(a: v128, b: v128): v128; - /** Performs the bitwise ANDNOT operation on two 128-bit vectors. */ + /** Performs the bitwise ANDNOT operation on two vectors. */ export function andnot(a: v128, b: v128): v128; - /** Performs the bitwise NOT operation on a 128-bit vector. */ + /** Performs the bitwise NOT operation on a vector. */ export function not(a: v128): v128; - /** Selects bits of either 128-bit vector according to the specified mask. */ + /** Selects bits of either vector according to the specified mask. */ export function bitselect(v1: v128, v2: v128, mask: v128): v128; - /** Reduces a 128-bit vector to a scalar indicating whether any lane is considered `true`. */ + /** Reduces a vector to a scalar indicating whether any lane is considered `true`. */ export function any_true(a: v128): bool; - /** Reduces a 128-bit vector to a scalar indicating whether all lanes are considered `true`. */ + /** Reduces a vector to a scalar indicating whether all lanes are considered `true`. */ export function all_true(a: v128): bool; - /** Computes the minimum of each lane of two 128-bit vectors. */ - export function min(a: v128, b: v128): v128; - /** Computes the maximum of each lane of two 128-bit vectors. */ - export function max(a: v128, b: v128): v128; - /** Computes the absolute value of each lane of a 128-bit vector. */ + /** Computes the minimum of each lane. */ + export function min(a: v128, b: v128): v128; + /** Computes the maximum of each lane. */ + export function max(a: v128, b: v128): v128; + /** Computes the dot product of two lanes each, yielding lanes one size wider than the input. */ + export function dot(a: v128, b: v128): v128; + /** Computes the absolute value of each lane. */ export function abs(a: v128): v128; - /** Computes the square root of each lane of a 128-bit vector. */ + /** Computes the square root of each lane. */ export function sqrt(a: v128): v128; - /** Computes which lanes of two 128-bit vectors are equal. */ + /** Computes which lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which lanes of two 128-bit vectors are not equal. */ + /** Computes which lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which lanes of the first vector are less than those of the second. */ export function lt(a: v128, b: v128): v128; - /** Computes which lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which lanes of the first vector are less than or equal those of the second. */ export function le(a: v128, b: v128): v128; - /** Computes which lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which lanes of the first vector are greater than those of the second. */ export function gt(a: v128, b: v128): v128; - /** Computes which lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which lanes of the first vector are greater than or equal those of the second. */ export function ge(a: v128, b: v128): v128; - /** Converts each lane of a 128-bit vector from integer to floating point. */ + /** Converts each lane of a vector from integer to floating point. */ export function convert(a: v128): v128; - /** Truncates each lane of a 128-bit vector from floating point to integer with saturation. Takes the target type. */ + /** Truncates each lane of a vector from floating point to integer with saturation. Takes the target type. */ export function trunc_sat(a: v128): v128; - /** Narrows each lane of two 128-bit vectors to their respective narrower lanes. */ + /** Narrows each lane to their respective narrower lanes. */ export function narrow(a: v128, b: v128): v128; - /** Widens the low lanes of a 128-bit vector to their respective wider lanes. */ + /** Widens the low lanes of a vector to their respective wider lanes. */ export function widen_low(a: v128): v128; - /** Widens the high lanes of a 128-bit vector to their respective wider lanes. */ + /** Widens the high lanes of a vector to their respective wider lanes. */ export function widen_high(a: v128): v128; - /** Computes `(a * b) + c` for each lane of the given 128-bit vectors. */ + /** Computes `(a * b) + c` for each lane. */ export function qfma(a: v128, b: v128, c: v128): v128; - /** Computes `(a * b) - c` for each lane of the given 128-bit vectors. */ + /** Computes `(a * b) - c` for each lane. */ export function qfms(a: v128, b: v128, c: v128): v128; } /** Initializes a 128-bit vector from sixteen 8-bit integer values. Arguments must be compile-time constants. */ @@ -629,61 +631,69 @@ declare function i8x16(a: i8, b: i8, c: i8, d: i8, e: i8, f: i8, g: i8, h: i8, i declare namespace i8x16 { /** Creates a vector with sixteen identical 8-bit integer lanes. */ export function splat(x: i8): v128; - /** Extracts one 8-bit integer lane from a 128-bit vector as a signed scalar. */ + /** Extracts one 8-bit integer lane as a signed scalar. */ export function extract_lane_s(x: v128, idx: u8): i8; - /** Extracts one 8-bit integer lane from a 128-bit vector as an unsigned scalar. */ + /** Extracts one 8-bit integer lane as an unsigned scalar. */ export function extract_lane_u(x: v128, idx: u8): u8; - /** Replaces one 8-bit integer lane in a 128-bit vector. */ + /** Replaces one 8-bit integer lane. */ export function replace_lane(x: v128, idx: u8, value: i8): v128; - /** Adds each 8-bit integer lane of two 128-bit vectors. */ + /** Adds each 8-bit integer lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 8-bit integer lane of two 128-bit vectors. */ + /** Subtracts each 8-bit integer lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 8-bit integer lane of two 128-bit vectors. */ + /** Multiplies each 8-bit integer lane. */ export function mul(a: v128, b: v128): v128; - /** Negates each 8-bit integer lane of a 128-bit vector. */ + /** Computes the signed minimum of each 8-bit integer lane. */ + export function min_s(a: v128, b: v128): v128; + /** Computes the unsigned minimum of each 8-bit integer lane. */ + export function min_u(a: v128, b: v128): v128; + /** Computes the signed maximum of each 8-bit integer lane. */ + export function max_s(a: v128, b: v128): v128; + /** Computes the unsigned maximum of each 8-bit integer lane. */ + export function max_u(a: v128, b: v128): v128; + /** Negates each 8-bit integer lane. */ export function neg(a: v128): v128; - /** Adds each 8-bit integer lane of two 128-bit vectors using signed saturation. */ + /** Adds each 8-bit integer lane using signed saturation. */ export function add_saturate_s(a: v128, b: v128): v128; - /** Adds each 8-bit integer lane of two 128-bit vectors using unsigned saturation. */ + /** Adds each 8-bit integer lane using unsigned saturation. */ export function add_saturate_u(a: v128, b: v128): v128; - /** Subtracts each 8-bit integer lane of two 128-bit vectors using signed saturation. */ + /** Subtracts each 8-bit integer lane using signed saturation. */ export function sub_saturate_s(a: v128, b: v128): v128; - /** Subtracts each 8-bit integer lane of two 128-bit vectors using unsigned saturation. */ + /** Subtracts each 8-bit integer lane using unsigned saturation. */ export function sub_saturate_u(a: v128, b: v128): v128; - /** Performs a bitwise left shift on each 8-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise left shift on each 8-bit integer lane by a scalar. */ export function shl(a: v128, b: i32): v128; - /** Performs a bitwise arithmetic right shift on each 8-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise arithmetic right shift on each 8-bit integer lane by a scalar. */ export function shr_s(a: v128, b: i32): v128; - /** Performs a bitwise logical right shift on each 8-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise logical right shift on each 8-bit integer lane by a scalar. */ export function shr_u(a: v128, b: i32): v128; - /** Reduces a 128-bit vector to a scalar indicating whether any 8-bit integer lane is considered `true`. */ + /** Reduces a vector to a scalar indicating whether any 8-bit integer lane is considered `true`. */ export function any_true(a: v128): bool; - /** Reduces a 128-bit vector to a scalar indicating whether all 8-bit integer lanes are considered `true`. */ + /** Reduces a vector to a scalar indicating whether all 8-bit integer lanes are considered `true`. */ export function all_true(a: v128): bool; - /** Computes which 8-bit integer lanes of two 128-bit vectors are equal. */ + /** Computes which 8-bit integer lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which 8-bit integer lanes of two 128-bit vectors are not equal. */ + /** Computes which 8-bit integer lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which 8-bit signed integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 8-bit signed integer lanes of the first vector are less than those of the second. */ export function lt_s(a: v128, b: v128): v128; - /** Computes which 8-bit unsigned integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 8-bit unsigned integer lanes of the first vector are less than those of the second. */ export function lt_u(a: v128, b: v128): v128; - /** Computes which 8-bit signed integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 8-bit signed integer lanes of the first vector are less than or equal those of the second. */ export function le_s(a: v128, b: v128): v128; - /** Computes which 8-bit unsigned integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 8-bit unsigned integer lanes of the first vector are less than or equal those of the second. */ export function le_u(a: v128, b: v128): v128; - /** Computes which 8-bit signed integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 8-bit signed integer lanes of the first vector are greater than those of the second. */ export function gt_s(a: v128, b: v128): v128; - /** Computes which 8-bit unsigned integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 8-bit unsigned integer lanes of the first vector are greater than those of the second. */ export function gt_u(a: v128, b: v128): v128; - /** Computes which 8-bit signed integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 8-bit signed integer lanes of the first vector are greater than or equal those of the second. */ export function ge_s(a: v128, b: v128): v128; - /** Computes which 8-bit unsigned integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 8-bit unsigned integer lanes of the first vector are greater than or equal those of the second. */ export function ge_u(a: v128, b: v128): v128; - /** Narrows each 16-bit signed integer lane of two 128-bit vectors to 8-bit signed integer lanes. */ + /** Narrows each 16-bit signed integer lane to 8-bit signed integer lanes. */ export function narrow_i16x8_s(a: v128, b: v128): v128; - /** Narrows each 16-bit signed integer lane of two 128-bit vectors to 8-bit unsigned integer lanes. */ + /** Narrows each 16-bit signed integer lane to 8-bit unsigned integer lanes. */ export function narrow_i16x8_u(a: v128, b: v128): v128; } /** Initializes a 128-bit vector from eight 16-bit integer values. Arguments must be compile-time constants. */ @@ -691,69 +701,77 @@ declare function i16x8(a: i16, b: i16, c: i16, d: i16, e: i16, f: i16, g: i16, h declare namespace i16x8 { /** Creates a vector with eight identical 16-bit integer lanes. */ export function splat(x: i16): v128; - /** Extracts one 16-bit integer lane from a 128-bit vector as a signed scalar. */ + /** Extracts one 16-bit integer lane as a signed scalar. */ export function extract_lane_s(x: v128, idx: u8): i16; - /** Extracts one 16-bit integer lane from a 128-bit vector as an unsigned scalar. */ + /** Extracts one 16-bit integer lane as an unsigned scalar. */ export function extract_lane_u(x: v128, idx: u8): u16; - /** Replaces one 16-bit integer lane in a 128-bit vector. */ + /** Replaces one 16-bit integer lane. */ export function replace_lane(x: v128, idx: u8, value: i16): v128; - /** Adds each 16-bit integer lane of two 128-bit vectors. */ + /** Adds each 16-bit integer lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 16-bit integer lane of two 128-bit vectors. */ + /** Subtracts each 16-bit integer lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 16-bit integer lane of two 128-bit vectors. */ + /** Multiplies each 16-bit integer lane. */ export function mul(a: v128, b: v128): v128; - /** Negates each 16-bit integer lane of a 128-bit vector. */ + /** Computes the signed minimum of each 16-bit integer lane. */ + export function min_s(a: v128, b: v128): v128; + /** Computes the unsigned minimum of each 16-bit integer lane. */ + export function min_u(a: v128, b: v128): v128; + /** Computes the signed maximum of each 16-bit integer lane. */ + export function max_s(a: v128, b: v128): v128; + /** Computes the unsigned maximum of each 16-bit integer lane. */ + export function max_u(a: v128, b: v128): v128; + /** Negates each 16-bit integer lane. */ export function neg(a: v128): v128; - /** Adds each 16-bit integer lane of two 128-bit vectors using signed saturation. */ + /** Adds each 16-bit integer lane using signed saturation. */ export function add_saturate_s(a: v128, b: v128): v128; - /** Adds each 16-bit integer lane of two 128-bit vectors using unsigned saturation. */ + /** Adds each 16-bit integer lane using unsigned saturation. */ export function add_saturate_u(a: v128, b: v128): v128; - /** Subtracts each 16-bit integer lane of two 128-bit vectors using signed saturation. */ + /** Subtracts each 16-bit integer lane using signed saturation. */ export function sub_saturate_s(a: v128, b: v128): v128; - /** Subtracts each 16-bit integer lane of two 128-bit vectors using unsigned saturation. */ + /** Subtracts each 16-bit integer lane using unsigned saturation. */ export function sub_saturate_u(a: v128, b: v128): v128; - /** Performs a bitwise left shift on each 16-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise left shift on each 16-bit integer lane by a scalar. */ export function shl(a: v128, b: i32): v128; - /** Performs a bitwise arithmetic right shift each 16-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise arithmetic right shift each 16-bit integer lane by a scalar. */ export function shr_s(a: v128, b: i32): v128; - /** Performs a bitwise logical right shift on each 16-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise logical right shift on each 16-bit integer lane by a scalar. */ export function shr_u(a: v128, b: i32): v128; - /** Reduces a 128-bit vector to a scalar indicating whether any 16-bit integer lane is considered `true`. */ + /** Reduces a vector to a scalar indicating whether any 16-bit integer lane is considered `true`. */ export function any_true(a: v128): bool; - /** Reduces a 128-bit vector to a scalar indicating whether all 16-bit integer lanes are considered `true`. */ + /** Reduces a vector to a scalar indicating whether all 16-bit integer lanes are considered `true`. */ export function all_true(a: v128): bool; - /** Computes which 16-bit integer lanes of two 128-bit vectors are equal. */ + /** Computes which 16-bit integer lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which 16-bit integer lanes of two 128-bit vectors are not equal. */ + /** Computes which 16-bit integer lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which 16-bit signed integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 16-bit signed integer lanes of the first vector are less than those of the second. */ export function lt_s(a: v128, b: v128): v128; - /** Computes which 16-bit unsigned integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 16-bit unsigned integer lanes of the first vector are less than those of the second. */ export function lt_u(a: v128, b: v128): v128; - /** Computes which 16-bit signed integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 16-bit signed integer lanes of the first vector are less than or equal those of the second. */ export function le_s(a: v128, b: v128): v128; - /** Computes which 16-bit unsigned integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 16-bit unsigned integer lanes of the first vector are less than or equal those of the second. */ export function le_u(a: v128, b: v128): v128; - /** Computes which 16-bit signed integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 16-bit signed integer lanes of the first vector are greater than those of the second. */ export function gt_s(a: v128, b: v128): v128; - /** Computes which 16-bit unsigned integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 16-bit unsigned integer lanes of the first vector are greater than those of the second. */ export function gt_u(a: v128, b: v128): v128; - /** Computes which 16-bit signed integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 16-bit signed integer lanes of the first vector are greater than or equal those of the second. */ export function ge_s(a: v128, b: v128): v128; - /** Computes which 16-bit unsigned integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 16-bit unsigned integer lanes of the first vector are greater than or equal those of the second. */ export function ge_u(a: v128, b: v128): v128; - /** Narrows each 32-bit signed integer lane of two 128-bit vectors to 16-bit signed integer lanes. */ + /** Narrows each 32-bit signed integer lane to 16-bit signed integer lanes. */ export function narrow_i32x4_s(a: v128, b: v128): v128; - /** Narrows each 32-bit signed integer lane of two 128-bit vectors to 16-bit unsigned integer lanes. */ + /** Narrows each 32-bit signed integer lane to 16-bit unsigned integer lanes. */ export function narrow_i32x4_u(a: v128, b: v128): v128; - /** Widens the low 8-bit signed integer lanes of a 128-bit vector to 16-bit signed integer lanes. */ + /** Widens the low 8-bit signed integer lanes to 16-bit signed integer lanes. */ export function widen_low_i8x16_s(a: v128): v128; - /** Widens the low 8-bit unsigned integer lanes of a 128-bit vector to 16-bit unsigned integer lanes. */ + /** Widens the low 8-bit unsigned integer lanes to 16-bit unsigned integer lanes. */ export function widen_low_i8x16_u(a: v128): v128; - /** Widens the high 8-bit signed integer lanes of a 128-bit vector to 16-bit signed integer lanes. */ + /** Widens the high 8-bit signed integer lanes to 16-bit signed integer lanes. */ export function widen_high_i8x16_s(a: v128): v128; - /** Widens the high 8-bit unsigned integer lanes of a 128-bit vector to 16-bit unsigned integer lanes. */ + /** Widens the high 8-bit unsigned integer lanes to 16-bit unsigned integer lanes. */ export function widen_high_i8x16_u(a: v128): v128; /** Creates a vector with eight 16-bit integer lanes by loading and sign extending eight 8-bit integers. */ export function load8x8_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128; @@ -763,61 +781,71 @@ declare namespace i16x8 { /** Initializes a 128-bit vector from four 32-bit integer values. Arguments must be compile-time constants. */ declare function i32x4(a: i32, b: i32, c: i32, d: i32): v128; declare namespace i32x4 { - /** Creates a 128-bit vector with four identical 32-bit integer lanes. */ + /** Creates a vector with four identical 32-bit integer lanes. */ export function splat(x: i32): v128; - /** Extracts one 32-bit integer lane from a 128-bit vector as a scalar. */ + /** Extracts one 32-bit integer lane as a scalar. */ export function extract_lane(x: v128, idx: u8): i32; - /** Replaces one 32-bit integer lane in a 128-bit vector. */ + /** Replaces one 32-bit integer lane. */ export function replace_lane(x: v128, idx: u8, value: i32): v128; - /** Adds each 32-bit integer lane of two 128-bit vectors. */ + /** Adds each 32-bit integer lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 32-bit integer lane of two 128-bit vectors. */ + /** Subtracts each 32-bit integer lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 32-bit integer lane of two 128-bit vectors. */ + /** Multiplies each 32-bit integer lane. */ export function mul(a: v128, b: v128): v128; - /** Negates each 32-bit integer lane of a 128-bit vector. */ + /** Computes the signed minimum of each 32-bit integer lane. */ + export function min_s(a: v128, b: v128): v128; + /** Computes the unsigned minimum of each 32-bit integer lane. */ + export function min_u(a: v128, b: v128): v128; + /** Computes the signed maximum of each 32-bit integer lane. */ + export function max_s(a: v128, b: v128): v128; + /** Computes the unsigned maximum of each 32-bit integer lane. */ + export function max_u(a: v128, b: v128): v128; + /** Computes the dot product of two 16-bit integer lanes each, yielding 32-bit integer lanes. */ + export function dot_i16x8_s(a: v128, b: v128): v128; + /** Negates each 32-bit integer lane. */ export function neg(a: v128): v128; - /** Performs a bitwise left shift on each 32-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise left shift on each 32-bit integer lane by a scalar. */ export function shl(a: v128, b: i32): v128; - /** Performs a bitwise arithmetic right shift on each 32-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise arithmetic right shift on each 32-bit integer lane by a scalar. */ export function shr_s(a: v128, b: i32): v128; - /** Performs a bitwise logical right shift on each 32-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise logical right shift on each 32-bit integer lane by a scalar. */ export function shr_u(a: v128, b: i32): v128; - /** Reduces a 128-bit vector to a scalar indicating whether any 32-bit integer lane is considered `true`. */ + /** Reduces a vector to a scalar indicating whether any 32-bit integer lane is considered `true`. */ export function any_true(a: v128): bool; - /** Reduces a 128-bit vector to a scalar indicating whether all 32-bit integer lanes are considered `true`. */ + /** Reduces a vector to a scalar indicating whether all 32-bit integer lanes are considered `true`. */ export function all_true(a: v128): bool; - /** Computes which 32-bit integer lanes of two 128-bit vectors are equal. */ + /** Computes which 32-bit integer lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which 32-bit integer lanes of two 128-bit vectors are not equal. */ + /** Computes which 32-bit integer lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which 32-bit signed integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 32-bit signed integer lanes of the first vector are less than those of the second. */ export function lt_s(a: v128, b: v128): v128; - /** Computes which 32-bit unsigned integer lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 32-bit unsigned integer lanes of the first vector are less than those of the second. */ export function lt_u(a: v128, b: v128): v128; - /** Computes which 32-bit signed integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 32-bit signed integer lanes of the first vector are less than or equal those of the second. */ export function le_s(a: v128, b: v128): v128; - /** Computes which 32-bit unsigned integer lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 32-bit unsigned integer lanes of the first vector are less than or equal those of the second. */ export function le_u(a: v128, b: v128): v128; - /** Computes which 32-bit signed integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 32-bit signed integer lanes of the first vector are greater than those of the second. */ export function gt_s(a: v128, b: v128): v128; - /** Computes which 32-bit unsigned integer lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 32-bit unsigned integer lanes of the first vector are greater than those of the second. */ export function gt_u(a: v128, b: v128): v128; - /** Computes which 32-bit signed integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 32-bit signed integer lanes of the first vector are greater than or equal those of the second. */ export function ge_s(a: v128, b: v128): v128; - /** Computes which 32-bit unsigned integer lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 32-bit unsigned integer lanes of the first vector are greater than or equal those of the second. */ export function ge_u(a: v128, b: v128): v128; - /** Truncates each 32-bit float lane of a 128-bit vector to a signed integer with saturation. */ + /** Truncates each 32-bit float lane to a signed integer with saturation. */ export function trunc_sat_f32x4_s(a: v128): v128; - /** Truncates each 32-bit float lane of a 128-bit vector to an unsigned integer with saturation. */ + /** Truncates each 32-bit float lane to an unsigned integer with saturation. */ export function trunc_sat_f32x4_u(a: v128): v128; - /** Widens the low 16-bit signed integer lanes of a 128-bit vector to 32-bit signed integer lanes. */ + /** Widens the low 16-bit signed integer lanes to 32-bit signed integer lanes. */ export function widen_low_i16x8_s(a: v128): v128; - /** Widens the low 16-bit unsigned integer lanes of a 128-bit vector to 32-bit unsigned integer lanes. */ + /** Widens the low 16-bit unsigned integer lane to 32-bit unsigned integer lanes. */ export function widen_low_i16x8_u(a: v128): v128; - /** Widens the high 16-bit signed integer lanes of a 128-bit vector to 32-bit signed integer lanes. */ + /** Widens the high 16-bit signed integer lanes to 32-bit signed integer lanes. */ export function widen_high_i16x8_s(a: v128): v128; - /** Widens the high 16-bit unsigned integer lanes of a 128-bit vector to 32-bit unsigned integer lanes. */ + /** Widens the high 16-bit unsigned integer lanes to 32-bit unsigned integer lanes. */ export function widen_high_i16x8_u(a: v128): v128; /** Creates a vector with four 32-bit integer lanes by loading and sign extending four 16-bit integers. */ export function load16x4_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128; @@ -827,33 +855,33 @@ declare namespace i32x4 { /** Initializes a 128-bit vector from two 64-bit integer values. Arguments must be compile-time constants. */ declare function i64x2(a: i64, b: i64): v128; declare namespace i64x2 { - /** Creates a 128-bit vector with two identical 64-bit integer lanes. */ + /** Creates a vector with two identical 64-bit integer lanes. */ export function splat(x: i64): v128; - /** Extracts one 64-bit integer lane from a 128-bit vector as a scalar. */ + /** Extracts one 64-bit integer lane as a scalar. */ export function extract_lane(x: v128, idx: u8): i64; - /** Replaces one 64-bit integer lane in a 128-bit vector. */ + /** Replaces one 64-bit integer lane. */ export function replace_lane(x: v128, idx: u8, value: i64): v128; - /** Adds each 64-bit integer lane of two 128-bit vectors. */ + /** Adds each 64-bit integer lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 64-bit integer lane of two 128-bit vectors. */ + /** Subtracts each 64-bit integer lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 64-bit integer lane of two 128-bit vectors. */ + /** Multiplies each 64-bit integer lane. */ export function mul(a: v128, b: v128): v128; - /** Negates each 64-bit integer lane of a 128-bit vector. */ + /** Negates each 64-bit integer lane. */ export function neg(a: v128): v128; - /** Performs a bitwise left shift on each 64-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise left shift on each 64-bit integer lane by a scalar. */ export function shl(a: v128, b: i32): v128; - /** Performs a bitwise arithmetic right shift on each 64-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise arithmetic right shift on each 64-bit integer lane by a scalar. */ export function shr_s(a: v128, b: i32): v128; - /** Performs a bitwise logical right shift on each 64-bit integer lane of a 128-bit vector by a scalar. */ + /** Performs a bitwise logical right shift on each 64-bit integer lane by a scalar. */ export function shr_u(a: v128, b: i32): v128; - /** Reduces a 128-bit vector to a scalar indicating whether any 64-bit integer lane is considered `true`. */ + /** Reduces a vector to a scalar indicating whether any 64-bit integer lane is considered `true`. */ export function any_true(a: v128): bool; - /** Reduces a 128-bit vector to a scalar indicating whether all 64-bit integer lanes are considered `true`. */ + /** Reduces a vector to a scalar indicating whether all 64-bit integer lanes are considered `true`. */ export function all_true(a: v128): bool; - /** Truncates each 64-bit float lane of a 128-bit vector to a signed integer with saturation. */ + /** Truncates each 64-bit float lane to a signed integer with saturation. */ export function trunc_sat_f64x2_s(a: v128): v128; - /** Truncates each 64-bit float lane of a 128-bit vector to an unsigned integer with saturation. */ + /** Truncates each 64-bit float lane to an unsigned integer with saturation. */ export function trunc_sat_f64x2_u(a: v128): v128; /** Creates a vector with two 64-bit integer lanes by loading and sign extending two 32-bit integers. */ export function load32x2_s(ptr: usize, immOffset?: u32, immAlign?: u32): v128; @@ -863,117 +891,117 @@ declare namespace i64x2 { /** Initializes a 128-bit vector from four 32-bit float values. Arguments must be compile-time constants. */ declare function f32x4(a: f32, b: f32, c: f32, d: f32): v128; declare namespace f32x4 { - /** Creates a 128-bit vector with four identical 32-bit float lanes. */ + /** Creates a vector with four identical 32-bit float lanes. */ export function splat(x: f32): v128; - /** Extracts one 32-bit float lane from a 128-bit vector as a scalar. */ + /** Extracts one 32-bit float lane as a scalar. */ export function extract_lane(x: v128, idx: u8): f32; - /** Replaces one 32-bit float lane in a 128-bit vector. */ + /** Replaces one 32-bit float lane. */ export function replace_lane(x: v128, idx: u8, value: f32): v128; - /** Adds each 32-bit float lane of two 128-bit vectors. */ + /** Adds each 32-bit float lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 32-bit float lane of two 128-bit vectors. */ + /** Subtracts each 32-bit float lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 32-bit float lane of two 128-bit vectors. */ + /** Multiplies each 32-bit float lane. */ export function mul(a: v128, b: v128): v128; - /** Divides each 32-bit float lane of two 128-bit vectors. */ + /** Divides each 32-bit float lane. */ export function div(a: v128, b: v128): v128; - /** Negates each 32-bit float lane of a 128-bit vector. */ + /** Negates each 32-bit float lane. */ export function neg(a: v128): v128; - /** Computes the minimum of each 32-bit float lane of two 128-bit vectors. */ + /** Computes the minimum of each 32-bit float lane. */ export function min(a: v128, b: v128): v128; - /** Computes the maximum of each 32-bit float lane of two 128-bit vectors. */ + /** Computes the maximum of each 32-bit float lane. */ export function max(a: v128, b: v128): v128; - /** Computes the absolute value of each 32-bit float lane of a 128-bit vector. */ + /** Computes the absolute value of each 32-bit float lane. */ export function abs(a: v128): v128; - /** Computes the square root of each 32-bit float lane of a 128-bit vector. */ + /** Computes the square root of each 32-bit float lane. */ export function sqrt(a: v128): v128; - /** Computes which 32-bit float lanes of two 128-bit vectors are equal. */ + /** Computes which 32-bit float lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which 32-bit float lanes of two 128-bit vectors are not equal. */ + /** Computes which 32-bit float lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which 32-bit float lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 32-bit float lanes of the first vector are less than those of the second. */ export function lt(a: v128, b: v128): v128; - /** Computes which 32-bit float lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 32-bit float lanes of the first vector are less than or equal those of the second. */ export function le(a: v128, b: v128): v128; - /** Computes which 32-bit float lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 32-bit float lanes of the first vector are greater than those of the second. */ export function gt(a: v128, b: v128): v128; - /** Computes which 32-bit float lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 32-bit float lanes of the first vector are greater than or equal those of the second. */ export function ge(a: v128, b: v128): v128; - /** Converts each 32-bit signed integer lane of a 128-bit vector to floating point. */ + /** Converts each 32-bit signed integer lane of a vector to floating point. */ export function convert_i32x4_s(a: v128): v128; - /** Converts each 32-bit unsigned integer lane of a 128-bit vector to floating point. */ + /** Converts each 32-bit unsigned integer lane of a vector to floating point. */ export function convert_i32x4_u(a: v128): v128; - /** Computes `(a * b) + c` for each 32-bit float lane of the given 128-bit vectors. */ + /** Computes `(a * b) + c` for each 32-bit float lane. */ export function qfma(a: v128, b: v128, c: v128): v128; - /** Computes `(a * b) - c` for each 32-bit float lane of the given 128-bit vectors. */ + /** Computes `(a * b) - c` for each 32-bit float lane. */ export function qfms(a: v128, b: v128, c: v128): v128; } /** Initializes a 128-bit vector from two 64-bit float values. Arguments must be compile-time constants. */ declare function f64x2(a: f64, b: f64): v128; declare namespace f64x2 { - /** Creates a 128-bit vector with two identical 64-bit float lanes. */ + /** Creates a vector with two identical 64-bit float lanes. */ export function splat(x: f64): v128; - /** Extracts one 64-bit float lane from a 128-bit vector as a scalar. */ + /** Extracts one 64-bit float lane as a scalar. */ export function extract_lane(x: v128, idx: u8): f64; - /** Replaces one 64-bit float lane in a 128-bit vector. */ + /** Replaces one 64-bit float lane. */ export function replace_lane(x: v128, idx: u8, value: f64): v128; - /** Adds each 64-bit float lane of two 128-bit vectors. */ + /** Adds each 64-bit float lane. */ export function add(a: v128, b: v128): v128; - /** Subtracts each 64-bit float lane of two 128-bit vectors. */ + /** Subtracts each 64-bit float lane. */ export function sub(a: v128, b: v128): v128; - /** Multiplies each 64-bit float lane of two 128-bit vectors. */ + /** Multiplies each 64-bit float lane. */ export function mul(a: v128, b: v128): v128; - /** Divides each 64-bit float lane of two 128-bit vectors. */ + /** Divides each 64-bit float lane. */ export function div(a: v128, b: v128): v128; - /** Negates each 64-bit float lane of a 128-bit vector. */ + /** Negates each 64-bit float lane. */ export function neg(a: v128): v128; - /** Computes the minimum of each 64-bit float lane of two 128-bit vectors. */ + /** Computes the minimum of each 64-bit float lane. */ export function min(a: v128, b: v128): v128; - /** Computes the maximum of each 64-bit float lane of two 128-bit vectors. */ + /** Computes the maximum of each 64-bit float lane. */ export function max(a: v128, b: v128): v128; - /** Computes the absolute value of each 64-bit float lane of a 128-bit vector. */ + /** Computes the absolute value of each 64-bit float lane. */ export function abs(a: v128): v128; - /** Computes the square root of each 64-bit float lane of a 128-bit vector. */ + /** Computes the square root of each 64-bit float lane. */ export function sqrt(a: v128): v128; - /** Computes which 64-bit float lanes of two 128-bit vectors are equal. */ + /** Computes which 64-bit float lanes are equal. */ export function eq(a: v128, b: v128): v128; - /** Computes which 64-bit float lanes of two 128-bit vectors are not equal. */ + /** Computes which 64-bit float lanes are not equal. */ export function ne(a: v128, b: v128): v128; - /** Computes which 64-bit float lanes of the first 128-bit vector are less than those of the second. */ + /** Computes which 64-bit float lanes of the first vector are less than those of the second. */ export function lt(a: v128, b: v128): v128; - /** Computes which 64-bit float lanes of the first 128-bit vector are less than or equal those of the second. */ + /** Computes which 64-bit float lanes of the first vector are less than or equal those of the second. */ export function le(a: v128, b: v128): v128; - /** Computes which 64-bit float lanes of the first 128-bit vector are greater than those of the second. */ + /** Computes which 64-bit float lanes of the first vector are greater than those of the second. */ export function gt(a: v128, b: v128): v128; - /** Computes which 64-bit float lanes of the first 128-bit vector are greater than or equal those of the second. */ + /** Computes which 64-bit float lanes of the first vector are greater than or equal those of the second. */ export function ge(a: v128, b: v128): v128; - /** Converts each 64-bit signed integer lane of a 128-bit vector to floating point. */ + /** Converts each 64-bit signed integer lane of a vector to floating point. */ export function convert_i64x2_s(a: v128): v128; - /** Converts each 64-bit unsigned integer lane of a 128-bit vector to floating point. */ + /** Converts each 64-bit unsigned integer lane of a vector to floating point. */ export function convert_i64x2_u(a: v128): v128; - /** Computes `(a * b) + c` for each 64-bit float lane of the given 128-bit vectors. */ + /** Computes `(a * b) + c` for each 64-bit float lane. */ export function qfma(a: v128, b: v128, c: v128): v128; - /** Computes `(a * b) - c` for each 64-bit float lane of the given 128-bit vectors. */ + /** Computes `(a * b) - c` for each 64-bit float lane. */ export function qfms(a: v128, b: v128, c: v128): v128; } declare namespace v8x16 { - /** Selects 8-bit lanes from either 128-bit vector according to the specified [0-15] respectively [16-31] lane indexes. */ + /** Selects 8-bit lanes from either vector according to the specified [0-15] respectively [16-31] lane indexes. */ export function shuffle(a: v128, b: v128, l0: u8, l1: u8, l2: u8, l3: u8, l4: u8, l5: u8, l6: u8, l7: u8, l8: u8, l9: u8, l10: u8, l11: u8, l12: u8, l13: u8, l14: u8, l15: u8): v128; - /** Selects 8-bit lanes from the first 128-bit vector according to the indexes [0-15] specified by the 8-bit lanes of the second 128-bit vector. */ + /** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */ export function swizzle(a: v128, s: v128): v128; - /** Loads an 8-bit integer and splats it sixteen times forming a new 128-bit vector. */ + /** Loads an 8-bit integer and splats it sixteen times forming a new vector. */ export function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128; } declare namespace v16x8 { - /** Loads a 16-bit integer and splats it eight times forming a new 128-bit vector. */ + /** Loads a 16-bit integer and splats it eight times forming a new vector. */ export function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128; } declare namespace v32x4 { - /** Loads a 32-bit integer and splats it four times forming a new 128-bit vector. */ + /** Loads a 32-bit integer and splats it four times forming a new vector. */ export function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128; } declare namespace v64x2 { - /** Loads a 64-bit integer and splats it two times forming a new 128-bit vector. */ + /** Loads a 64-bit integer and splats it two times forming a new vector. */ export function load_splat(ptr: usize, immOffset?: usize, immAlign?: usize): v128; } /** Macro type evaluating to the underlying native WebAssembly type. */ diff --git a/tests/compiler/features/simd.ts b/tests/compiler/features/simd.ts index 4627c42367..b17d8ed011 100644 --- a/tests/compiler/features/simd.ts +++ b/tests/compiler/features/simd.ts @@ -65,6 +65,38 @@ function test_i8x16(): void { assert(c == i8x16(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -128)); assert(i8x16.sub(c, b) == a); assert(i8x16.mul(c, b) == c); + assert( + i8x16.min_s( + i8x16(0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + i8x16(-128, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ) + == + i8x16(-128, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ); + assert( + i8x16.min_u( + i8x16(0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + i8x16(-128, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ) + == + i8x16(0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ); + assert( + i8x16.max_s( + i8x16(0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + i8x16(-128, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ) + == + i8x16(0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ); + assert( + i8x16.max_u( + i8x16(0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), + i8x16(-128, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ) + == + i8x16(-128, 127, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + ); assert( i8x16.neg(a) == @@ -139,6 +171,38 @@ function test_i16x8(): void { assert(c == i16x8(2, 3, 4, 5, 6, 7, 8, -32768)); assert(i16x8.sub(c, b) == a); assert(i16x8.mul(c, b) == c); + assert( + i16x8.min_s( + i16x8(0, 32767, 32767, 0, 0, 0, 0, 0), + i16x8(-32768, 0, -32768, 0, 0, 0, 0, 0) + ) + == + i16x8(-32768, 0, -32768, 0, 0, 0, 0, 0) + ); + assert( + i16x8.min_u( + i16x8(0, 32767, 32767, 0, 0, 0, 0, 0), + i16x8(-32768, 0, -32768, 0, 0, 0, 0, 0) + ) + == + i16x8(0, 0, 32767, 0, 0, 0, 0, 0) + ); + assert( + i16x8.max_s( + i16x8(0, 32767, 32767, 0, 0, 0, 0, 0), + i16x8(-32768, 0, -32768, 0, 0, 0, 0, 0) + ) + == + i16x8(0, 32767, 32767, 0, 0, 0, 0, 0) + ); + assert( + i16x8.max_u( + i16x8(0, 32767, 32767, 0, 0, 0, 0, 0), + i16x8(-32768, 0, -32768, 0, 0, 0, 0, 0) + ) + == + i16x8(-32768, 32767, -32768, 0, 0, 0, 0, 0) + ); assert( i16x8.neg(a) == @@ -240,6 +304,46 @@ function test_i32x4(): void { assert(c == i32x4(2, 3, 4, -2147483648)); assert(i32x4.sub(c, b) == a); assert(i32x4.mul(c, b) == c); + assert( + i32x4.min_s( + i32x4(0, 2147483647, 2147483647, 0), + i32x4(-2147483648, 0, -2147483648, 0) + ) + == + i32x4(-2147483648, 0, -2147483648, 0) + ); + assert( + i32x4.min_u( + i32x4(0, 2147483647, 2147483647, 0), + i32x4(-2147483648, 0, -2147483648, 0) + ) + == + i32x4(0, 0, 2147483647, 0) + ); + assert( + i32x4.max_s( + i32x4(0, 2147483647, 2147483647, 0), + i32x4(-2147483648, 0, -2147483648, 0) + ) + == + i32x4(0, 2147483647, 2147483647, 0) + ); + assert( + i32x4.max_u( + i32x4(0, 2147483647, 2147483647, 0), + i32x4(-2147483648, 0, -2147483648, 0) + ) + == + i32x4(-2147483648, 2147483647, -2147483648, 0) + ); + assert( + i32x4.dot_i16x8_s( + i16x8(1, 2, 3, 4, -1, 3, 0, 0), + i16x8(5, 6, 7, 8, 2, -1, 0, 0), + ) + == + i32x4(17, 53, -5, 0) + ); assert( i32x4.neg(a) == diff --git a/tests/compiler/features/simd.untouched.wat b/tests/compiler/features/simd.untouched.wat index 48d7eb9171..d396081140 100644 --- a/tests/compiler/features/simd.untouched.wat +++ b/tests/compiler/features/simd.untouched.wat @@ -297,7 +297,7 @@ if i32.const 0 i32.const 72 - i32.const 68 + i32.const 100 i32.const 2 call $~lib/builtins/abort unreachable @@ -314,7 +314,7 @@ if i32.const 0 i32.const 72 - i32.const 73 + i32.const 105 i32.const 2 call $~lib/builtins/abort unreachable @@ -331,7 +331,7 @@ if i32.const 0 i32.const 72 - i32.const 74 + i32.const 106 i32.const 2 call $~lib/builtins/abort unreachable @@ -346,7 +346,7 @@ if i32.const 0 i32.const 72 - i32.const 75 + i32.const 107 i32.const 2 call $~lib/builtins/abort unreachable @@ -363,7 +363,7 @@ if i32.const 0 i32.const 72 - i32.const 76 + i32.const 108 i32.const 2 call $~lib/builtins/abort unreachable @@ -380,7 +380,7 @@ if i32.const 0 i32.const 72 - i32.const 81 + i32.const 113 i32.const 2 call $~lib/builtins/abort unreachable @@ -412,7 +412,7 @@ if i32.const 0 i32.const 72 - i32.const 119 + i32.const 151 i32.const 2 call $~lib/builtins/abort unreachable @@ -429,7 +429,7 @@ if i32.const 0 i32.const 72 - i32.const 120 + i32.const 152 i32.const 2 call $~lib/builtins/abort unreachable @@ -446,7 +446,7 @@ if i32.const 0 i32.const 72 - i32.const 121 + i32.const 153 i32.const 2 call $~lib/builtins/abort unreachable @@ -463,7 +463,7 @@ if i32.const 0 i32.const 72 - i32.const 122 + i32.const 154 i32.const 2 call $~lib/builtins/abort unreachable @@ -480,7 +480,7 @@ if i32.const 0 i32.const 72 - i32.const 123 + i32.const 155 i32.const 2 call $~lib/builtins/abort unreachable @@ -497,7 +497,7 @@ if i32.const 0 i32.const 72 - i32.const 124 + i32.const 156 i32.const 2 call $~lib/builtins/abort unreachable @@ -514,7 +514,7 @@ if i32.const 0 i32.const 72 - i32.const 125 + i32.const 157 i32.const 2 call $~lib/builtins/abort unreachable @@ -531,7 +531,7 @@ if i32.const 0 i32.const 72 - i32.const 126 + i32.const 158 i32.const 2 call $~lib/builtins/abort unreachable @@ -548,7 +548,7 @@ if i32.const 0 i32.const 72 - i32.const 127 + i32.const 159 i32.const 2 call $~lib/builtins/abort unreachable @@ -565,7 +565,7 @@ if i32.const 0 i32.const 72 - i32.const 128 + i32.const 160 i32.const 2 call $~lib/builtins/abort unreachable @@ -591,7 +591,7 @@ if i32.const 0 i32.const 72 - i32.const 135 + i32.const 167 i32.const 2 call $~lib/builtins/abort unreachable @@ -609,7 +609,7 @@ if i32.const 0 i32.const 72 - i32.const 137 + i32.const 169 i32.const 2 call $~lib/builtins/abort unreachable @@ -628,7 +628,7 @@ if i32.const 0 i32.const 72 - i32.const 139 + i32.const 171 i32.const 2 call $~lib/builtins/abort unreachable @@ -645,7 +645,7 @@ if i32.const 0 i32.const 72 - i32.const 140 + i32.const 172 i32.const 2 call $~lib/builtins/abort unreachable @@ -662,7 +662,7 @@ if i32.const 0 i32.const 72 - i32.const 141 + i32.const 173 i32.const 2 call $~lib/builtins/abort unreachable @@ -678,7 +678,7 @@ if i32.const 0 i32.const 72 - i32.const 142 + i32.const 206 i32.const 2 call $~lib/builtins/abort unreachable @@ -695,7 +695,7 @@ if i32.const 0 i32.const 72 - i32.const 147 + i32.const 211 i32.const 2 call $~lib/builtins/abort unreachable @@ -712,7 +712,7 @@ if i32.const 0 i32.const 72 - i32.const 148 + i32.const 212 i32.const 2 call $~lib/builtins/abort unreachable @@ -727,7 +727,7 @@ if i32.const 0 i32.const 72 - i32.const 149 + i32.const 213 i32.const 2 call $~lib/builtins/abort unreachable @@ -744,7 +744,7 @@ if i32.const 0 i32.const 72 - i32.const 150 + i32.const 214 i32.const 2 call $~lib/builtins/abort unreachable @@ -761,7 +761,7 @@ if i32.const 0 i32.const 72 - i32.const 155 + i32.const 219 i32.const 2 call $~lib/builtins/abort unreachable @@ -793,7 +793,7 @@ if i32.const 0 i32.const 72 - i32.const 193 + i32.const 257 i32.const 2 call $~lib/builtins/abort unreachable @@ -810,7 +810,7 @@ if i32.const 0 i32.const 72 - i32.const 194 + i32.const 258 i32.const 2 call $~lib/builtins/abort unreachable @@ -827,7 +827,7 @@ if i32.const 0 i32.const 72 - i32.const 195 + i32.const 259 i32.const 2 call $~lib/builtins/abort unreachable @@ -844,7 +844,7 @@ if i32.const 0 i32.const 72 - i32.const 196 + i32.const 260 i32.const 2 call $~lib/builtins/abort unreachable @@ -861,7 +861,7 @@ if i32.const 0 i32.const 72 - i32.const 197 + i32.const 261 i32.const 2 call $~lib/builtins/abort unreachable @@ -878,7 +878,7 @@ if i32.const 0 i32.const 72 - i32.const 198 + i32.const 262 i32.const 2 call $~lib/builtins/abort unreachable @@ -895,7 +895,7 @@ if i32.const 0 i32.const 72 - i32.const 199 + i32.const 263 i32.const 2 call $~lib/builtins/abort unreachable @@ -912,7 +912,7 @@ if i32.const 0 i32.const 72 - i32.const 200 + i32.const 264 i32.const 2 call $~lib/builtins/abort unreachable @@ -929,7 +929,7 @@ if i32.const 0 i32.const 72 - i32.const 201 + i32.const 265 i32.const 2 call $~lib/builtins/abort unreachable @@ -946,7 +946,7 @@ if i32.const 0 i32.const 72 - i32.const 202 + i32.const 266 i32.const 2 call $~lib/builtins/abort unreachable @@ -972,7 +972,7 @@ if i32.const 0 i32.const 72 - i32.const 236 + i32.const 300 i32.const 2 call $~lib/builtins/abort unreachable @@ -990,7 +990,7 @@ if i32.const 0 i32.const 72 - i32.const 238 + i32.const 302 i32.const 2 call $~lib/builtins/abort unreachable @@ -1009,7 +1009,7 @@ if i32.const 0 i32.const 72 - i32.const 240 + i32.const 304 i32.const 2 call $~lib/builtins/abort unreachable @@ -1026,7 +1026,7 @@ if i32.const 0 i32.const 72 - i32.const 241 + i32.const 305 i32.const 2 call $~lib/builtins/abort unreachable @@ -1043,7 +1043,7 @@ if i32.const 0 i32.const 72 - i32.const 242 + i32.const 306 i32.const 2 call $~lib/builtins/abort unreachable @@ -1059,7 +1059,7 @@ if i32.const 0 i32.const 72 - i32.const 243 + i32.const 347 i32.const 2 call $~lib/builtins/abort unreachable @@ -1072,7 +1072,7 @@ if i32.const 0 i32.const 72 - i32.const 248 + i32.const 352 i32.const 2 call $~lib/builtins/abort unreachable @@ -1085,7 +1085,7 @@ if i32.const 0 i32.const 72 - i32.const 249 + i32.const 353 i32.const 2 call $~lib/builtins/abort unreachable @@ -1102,7 +1102,7 @@ if i32.const 0 i32.const 72 - i32.const 250 + i32.const 354 i32.const 2 call $~lib/builtins/abort unreachable @@ -1119,7 +1119,7 @@ if i32.const 0 i32.const 72 - i32.const 255 + i32.const 359 i32.const 2 call $~lib/builtins/abort unreachable @@ -1151,7 +1151,7 @@ if i32.const 0 i32.const 72 - i32.const 269 + i32.const 373 i32.const 2 call $~lib/builtins/abort unreachable @@ -1168,7 +1168,7 @@ if i32.const 0 i32.const 72 - i32.const 270 + i32.const 374 i32.const 2 call $~lib/builtins/abort unreachable @@ -1185,7 +1185,7 @@ if i32.const 0 i32.const 72 - i32.const 271 + i32.const 375 i32.const 2 call $~lib/builtins/abort unreachable @@ -1202,7 +1202,7 @@ if i32.const 0 i32.const 72 - i32.const 272 + i32.const 376 i32.const 2 call $~lib/builtins/abort unreachable @@ -1219,7 +1219,7 @@ if i32.const 0 i32.const 72 - i32.const 273 + i32.const 377 i32.const 2 call $~lib/builtins/abort unreachable @@ -1236,7 +1236,7 @@ if i32.const 0 i32.const 72 - i32.const 274 + i32.const 378 i32.const 2 call $~lib/builtins/abort unreachable @@ -1253,7 +1253,7 @@ if i32.const 0 i32.const 72 - i32.const 275 + i32.const 379 i32.const 2 call $~lib/builtins/abort unreachable @@ -1270,7 +1270,7 @@ if i32.const 0 i32.const 72 - i32.const 276 + i32.const 380 i32.const 2 call $~lib/builtins/abort unreachable @@ -1287,7 +1287,7 @@ if i32.const 0 i32.const 72 - i32.const 277 + i32.const 381 i32.const 2 call $~lib/builtins/abort unreachable @@ -1304,7 +1304,7 @@ if i32.const 0 i32.const 72 - i32.const 278 + i32.const 382 i32.const 2 call $~lib/builtins/abort unreachable @@ -1326,7 +1326,7 @@ if i32.const 0 i32.const 72 - i32.const 316 + i32.const 420 i32.const 2 call $~lib/builtins/abort unreachable @@ -1344,7 +1344,7 @@ if i32.const 0 i32.const 72 - i32.const 318 + i32.const 422 i32.const 2 call $~lib/builtins/abort unreachable @@ -1363,7 +1363,7 @@ if i32.const 0 i32.const 72 - i32.const 320 + i32.const 424 i32.const 2 call $~lib/builtins/abort unreachable @@ -1380,7 +1380,7 @@ if i32.const 0 i32.const 72 - i32.const 321 + i32.const 425 i32.const 2 call $~lib/builtins/abort unreachable @@ -1396,7 +1396,7 @@ if i32.const 0 i32.const 72 - i32.const 322 + i32.const 426 i32.const 2 call $~lib/builtins/abort unreachable @@ -1409,7 +1409,7 @@ if i32.const 0 i32.const 72 - i32.const 327 + i32.const 431 i32.const 2 call $~lib/builtins/abort unreachable @@ -1422,7 +1422,7 @@ if i32.const 0 i32.const 72 - i32.const 328 + i32.const 432 i32.const 2 call $~lib/builtins/abort unreachable @@ -1439,7 +1439,7 @@ if i32.const 0 i32.const 72 - i32.const 329 + i32.const 433 i32.const 2 call $~lib/builtins/abort unreachable @@ -1456,7 +1456,7 @@ if i32.const 0 i32.const 72 - i32.const 334 + i32.const 438 i32.const 2 call $~lib/builtins/abort unreachable @@ -1483,7 +1483,7 @@ if i32.const 0 i32.const 72 - i32.const 375 + i32.const 479 i32.const 2 call $~lib/builtins/abort unreachable @@ -1501,7 +1501,7 @@ if i32.const 0 i32.const 72 - i32.const 377 + i32.const 481 i32.const 2 call $~lib/builtins/abort unreachable @@ -1520,7 +1520,7 @@ if i32.const 0 i32.const 72 - i32.const 379 + i32.const 483 i32.const 2 call $~lib/builtins/abort unreachable @@ -1537,7 +1537,7 @@ if i32.const 0 i32.const 72 - i32.const 380 + i32.const 484 i32.const 2 call $~lib/builtins/abort unreachable @@ -1554,7 +1554,7 @@ if i32.const 0 i32.const 72 - i32.const 381 + i32.const 485 i32.const 2 call $~lib/builtins/abort unreachable @@ -1575,7 +1575,7 @@ if i32.const 0 i32.const 72 - i32.const 383 + i32.const 487 i32.const 2 call $~lib/builtins/abort unreachable @@ -1592,7 +1592,7 @@ if i32.const 0 i32.const 72 - i32.const 384 + i32.const 488 i32.const 2 call $~lib/builtins/abort unreachable @@ -1608,7 +1608,7 @@ if i32.const 0 i32.const 72 - i32.const 385 + i32.const 489 i32.const 2 call $~lib/builtins/abort unreachable @@ -1621,7 +1621,7 @@ if i32.const 0 i32.const 72 - i32.const 386 + i32.const 490 i32.const 2 call $~lib/builtins/abort unreachable @@ -1634,7 +1634,7 @@ if i32.const 0 i32.const 72 - i32.const 387 + i32.const 491 i32.const 2 call $~lib/builtins/abort unreachable @@ -1651,7 +1651,7 @@ if i32.const 0 i32.const 72 - i32.const 388 + i32.const 492 i32.const 2 call $~lib/builtins/abort unreachable @@ -1668,7 +1668,7 @@ if i32.const 0 i32.const 72 - i32.const 393 + i32.const 497 i32.const 2 call $~lib/builtins/abort unreachable @@ -1699,7 +1699,7 @@ if i32.const 0 i32.const 72 - i32.const 402 + i32.const 506 i32.const 2 call $~lib/builtins/abort unreachable @@ -1716,7 +1716,7 @@ if i32.const 0 i32.const 72 - i32.const 403 + i32.const 507 i32.const 2 call $~lib/builtins/abort unreachable @@ -1733,7 +1733,7 @@ if i32.const 0 i32.const 72 - i32.const 404 + i32.const 508 i32.const 2 call $~lib/builtins/abort unreachable @@ -1750,7 +1750,7 @@ if i32.const 0 i32.const 72 - i32.const 405 + i32.const 509 i32.const 2 call $~lib/builtins/abort unreachable @@ -1767,7 +1767,7 @@ if i32.const 0 i32.const 72 - i32.const 406 + i32.const 510 i32.const 2 call $~lib/builtins/abort unreachable @@ -1784,7 +1784,7 @@ if i32.const 0 i32.const 72 - i32.const 407 + i32.const 511 i32.const 2 call $~lib/builtins/abort unreachable @@ -1801,7 +1801,7 @@ if i32.const 0 i32.const 72 - i32.const 408 + i32.const 512 i32.const 2 call $~lib/builtins/abort unreachable @@ -1818,7 +1818,7 @@ if i32.const 0 i32.const 72 - i32.const 409 + i32.const 513 i32.const 2 call $~lib/builtins/abort unreachable @@ -1834,7 +1834,7 @@ if i32.const 0 i32.const 72 - i32.const 410 + i32.const 514 i32.const 2 call $~lib/builtins/abort unreachable @@ -1861,7 +1861,7 @@ if i32.const 0 i32.const 72 - i32.const 437 + i32.const 541 i32.const 2 call $~lib/builtins/abort unreachable @@ -1879,7 +1879,7 @@ if i32.const 0 i32.const 72 - i32.const 439 + i32.const 543 i32.const 2 call $~lib/builtins/abort unreachable @@ -1898,7 +1898,7 @@ if i32.const 0 i32.const 72 - i32.const 441 + i32.const 545 i32.const 2 call $~lib/builtins/abort unreachable @@ -1915,7 +1915,7 @@ if i32.const 0 i32.const 72 - i32.const 442 + i32.const 546 i32.const 2 call $~lib/builtins/abort unreachable @@ -1932,7 +1932,7 @@ if i32.const 0 i32.const 72 - i32.const 443 + i32.const 547 i32.const 2 call $~lib/builtins/abort unreachable @@ -1953,7 +1953,7 @@ if i32.const 0 i32.const 72 - i32.const 445 + i32.const 549 i32.const 2 call $~lib/builtins/abort unreachable @@ -1970,7 +1970,7 @@ if i32.const 0 i32.const 72 - i32.const 446 + i32.const 550 i32.const 2 call $~lib/builtins/abort unreachable @@ -1986,7 +1986,7 @@ if i32.const 0 i32.const 72 - i32.const 447 + i32.const 551 i32.const 2 call $~lib/builtins/abort unreachable @@ -1999,7 +1999,7 @@ if i32.const 0 i32.const 72 - i32.const 448 + i32.const 552 i32.const 2 call $~lib/builtins/abort unreachable @@ -2012,7 +2012,7 @@ if i32.const 0 i32.const 72 - i32.const 449 + i32.const 553 i32.const 2 call $~lib/builtins/abort unreachable @@ -2029,7 +2029,7 @@ if i32.const 0 i32.const 72 - i32.const 450 + i32.const 554 i32.const 2 call $~lib/builtins/abort unreachable @@ -2046,7 +2046,7 @@ if i32.const 0 i32.const 72 - i32.const 455 + i32.const 559 i32.const 2 call $~lib/builtins/abort unreachable @@ -2077,7 +2077,7 @@ if i32.const 0 i32.const 72 - i32.const 464 + i32.const 568 i32.const 2 call $~lib/builtins/abort unreachable @@ -2094,7 +2094,7 @@ if i32.const 0 i32.const 72 - i32.const 465 + i32.const 569 i32.const 2 call $~lib/builtins/abort unreachable @@ -2111,7 +2111,7 @@ if i32.const 0 i32.const 72 - i32.const 466 + i32.const 570 i32.const 2 call $~lib/builtins/abort unreachable @@ -2128,7 +2128,7 @@ if i32.const 0 i32.const 72 - i32.const 467 + i32.const 571 i32.const 2 call $~lib/builtins/abort unreachable @@ -2145,7 +2145,7 @@ if i32.const 0 i32.const 72 - i32.const 468 + i32.const 572 i32.const 2 call $~lib/builtins/abort unreachable @@ -2162,7 +2162,7 @@ if i32.const 0 i32.const 72 - i32.const 469 + i32.const 573 i32.const 2 call $~lib/builtins/abort unreachable @@ -2179,7 +2179,7 @@ if i32.const 0 i32.const 72 - i32.const 470 + i32.const 574 i32.const 2 call $~lib/builtins/abort unreachable @@ -2196,7 +2196,7 @@ if i32.const 0 i32.const 72 - i32.const 471 + i32.const 575 i32.const 2 call $~lib/builtins/abort unreachable @@ -2212,7 +2212,7 @@ if i32.const 0 i32.const 72 - i32.const 472 + i32.const 576 i32.const 2 call $~lib/builtins/abort unreachable @@ -2238,7 +2238,7 @@ if i32.const 0 i32.const 72 - i32.const 500 + i32.const 604 i32.const 2 call $~lib/builtins/abort unreachable @@ -2257,7 +2257,7 @@ if i32.const 0 i32.const 72 - i32.const 506 + i32.const 610 i32.const 2 call $~lib/builtins/abort unreachable From 97343a9a44c14b2fd7db88ef28913a4fa3d38364 Mon Sep 17 00:00:00 2001 From: dcode Date: Wed, 13 Nov 2019 12:31:32 +0100 Subject: [PATCH 2/2] update _BinaryenGetMemorySegmentByteOffset signature --- package-lock.json | 6 +++--- package.json | 2 +- src/glue/binaryen.d.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2c4f6830e6..b1f792b4a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -571,9 +571,9 @@ "dev": true }, "binaryen": { - "version": "89.0.0-nightly.20191112", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20191112.tgz", - "integrity": "sha512-jxVgLf19L4cJFXepTaKjl6PoE9SsZeZstFXWBm1XZjfFbA3G5oh2CPxyDiPKVJlfmhOT1G15YukeBwmCRpsN0A==" + "version": "89.0.0-nightly.20191113", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20191113.tgz", + "integrity": "sha512-scODswmj6Xf/Adjy1PRsjf8fHxpIIUYpH7HjKUaZ/RdZYjqB1Zq3X4izpLfcK+hKGNah92DpAJ3i/adEayMe9g==" }, "bluebird": { "version": "3.7.1", diff --git a/package.json b/package.json index ff74d8c649..e3242832b6 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "89.0.0-nightly.20191112", + "binaryen": "89.0.0-nightly.20191113", "glob": "^7.1.5", "long": "^4.0.0", "source-map-support": "^0.5.16", diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index ccc885b66d..5f5b0befcb 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -718,7 +718,7 @@ declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, initial: B declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentPassive: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex, shared: bool): void; declare function _BinaryenGetNumMemorySegments(module: BinaryenModuleRef): BinaryenIndex; -// declare function _BinaryenGetMemorySegmentByteOffset(module: BinaryenModuleRef, index: BinaryenIndex): i64; +declare function _BinaryenGetMemorySegmentByteOffset(module: BinaryenModuleRef, index: BinaryenIndex): u32; declare function _BinaryenGetMemorySegmentByteLength(module: BinaryenModuleRef, id: BinaryenIndex): usize; declare function _BinaryenCopyMemorySegmentData(module: BinaryenModuleRef, id: BinaryenIndex, buffer: usize): void;