public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.BitwiseSelect( Unsafe.Read <Vector64 <Byte> >(_dataTable.inArray1Ptr), Unsafe.Read <Vector64 <Byte> >(_dataTable.inArray2Ptr), Unsafe.Read <Vector64 <Byte> >(_dataTable.inArray3Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); }
public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.BitwiseSelect( _clsVar1, _clsVar2, _clsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); }
public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Int16 *)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((Int16 *)(_dataTable.inArray2Ptr)), AdvSimd.LoadVector128((Int16 *)(_dataTable.inArray3Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); }
public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Single *)(&test._fld1)), AdvSimd.LoadVector128((Single *)(&test._fld2)), AdvSimd.LoadVector128((Single *)(&test._fld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); }
public void RunStructFldScenario_Load(SimpleTernaryOpTest__BitwiseSelect_Vector128_Single testClass) { fixed(Vector128 <Single> *pFld1 = &_fld1) fixed(Vector128 <Single> *pFld2 = &_fld2) fixed(Vector128 <Single> *pFld3 = &_fld3) { var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Single *)(pFld1)), AdvSimd.LoadVector128((Single *)(pFld2)), AdvSimd.LoadVector128((Single *)(pFld3)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } }
public static Vector128 <float> ConditionalSelectBitwise(Vector128 <float> selector, Vector128 <float> ifTrue, Vector128 <float> ifFalse) { Debug.Assert(Sse.IsSupported || AdvSimd.IsSupported); if (Sse.IsSupported) { return(Sse.Or( Sse.And(ifTrue, selector), Sse.AndNot(selector, ifFalse) )); } else if (AdvSimd.IsSupported) { return(AdvSimd.BitwiseSelect(selector.AsByte(), ifTrue.AsByte(), ifFalse.AsByte()).As <byte, float>()); } return(default);
public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed(Vector128 <Single> *pFld1 = &_fld1) fixed(Vector128 <Single> *pFld2 = &_fld2) fixed(Vector128 <Single> *pFld3 = &_fld3) { var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Single *)(pFld1)), AdvSimd.LoadVector128((Single *)(pFld2)), AdvSimd.LoadVector128((Single *)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } }
public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed(Vector128 <Single> *pClsVar1 = &_clsVar1) fixed(Vector128 <Single> *pClsVar2 = &_clsVar2) fixed(Vector128 <Single> *pClsVar3 = &_clsVar3) { var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Single *)(pClsVar1)), AdvSimd.LoadVector128((Single *)(pClsVar2)), AdvSimd.LoadVector128((Single *)(pClsVar3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } }
public static Vector128 <double> ConditionalSelectBitwise(Vector128 <double> selector, Vector128 <double> ifTrue, Vector128 <double> ifFalse) { // This implementation is based on the DirectX Math Library XMVector4NotEqual method // https://github.com/microsoft/DirectXMath/blob/master/Inc/DirectXMathVector.inl if (AdvSimd.IsSupported) { return(AdvSimd.BitwiseSelect(selector, ifTrue, ifFalse)); } else if (Sse2.IsSupported) { return(Sse2.Or(Sse2.And(ifTrue, selector), Sse2.AndNot(selector, ifFalse))); } else { // Redundant test so we won't prejit remainder of this method on platforms without AdvSimd. throw new PlatformNotSupportedException(); } }
public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__BitwiseSelect_Vector128_Single(); fixed(Vector128 <Single> *pFld1 = &test._fld1) fixed(Vector128 <Single> *pFld2 = &test._fld2) fixed(Vector128 <Single> *pFld3 = &test._fld3) { var result = AdvSimd.BitwiseSelect( AdvSimd.LoadVector128((Single *)(pFld1)), AdvSimd.LoadVector128((Single *)(pFld2)), AdvSimd.LoadVector128((Single *)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } }