Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM.SIMD Comparison ops for 32x4 types #3348

Merged
merged 2 commits into from
Jul 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/Common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,9 @@ FLAGNR(Boolean, AsmJsEdge , "Enable asm.js features which may have b
FLAGNR(Boolean, WasmI64 , "Enable Int64 testing for WebAssembly. ArgIns can be [number,string,{low:number,high:number}]. Return values will be {low:number,high:number}", DEFAULT_CONFIG_WasmI64)
FLAGNR(Boolean, WasmFastArray , "Enable fast array implementation for WebAssembly", DEFAULT_CONFIG_WasmFastArray)
FLAGNR(Boolean, WasmCheckVersion , "Check the binary version for WebAssembly", DEFAULT_CONFIG_WasmCheckVersion)
FLAGNR(Boolean, WasmSimd, "Enable SIMD in WebAssembly", DEFAULT_CONFIG_WasmSimd)
#ifdef ENABLE_WASM_SIMD
FLAGR(Boolean, WasmSimd, "Enable SIMD in WebAssembly", DEFAULT_CONFIG_WasmSimd)
#endif

#ifndef COMPILE_DISABLE_Simdjs
#define COMPILE_DISABLE_Simdjs 0
Expand Down
3 changes: 3 additions & 0 deletions lib/Runtime/Base/ThreadConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ FLAG_RELEASE(IsWinRTAdaptiveAppsEnabled, WinRTAdaptiveApps)
#endif
//SIMD_JS
FLAG_RELEASE(IsSimdjsEnabled, Simdjs)
#ifdef ENABLE_WASM_SIMD
FLAG_RELEASE(IsWasmSimdEnabled, WasmSimd)
#endif

6 changes: 5 additions & 1 deletion lib/Runtime/Language/InterpreterStackFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3254,7 +3254,11 @@ namespace Js
++doubleArg;
argAddress += sizeof(double);
}
else if (scriptContext->GetConfig()->IsSimdjsEnabled() && info->GetArgType(i).isSIMD())
else if ((scriptContext->GetConfig()->IsSimdjsEnabled()
#ifdef ENABLE_WASM_SIMD
|| scriptContext->GetConfig()->IsWasmSimdEnabled()
#endif
) && info->GetArgType(i).isSIMD())
{
*simdArg = *(AsmJsSIMDValue*)argAddress;
++simdArg;
Expand Down
158 changes: 80 additions & 78 deletions lib/WasmReader/WasmBinaryOpcodesSimd.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ FOREACH_SIMD_TYPE_W_BASE(SIMD_ALL)
#undef SIMD_EXTRACT

WASM_SIGNATURE(M128X3, 3, WasmTypes::M128, WasmTypes::M128, WasmTypes::M128)
WASM_SIGNATURE(M128_I_M128, 3, WasmTypes::M128, WasmTypes::M128, WasmTypes::I32)
WASM_SIGNATURE(M128_M128_I, 3, WasmTypes::M128, WasmTypes::M128, WasmTypes::I32)
WASM_SIGNATURE(M128_M128, 2, WasmTypes::M128, WasmTypes::M128)
WASM_SIGNATURE(M128_L, 2, WasmTypes::M128, WasmTypes::I64)
WASM_SIGNATURE(L_M128, 2, WasmTypes::I64, WasmTypes::M128)

WASM_MISC_OPCODE(M128Const, 0x100, Limit, false)
WASM_SIMD_MEMREAD_OPCODE(M128Load, 0x101, M128_I, Simd128_LdArr_F4, Js::ArrayBufferView::TYPE_FLOAT32, 16, false)
Expand All @@ -81,113 +83,113 @@ WASM_MISC_OPCODE(I2ReplaceLane, 0x114, Limit, true)
WASM_REPLACELANE_OPCODE(F4ReplaceLane, 0x115, M128_F, Simd128_ReplaceLane_F4, false)
WASM_MISC_OPCODE(F2ReplaceLane, 0x116, Limit, true)
WASM_MISC_OPCODE(V8X16Shuffle, 0x117, Limit, true)
WASM_MISC_OPCODE(I16Add, 0x118, Limit, true)
WASM_MISC_OPCODE(I8Add, 0x119, Limit, true)
WASM_MISC_OPCODE(I4Add, 0x11a, Limit, true)
WASM_BINARY_OPCODE(I16Add, 0x118, M128X3, Simd128_Add_I16, false)
WASM_BINARY_OPCODE(I8Add, 0x119, M128X3, Simd128_Add_I8, false)
WASM_BINARY_OPCODE(I4Add, 0x11a, M128X3, Simd128_Add_I4, false)
WASM_MISC_OPCODE(I2Add, 0x11b, Limit, true)
WASM_MISC_OPCODE(I16Sub, 0x11c, Limit, true)
WASM_MISC_OPCODE(I8Sub, 0x11d, Limit, true)
WASM_MISC_OPCODE(I4Sub, 0x11e, Limit, true)
WASM_BINARY_OPCODE(I16Sub, 0x11c, M128X3, Simd128_Sub_I16, false)
WASM_BINARY_OPCODE(I8Sub, 0x11d, M128X3, Simd128_Sub_I8, false)
WASM_BINARY_OPCODE(I4Sub, 0x11e, M128X3, Simd128_Sub_I4, false)
WASM_MISC_OPCODE(I2Sub, 0x11f, Limit, true)
WASM_MISC_OPCODE(I16Mul, 0x120, Limit, true)
WASM_MISC_OPCODE(I8Mul, 0x121, Limit, true)
WASM_MISC_OPCODE(I4Mul, 0x122, Limit, true)
WASM_BINARY_OPCODE(I16Mul, 0x120, M128X3, Simd128_Mul_I16, false)
WASM_BINARY_OPCODE(I8Mul, 0x121, M128X3, Simd128_Mul_I8, false)
WASM_BINARY_OPCODE(I4Mul, 0x122, M128X3, Simd128_Mul_I4, false)
WASM_UNARY__OPCODE(I16Neg, 0x123, M128_M128, Simd128_Neg_I16, false)
WASM_UNARY__OPCODE(I8Neg, 0x124, M128_M128, Simd128_Neg_I8, false)
WASM_UNARY__OPCODE(I4Neg, 0x125, M128_M128, Simd128_Neg_I4, false)
WASM_UNARY__OPCODE(I4Neg, 0x125, M128_M128, Simd128_Neg_I4, false)
WASM_MISC_OPCODE(I2Neg, 0x126, Limit, true)
WASM_MISC_OPCODE(I16AddSaturateS, 0x127, Limit, true)
WASM_MISC_OPCODE(I16AddSaturateU, 0x128, Limit, true)
WASM_MISC_OPCODE(I8AddSaturateS, 0x129, Limit, true)
WASM_MISC_OPCODE(I8AddSaturateU, 0x12a, Limit, true)
WASM_MISC_OPCODE(I16SubSaturateS, 0x12b, Limit, true)
WASM_MISC_OPCODE(I16SubSaturateU, 0x12c, Limit, true)
WASM_MISC_OPCODE(I8SubSaturateS, 0x12d, Limit, true)
WASM_MISC_OPCODE(I8SubSaturateU, 0x12e, Limit, true)
WASM_MISC_OPCODE(I16Shl, 0x12f, Limit, true)
WASM_MISC_OPCODE(I8Shl, 0x130, Limit, true)
WASM_MISC_OPCODE(I4Shl, 0x131, Limit, true)
WASM_BINARY_OPCODE(I16AddSaturateS, 0x127, M128X3, Simd128_AddSaturate_I16, false)
WASM_BINARY_OPCODE(I16AddSaturateU, 0x128, M128X3, Simd128_AddSaturate_U16, false)
WASM_BINARY_OPCODE(I8AddSaturateS, 0x129, M128X3, Simd128_AddSaturate_I8, false)
WASM_BINARY_OPCODE(I8AddSaturateU, 0x12a, M128X3, Simd128_AddSaturate_U8, false)
WASM_BINARY_OPCODE(I16SubSaturateS, 0x12b, M128X3, Simd128_SubSaturate_I16, false)
WASM_BINARY_OPCODE(I16SubSaturateU, 0x12c, M128X3, Simd128_SubSaturate_U16, false)
WASM_BINARY_OPCODE(I8SubSaturateS, 0x12d, M128X3, Simd128_SubSaturate_I8, false)
WASM_BINARY_OPCODE(I8SubSaturateU, 0x12e, M128X3, Simd128_SubSaturate_U8, false)
WASM_BINARY_OPCODE(I16Shl, 0x12f, M128_M128_I, Simd128_ShLtByScalar_I16, false)
WASM_BINARY_OPCODE(I8Shl, 0x130, M128_M128_I, Simd128_ShLtByScalar_I8, false)
WASM_BINARY_OPCODE(I4Shl, 0x131, M128_M128_I, Simd128_ShLtByScalar_I4, false)
WASM_MISC_OPCODE(I2Shl, 0x132, Limit, true)
WASM_MISC_OPCODE(I16ShrS, 0x133, Limit, true)
WASM_MISC_OPCODE(I16ShrU, 0x134, Limit, true)
WASM_MISC_OPCODE(I8ShrS, 0x135, Limit, true)
WASM_MISC_OPCODE(I8ShrU, 0x136, Limit, true)
WASM_MISC_OPCODE(I4ShrS, 0x137, Limit, true)
WASM_MISC_OPCODE(I4ShrU, 0x138, Limit, true)
WASM_BINARY_OPCODE(I16ShrS, 0x133, M128_M128_I, Simd128_ShRtByScalar_I16, false)
WASM_BINARY_OPCODE(I16ShrU, 0x134, M128_M128_I, Simd128_ShRtByScalar_U16, false)
WASM_BINARY_OPCODE(I8ShrS, 0x135, M128_M128_I, Simd128_ShRtByScalar_I8, false)
WASM_BINARY_OPCODE(I8ShrU, 0x136, M128_M128_I, Simd128_ShRtByScalar_U8, false)
WASM_BINARY_OPCODE(I4ShrS, 0x137, M128_M128_I, Simd128_ShRtByScalar_I4, false)
WASM_BINARY_OPCODE(I4ShrU, 0x138, M128_M128_I, Simd128_ShRtByScalar_U4, false)
WASM_MISC_OPCODE(I2ShrS, 0x139, Limit, true)
WASM_MISC_OPCODE(I2ShrU, 0x13a, Limit, true)
WASM_BINARY_OPCODE(M128And, 0x13b, M128X3, Simd128_And_I4, false)
WASM_BINARY_OPCODE(M128Or, 0x13c, M128X3, Simd128_Or_I4, false)
WASM_BINARY_OPCODE(M128Or, 0x13c, M128X3, Simd128_Or_I4, false)
WASM_BINARY_OPCODE(M128Xor, 0x13d, M128X3, Simd128_Xor_I4, false)
WASM_UNARY__OPCODE(M128Not, 0x13e, M128_M128, Simd128_Not_I4, false)
WASM_MISC_OPCODE(M128Bitselect, 0x13f, Limit, true)
WASM_UNARY__OPCODE(I16AnyTrue, 0x140, I_M128, Simd128_AnyTrue_B16, false)
WASM_UNARY__OPCODE(I8AnyTrue, 0x141, I_M128, Simd128_AnyTrue_B8, false)
WASM_UNARY__OPCODE(I4AnyTrue, 0x142, I_M128, Simd128_AnyTrue_B4, false)
WASM_UNARY__OPCODE(I8AnyTrue, 0x141, I_M128, Simd128_AnyTrue_B8, false)
WASM_UNARY__OPCODE(I4AnyTrue, 0x142, I_M128, Simd128_AnyTrue_B4, false)
WASM_MISC_OPCODE(I2AnyTrue, 0x143, Limit, true)
WASM_UNARY__OPCODE(I16AllTrue, 0x144, I_M128, Simd128_AllTrue_B16, false)
WASM_UNARY__OPCODE(I8AllTrue, 0x145, I_M128, Simd128_AllTrue_B8, false)
WASM_UNARY__OPCODE(I4AllTrue, 0x146, I_M128, Simd128_AllTrue_B4, false)
WASM_MISC_OPCODE(I2AllTrue, 0x147, Limit, true)
WASM_MISC_OPCODE(I16Eq, 0x148, Limit, true)
WASM_MISC_OPCODE(I8Eq, 0x149, Limit, true)
WASM_MISC_OPCODE(I4Eq, 0x14a, Limit, true)
WASM_MISC_OPCODE(F4Eq, 0x14b, Limit, true)
WASM_UNARY__OPCODE(I8AllTrue, 0x145, I_M128, Simd128_AllTrue_B8, false)
WASM_UNARY__OPCODE(I4AllTrue, 0x146, I_M128, Simd128_AllTrue_B4, false)
WASM_MISC_OPCODE(I2AllTrue, 0x147, Limit, true)
WASM_BINARY_OPCODE(I16Eq, 0x148, M128X3, Simd128_Eq_I16, false)
WASM_BINARY_OPCODE(I8Eq, 0x149, M128X3, Simd128_Eq_I8, false)
WASM_BINARY_OPCODE(I4Eq, 0x14a, M128X3, Simd128_Eq_I4, false)
WASM_BINARY_OPCODE(F4Eq, 0x14b, M128X3, Simd128_Eq_F4, false)
WASM_MISC_OPCODE(F2Eq, 0x14c, Limit, true)
WASM_MISC_OPCODE(I16Ne, 0x14d, Limit, true)
WASM_MISC_OPCODE(I8Ne, 0x14e, Limit, true)
WASM_MISC_OPCODE(I4Ne, 0x14f, Limit, true)
WASM_MISC_OPCODE(F4Ne, 0x150, Limit, true)
WASM_BINARY_OPCODE(I16Ne, 0x14d, M128X3, Simd128_Neq_I16, false)
WASM_BINARY_OPCODE(I8Ne, 0x14e, M128X3, Simd128_Neq_I8, false)
WASM_BINARY_OPCODE(I4Ne, 0x14f, M128X3, Simd128_Neq_I4, false)
WASM_BINARY_OPCODE(F4Ne, 0x150, M128X3, Simd128_Neq_F4, false)
WASM_MISC_OPCODE(F2Ne, 0x151, Limit, true)
WASM_MISC_OPCODE(I16LtS, 0x152, Limit, true)
WASM_MISC_OPCODE(I16LtU, 0x153, Limit, true)
WASM_MISC_OPCODE(I8LtS, 0x154, Limit, true)
WASM_MISC_OPCODE(I8LtU, 0x155, Limit, true)
WASM_MISC_OPCODE(I4LtS, 0x156, Limit, true)
WASM_MISC_OPCODE(I4LtU, 0x157, Limit, true)
WASM_MISC_OPCODE(F4Lt, 0x158, Limit, true)
WASM_BINARY_OPCODE(I16LtS, 0x152, M128X3, Simd128_Lt_I16, false)
WASM_BINARY_OPCODE(I16LtU, 0x153, M128X3, Simd128_Lt_U16, false)
WASM_BINARY_OPCODE(I8LtS, 0x154, M128X3, Simd128_Lt_I8, false)
WASM_BINARY_OPCODE(I8LtU, 0x155, M128X3, Simd128_Lt_U8, false)
WASM_BINARY_OPCODE(I4LtS, 0x156, M128X3, Simd128_Lt_I4, false)
WASM_BINARY_OPCODE(I4LtU, 0x157, M128X3, Simd128_Lt_U4, false)
WASM_BINARY_OPCODE(F4Lt, 0x158, M128X3, Simd128_Lt_F4, false)
WASM_MISC_OPCODE(F2Lt, 0x159, Limit, true)
WASM_MISC_OPCODE(I16LeS, 0x15a, Limit, true)
WASM_MISC_OPCODE(I16LeU, 0x15b, Limit, true)
WASM_MISC_OPCODE(I8LeS, 0x15c, Limit, true)
WASM_MISC_OPCODE(I8LeU, 0x15d, Limit, true)
WASM_MISC_OPCODE(I4LeS, 0x15e, Limit, true)
WASM_MISC_OPCODE(I4LeU, 0x15f, Limit, true)
WASM_MISC_OPCODE(F4Le, 0x160, Limit, true)
WASM_BINARY_OPCODE(I16LeS, 0x15a, M128X3, Simd128_LtEq_I16, false)
WASM_BINARY_OPCODE(I16LeU, 0x15b, M128X3, Simd128_LtEq_U16, false)
WASM_BINARY_OPCODE(I8LeS, 0x15c, M128X3, Simd128_LtEq_I8, false)
WASM_BINARY_OPCODE(I8LeU, 0x15d, M128X3, Simd128_LtEq_U8, false)
WASM_BINARY_OPCODE(I4LeS, 0x15e, M128X3, Simd128_LtEq_I4, false)
WASM_BINARY_OPCODE(I4LeU, 0x15f, M128X3, Simd128_LtEq_U4, false)
WASM_BINARY_OPCODE(F4Le, 0x160, M128X3, Simd128_LtEq_F4, false)
WASM_MISC_OPCODE(F2Le, 0x161, Limit, true)
WASM_MISC_OPCODE(I16GtS, 0x162, Limit, true)
WASM_MISC_OPCODE(I16GtU, 0x163, Limit, true)
WASM_MISC_OPCODE(I8GtS, 0x164, Limit, true)
WASM_MISC_OPCODE(I8GtU, 0x165, Limit, true)
WASM_MISC_OPCODE(I4GtS, 0x166, Limit, true)
WASM_MISC_OPCODE(I4GtU, 0x167, Limit, true)
WASM_MISC_OPCODE(F4Gt, 0x168, Limit, true)
WASM_BINARY_OPCODE(I16GtS, 0x162, M128X3, Simd128_Gt_I16, false)
WASM_BINARY_OPCODE(I16GtU, 0x163, M128X3, Simd128_Gt_U16, false)
WASM_BINARY_OPCODE(I8GtS, 0x164, M128X3, Simd128_Gt_I8, false)
WASM_BINARY_OPCODE(I8GtU, 0x165, M128X3, Simd128_Gt_U8, false)
WASM_BINARY_OPCODE(I4GtS, 0x166, M128X3, Simd128_Gt_I4, false)
WASM_BINARY_OPCODE(I4GtU, 0x167, M128X3, Simd128_Gt_U4, false)
WASM_BINARY_OPCODE(F4Gt, 0x168, M128X3, Simd128_Gt_F4, false)
WASM_MISC_OPCODE(F2Gt, 0x169, Limit, true)
WASM_MISC_OPCODE(I16GeS, 0x16a, Limit, true)
WASM_MISC_OPCODE(I16GeU, 0x16b, Limit, true)
WASM_MISC_OPCODE(I8GeS, 0x16c, Limit, true)
WASM_MISC_OPCODE(I8GeU, 0x16d, Limit, true)
WASM_MISC_OPCODE(I4GeS, 0x16e, Limit, true)
WASM_MISC_OPCODE(I4GeU, 0x16f, Limit, true)
WASM_MISC_OPCODE(F4Ge, 0x170, Limit, true)
WASM_BINARY_OPCODE(I16GeS, 0x16a, M128X3, Simd128_GtEq_I16, false)
WASM_BINARY_OPCODE(I16GeU, 0x16b, M128X3, Simd128_GtEq_U16, false)
WASM_BINARY_OPCODE(I8GeS, 0x16c, M128X3, Simd128_GtEq_I8, false)
WASM_BINARY_OPCODE(I8GeU, 0x16d, M128X3, Simd128_GtEq_U8, false)
WASM_BINARY_OPCODE(I4GeS, 0x16e, M128X3, Simd128_GtEq_I4, false)
WASM_BINARY_OPCODE(I4GeU, 0x16f, M128X3, Simd128_GtEq_U4, false)
WASM_BINARY_OPCODE(F4Ge, 0x170, M128X3, Simd128_GtEq_F4, false)
WASM_MISC_OPCODE(F2Ge, 0x171, Limit, true)
WASM_UNARY__OPCODE(F4Neg, 0x172, M128_M128, Simd128_Neg_F4, false)
WASM_MISC_OPCODE(F2Neg, 0x173, Limit, true)
WASM_MISC_OPCODE(F4Abs, 0x174, Limit, true)
WASM_UNARY__OPCODE(F4Abs, 0x174, M128_M128, Simd128_Abs_F4, false)
WASM_MISC_OPCODE(F2Abs, 0x175, Limit, true)
WASM_MISC_OPCODE(F4Min, 0x176, Limit, true)
WASM_BINARY_OPCODE(F4Min, 0x176, M128X3, Simd128_Min_F4, false)
WASM_MISC_OPCODE(F2Min, 0x177, Limit, true)
WASM_MISC_OPCODE(F4Max, 0x178, Limit, true)
WASM_BINARY_OPCODE(F4Max, 0x178, M128X3, Simd128_Max_F4, false)
WASM_MISC_OPCODE(F2Max, 0x179, Limit, true)
WASM_MISC_OPCODE(F4Add, 0x17a, Limit, true)
WASM_BINARY_OPCODE(F4Add, 0x17a, M128X3, Simd128_Add_F4, false)
WASM_MISC_OPCODE(F2Add, 0x17b, Limit, true)
WASM_MISC_OPCODE(F4Sub, 0x17c, Limit, true)
WASM_BINARY_OPCODE(F4Sub, 0x17c, M128X3, Simd128_Sub_F4, false)
WASM_MISC_OPCODE(F2Sub, 0x17d, Limit, true)
WASM_MISC_OPCODE(F4Div, 0x17e, Limit, true)
WASM_BINARY_OPCODE(F4Div, 0x17e, M128X3, Simd128_Div_F4, false)
WASM_MISC_OPCODE(F2Div, 0x17f, Limit, true)
WASM_MISC_OPCODE(F4Mul, 0x180, Limit, true)
WASM_BINARY_OPCODE(F4Mul, 0x180, M128X3, Simd128_Mul_F4, false)
WASM_MISC_OPCODE(F2Mul, 0x181, Limit, true)
WASM_MISC_OPCODE(F4Sqrt, 0x182, Limit, true)
WASM_UNARY__OPCODE(F4Sqrt, 0x182, M128_M128, Simd128_Sqrt_F4, false)
WASM_MISC_OPCODE(F2Sqrt, 0x183, Limit, true)
WASM_UNARY__OPCODE(F4ConvertS, 0x184, M128_M128, Simd128_FromInt32x4_F4, false)
WASM_UNARY__OPCODE(F4ConvertU, 0x185, M128_M128, Simd128_FromUint32x4_F4, false)
Expand Down
Binary file added test/wasm.simd/comp.wasm
Binary file not shown.
Loading