Var SIMDInt8x16Lib::EntryShiftLeftByScalar(RecyclableObject* function, CallInfo callInfo, ...) { PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault); ARGUMENTS(args, callInfo); ScriptContext* scriptContext = function->GetScriptContext(); AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'"); Assert(!(callInfo.Flags & CallFlags_New)); if (args.Info.Count >= 3 && JavascriptSIMDInt8x16::Is(args[1])) { JavascriptSIMDInt8x16 *a = JavascriptSIMDInt8x16::FromVar(args[1]); Assert(a); SIMDValue result, aValue; aValue = a->GetValue(); Var countVar = args[2]; // {int} bits Bit count int8 count = JavascriptConversion::ToInt8(countVar, scriptContext); result = SIMDInt8x16Operation::OpShiftLeftByScalar(aValue, count); return JavascriptSIMDInt8x16::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, L"shiftLeft"); }
Var SIMDInt8x16Lib::EntryNot(RecyclableObject* function, CallInfo callInfo, ...) { PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault); ARGUMENTS(args, callInfo); ScriptContext* scriptContext = function->GetScriptContext(); AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'"); Assert(!(callInfo.Flags & CallFlags_New)); if (args.Info.Count >= 2 && JavascriptSIMDInt8x16::Is(args[1])) { JavascriptSIMDInt8x16 *a = JavascriptSIMDInt8x16::FromVar(args[1]); Assert(a); SIMDValue value, result; value = a->GetValue(); result = SIMDInt8x16Operation::OpNot(value); return JavascriptSIMDInt8x16::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt32x4TypeMismatch, L"not"); }
Var SIMDInt8x16Lib::EntryGreaterThan(RecyclableObject* function, CallInfo callInfo, ...) { PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault); ARGUMENTS(args, callInfo); ScriptContext* scriptContext = function->GetScriptContext(); AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'"); Assert(!(callInfo.Flags & CallFlags_New)); // If any of the args are missing, then it is Undefined type which causes TypeError exception. // strict type on both operands if (args.Info.Count >= 3 && JavascriptSIMDInt8x16::Is(args[1]) && JavascriptSIMDInt8x16::Is(args[2])) { JavascriptSIMDInt8x16 *a = JavascriptSIMDInt8x16::FromVar(args[1]); JavascriptSIMDInt8x16 *b = JavascriptSIMDInt8x16::FromVar(args[2]); Assert(a && b); SIMDValue result, aValue, bValue; aValue = a->GetValue(); bValue = b->GetValue(); result = SIMDInt8x16Operation::OpGreaterThan(aValue, bValue); return JavascriptSIMDInt8x16::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, L"greaterThan"); }
Var SIMDInt8x16Lib::EntrySelect(RecyclableObject* function, CallInfo callInfo, ...) { PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault); ARGUMENTS(args, callInfo); ScriptContext* scriptContext = function->GetScriptContext(); AssertMsg(args.Info.Count > 0, "Should always have implicit 'this'"); Assert(!(callInfo.Flags & CallFlags_New)); if (args.Info.Count >= 4 && JavascriptSIMDBool8x16::Is(args[1]) && JavascriptSIMDInt8x16::Is(args[2]) && JavascriptSIMDInt8x16::Is(args[3])) { JavascriptSIMDBool8x16 *m = JavascriptSIMDBool8x16::FromVar(args[1]); JavascriptSIMDInt8x16 *t = JavascriptSIMDInt8x16::FromVar(args[2]); JavascriptSIMDInt8x16 *f = JavascriptSIMDInt8x16::FromVar(args[3]); Assert(m && t && f); SIMDValue result, maskValue, trueValue, falseValue; maskValue = m->GetValue(); trueValue = t->GetValue(); falseValue = f->GetValue(); result = SIMDInt8x16Operation::OpSelect(maskValue, trueValue, falseValue); return JavascriptSIMDInt8x16::New(&result, scriptContext); } JavascriptError::ThrowTypeError(scriptContext, JSERR_SimdInt8x16TypeMismatch, L"select"); }