static SimpleBinaryOpTest__AddWideningLower_Vector128_Int32()
 {
     for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
     for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>());
 }
            public static TestStruct Create()
            {
                var testStruct = new TestStruct();

                for (var i = 0; i < Op1ElementCount; i++)
                {
                    _data1[i] = TestLibrary.Generator.GetSingle();
                }
                Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref testStruct._fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());
                for (var i = 0; i < Op2ElementCount; i++)
                {
                    _data2[i] = TestLibrary.Generator.GetSingle();
                }
                Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref testStruct._fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());

                return(testStruct);
            }
        public VectorBooleanBinaryOpTest__GreaterThanOrEqualAllSingle()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetSingle();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref _fld1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetSingle();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref _fld2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetSingle();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetSingle();
            }
            _dataTable = new DataTable(_data1, _data2, LargestVectorSize);
        }
Beispiel #4
0
        public SimpleTernaryOpTest__BitwiseSelect_Vector128_Double()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetDouble();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld1), ref Unsafe.As <Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetDouble();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld2), ref Unsafe.As <Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
            for (var i = 0; i < Op3ElementCount; i++)
            {
                _data3[i] = TestLibrary.Generator.GetDouble();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld3), ref Unsafe.As <Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetDouble();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetDouble();
            }
            for (var i = 0; i < Op3ElementCount; i++)
            {
                _data3[i] = TestLibrary.Generator.GetDouble();
            }
            _dataTable = new DataTable(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize);
        }
Beispiel #5
0
        static SimpleBinaryOpTest__OrByte()
        {
            var random = new Random();

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Byte>, byte>(ref _clsVar1), ref Unsafe.As <Byte, byte>(ref _data1[0]), VectorSize);
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Byte>, byte>(ref _clsVar2), ref Unsafe.As <Byte, byte>(ref _data2[0]), VectorSize);
        }
            public static TestStruct Create()
            {
                var testStruct = new TestStruct();

                for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
                Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());

                return testStruct;
            }
        public ImmUnaryOpTest__ShiftRightLogicalNarrowingSaturateScalar_Vector64_UInt16_5()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());

            for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
            _dataTable = new DataTable(_data, new UInt16[RetElementCount], LargestVectorSize);
        }
Beispiel #8
0
        public void Dispose()
        {
            var obj = this;

            Platform.Free(Unsafe.As <object, IntPtr>(ref obj));
        }
Beispiel #9
0
 static ImmUnaryOpTest__ShiftRightLogicalInt161()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data[i] = TestLibrary.Generator.GetInt16();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _clsVar), ref Unsafe.As <Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());
 }
 static SimpleUnaryOpTest__ConvertToSingleLower_Vector64_Single()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetDouble();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _clsVar1), ref Unsafe.As <Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
 }
        public SimpleUnaryOpTest__ConvertToSingleLower_Vector64_Single()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetDouble();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _fld1), ref Unsafe.As <Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetDouble();
            }
            _dataTable = new DataTable(_data1, new Single[RetElementCount], LargestVectorSize);
        }
Beispiel #12
0
        public SimpleBinaryOpTest__TransposeOdd_Vector128_UInt16()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetUInt16();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <UInt16>, byte>(ref _fld1), ref Unsafe.As <UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <UInt16> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetUInt16();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <UInt16>, byte>(ref _fld2), ref Unsafe.As <UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <UInt16> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetUInt16();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetUInt16();
            }
            _dataTable = new DataTable(_data1, _data2, new UInt16[RetElementCount], LargestVectorSize);
        }
Beispiel #13
0
 static SimpleBinaryOpTest__TransposeOdd_Vector128_UInt16()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetUInt16();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <UInt16>, byte>(ref _clsVar1), ref Unsafe.As <UInt16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <UInt16> >());
     for (var i = 0; i < Op2ElementCount; i++)
     {
         _data2[i] = TestLibrary.Generator.GetUInt16();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <UInt16>, byte>(ref _clsVar2), ref Unsafe.As <UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <UInt16> >());
 }
        public SimpleBinaryOpTest__AddWideningLower_Vector128_Int32()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
            for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int16>>());

            for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
            for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); }
            _dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
        }
 static SimpleBinaryOpTest__CompareEqualInt64()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetInt64();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int64>, byte>(ref _clsVar1), ref Unsafe.As <Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Int64> >());
     for (var i = 0; i < Op2ElementCount; i++)
     {
         _data2[i] = TestLibrary.Generator.GetInt64();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int64>, byte>(ref _clsVar2), ref Unsafe.As <Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Int64> >());
 }
Beispiel #16
0
        public ImmUnaryOpTest__ShiftRightLogicalInt161()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data[i] = TestLibrary.Generator.GetInt16();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _fld), ref Unsafe.As <Int16, byte>(ref _data[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data[i] = TestLibrary.Generator.GetInt16();
            }
            _dataTable = new SimpleUnaryOpTest__DataTable <Int16, Int16>(_data, new Int16[RetElementCount], LargestVectorSize);
        }
        public SimpleBinaryOpTest__CompareEqualInt64()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetInt64();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int64>, byte>(ref _fld1), ref Unsafe.As <Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Int64> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetInt64();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int64>, byte>(ref _fld2), ref Unsafe.As <Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Int64> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetInt64();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetInt64();
            }
            _dataTable = new DataTable(_data1, _data2, new Int64[RetElementCount], LargestVectorSize);
        }
Beispiel #18
0
        internal CallConversionParameters(CallConversionInfo conversionInfo, IntPtr callerTransitionBlockParam)
        {
            // Make sure the thred static variable has been initialized for this thread
            s_pinnedGCHandles = s_pinnedGCHandles ?? new GCHandleContainer();

            _conversionInfo = conversionInfo;
            _callerTransitionBlock = (byte*)callerTransitionBlockParam.ToPointer();
            _functionPointerToCall = conversionInfo.TargetFunctionPointer;
            _instantiatingStubArgument = conversionInfo.InstantiatingStubArgument;
            _delegateData = default(DelegateData);
            _calleeArgs = default(ArgIterator);
            _invokeReturnValue = IntPtr.Zero;
            _copyReturnValue = true;
            _dynamicInvokeParams = null;
            _dynamicInvokeByRefObjectArgs = null;

            // 
            // Setup input argument iterator for the caller
            //
            ArgIteratorData callerIteratorData;

            if (conversionInfo.IsDelegateDynamicInvokeThunk)
                callerIteratorData = s_delegateDynamicInvokeImplArgIteratorData;
            else if (conversionInfo.IsReflectionDynamicInvokerThunk)
                callerIteratorData = s_reflectionDynamicInvokeImplArgIteratorData;
            else
                callerIteratorData = conversionInfo.ArgIteratorData;

            _callerArgs = new ArgIterator(callerIteratorData,
                                              callerIteratorData.HasThis() ?
                                                CallingConvention.ManagedInstance :
                                                CallingConvention.ManagedStatic,
                                              conversionInfo.CallerHasParamType,
                                              conversionInfo.CallerHasExtraParameterWhichIsFunctionTarget,
                                              conversionInfo.CallerForcedByRefData,
                                              false, false); // Setup input

            bool forceCalleeHasParamType = false;

            // If the callee MAY have a param type, we need to know before we create the callee arg iterator
            // To do this we need to actually load the target address and see if it has the generic method pointer
            // bit set.
            if (conversionInfo.CalleeMayHaveParamType)
            {
                ArgIterator callerArgsLookupTargetFunctionPointer = new ArgIterator(conversionInfo.ArgIteratorData,
                                                                                        conversionInfo.ArgIteratorData.HasThis() ?
                                                                                            CallingConvention.ManagedInstance :
                                                                                            CallingConvention.ManagedStatic,
                                                                                        conversionInfo.CallerHasParamType,
                                                                                        conversionInfo.CallerHasExtraParameterWhichIsFunctionTarget,
                                                                                        conversionInfo.CallerForcedByRefData,
                                                                                        false, false);

                // Find the last valid caller offset. That's the offset of the target function pointer.
                int ofsCallerValid = TransitionBlock.InvalidOffset;
                while (true)
                {
                    // Setup argument offsets.
                    int ofsCallerTemp = callerArgsLookupTargetFunctionPointer.GetNextOffset();

                    // Check to see if we've handled all the arguments that we are to pass to the callee. 
                    if (TransitionBlock.InvalidOffset == ofsCallerTemp)
                        break;

                    ofsCallerValid = ofsCallerTemp;
                }

                if (ofsCallerValid == TransitionBlock.InvalidOffset)
                    throw new InvalidProgramException();

                int stackSizeCaller = callerArgsLookupTargetFunctionPointer.GetArgSize();
                Debug.Assert(stackSizeCaller == IntPtr.Size);
                void* pSrc = _callerTransitionBlock + ofsCallerValid;
                IntPtr tempFunctionPointer = *((IntPtr*)pSrc);

                forceCalleeHasParamType = UpdateCalleeFunctionPointer(tempFunctionPointer);
            }

            // Retrieve target function pointer and instantiation argument for delegate thunks
            if (conversionInfo.IsDelegateThunk)
            {
                Debug.Assert(_callerArgs.HasThis() && !_conversionInfo.IsUnboxingThunk);

                IntPtr locationOfThisPointer = (IntPtr)(_callerTransitionBlock + ArgIterator.GetThisOffset());
                _delegateData._delegateObject = (Delegate)Unsafe.As<IntPtr, Object>(ref *(IntPtr*)locationOfThisPointer);
                Debug.Assert(_delegateData._delegateObject != null);

                RuntimeAugments.GetDelegateData(
                    _delegateData._delegateObject,
                    out _delegateData._firstParameter,
                    out _delegateData._helperObject,
                    out _delegateData._extraFunctionPointerOrData,
                    out _delegateData._functionPointer);

                if (conversionInfo.TargetDelegateFunctionIsExtraFunctionPointerOrDataField)
                {
                    if (conversionInfo.IsOpenInstanceDelegateThunk)
                    {
                        _delegateData._boxedFirstParameter = BoxedCallerFirstArgument;
                        _callerArgs.Reset();

                        IntPtr resolvedTargetFunctionPointer = OpenMethodResolver.ResolveMethod(_delegateData._extraFunctionPointerOrData, _delegateData._boxedFirstParameter);
                        forceCalleeHasParamType = UpdateCalleeFunctionPointer(resolvedTargetFunctionPointer);
                    }
                    else
                    {
                        forceCalleeHasParamType = UpdateCalleeFunctionPointer(_delegateData._extraFunctionPointerOrData);
                    }
                }
                else if (conversionInfo.IsMulticastDelegate)
                {
                    _delegateData._multicastTargetCount = (int)_delegateData._extraFunctionPointerOrData;
                }
            }

            // 
            // Setup output argument iterator for the callee
            //
            _calleeArgs = new ArgIterator(conversionInfo.ArgIteratorData,
                                                (conversionInfo.ArgIteratorData.HasThis() && !conversionInfo.IsStaticDelegateThunk) ?
                                                    CallingConvention.ManagedInstance :
                                                    CallingConvention.ManagedStatic,
                                                forceCalleeHasParamType || conversionInfo.CalleeHasParamType,
                                                false,
                                                conversionInfo.CalleeForcedByRefData,
                                                conversionInfo.IsOpenInstanceDelegateThunk,
                                                conversionInfo.IsClosedStaticDelegate);

            // The function pointer, 'hasParamType', and 'hasThis' flags for the callee arg iterator need to be computed/read from the caller's 
            // input arguments in the case of a reflection invoker thunk (the target method pointer and 'hasThis' flags are
            // passed in as parameters from the caller, not loaded from a static method signature in native layout)
            if (conversionInfo.IsReflectionDynamicInvokerThunk)
                ComputeCalleeFlagsAndFunctionPointerForReflectionInvokeThunk();

#if CALLINGCONVENTION_CALLEE_POPS
            // Ensure that the count of bytes in the stack is available
            _callerArgs.CbStackPop();
#endif
        }
 static ImmUnaryOpTest__ShiftRightLogicalNarrowingSaturateScalar_Vector64_UInt16_5()
 {
     for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
 }
Beispiel #20
0
 static BooleanBinaryOpTest__TestZInt16()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetInt16();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _clsVar1), ref Unsafe.As <Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());
     for (var i = 0; i < Op2ElementCount; i++)
     {
         _data2[i] = TestLibrary.Generator.GetInt16();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _clsVar2), ref Unsafe.As <Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());
 }
Beispiel #21
0
 static SimpleTernaryOpTest__BitwiseSelect_Vector128_Double()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetDouble();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _clsVar1), ref Unsafe.As <Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
     for (var i = 0; i < Op2ElementCount; i++)
     {
         _data2[i] = TestLibrary.Generator.GetDouble();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _clsVar2), ref Unsafe.As <Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
     for (var i = 0; i < Op3ElementCount; i++)
     {
         _data3[i] = TestLibrary.Generator.GetDouble();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector128 <Double>, byte>(ref _clsVar3), ref Unsafe.As <Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf <Vector128 <Double> >());
 }
Beispiel #22
0
        public BooleanBinaryOpTest__TestZInt16()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetInt16();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _fld1), ref Unsafe.As <Int16, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetInt16();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _fld2), ref Unsafe.As <Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <Int16> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetInt16();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetInt16();
            }
            _dataTable = new BooleanBinaryOpTest__DataTable <Int16, Int16>(_data1, _data2, LargestVectorSize);
        }
 private void ValidateResult(void *result, [CallerMemberName] string method = "")
 {
     UInt32[] outArray = new UInt32[RetElementCount];
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef <byte>(result), (uint)Unsafe.SizeOf <Vector128 <UInt32> >());
     ValidateResult(outArray, method);
 }
Beispiel #24
0
            public static TestStruct Create()
            {
                var testStruct = new TestStruct();

                for (var i = 0; i < Op1ElementCount; i++)
                {
                    _data1[i] = SByte.MinValue;
                }
                Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <SByte>, byte>(ref testStruct._fld1), ref Unsafe.As <SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <SByte> >());

                return(testStruct);
            }
Beispiel #25
0
        public SimpleBinaryOpTest__OrByte()
        {
            Succeeded = true;

            var random = new Random();

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Byte>, byte>(ref _fld1), ref Unsafe.As <Byte, byte>(ref _data1[0]), VectorSize);
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Byte>, byte>(ref _fld2), ref Unsafe.As <Byte, byte>(ref _data2[0]), VectorSize);

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = (byte)(random.Next(0, byte.MaxValue));
            }
            _dataTable = new SimpleBinaryOpTest__DataTable <Byte, Byte, Byte>(_data1, _data2, new Byte[RetElementCount], VectorSize);
        }
Beispiel #26
0
 static SimpleUnaryOpTest__NegateSaturate_Vector64_SByte()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = SByte.MinValue;
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <SByte>, byte>(ref _clsVar1), ref Unsafe.As <SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <SByte> >());
 }
 static VectorBooleanBinaryOpTest__GreaterThanOrEqualAllSingle()
 {
     for (var i = 0; i < Op1ElementCount; i++)
     {
         _data1[i] = TestLibrary.Generator.GetSingle();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref _clsVar1), ref Unsafe.As <Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());
     for (var i = 0; i < Op2ElementCount; i++)
     {
         _data2[i] = TestLibrary.Generator.GetSingle();
     }
     Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <Single>, byte>(ref _clsVar2), ref Unsafe.As <Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector64 <Single> >());
 }
Beispiel #28
0
        public SimpleUnaryOpTest__NegateSaturate_Vector64_SByte()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = SByte.MinValue;
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector64 <SByte>, byte>(ref _fld1), ref Unsafe.As <SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector64 <SByte> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = SByte.MinValue;
            }
            _dataTable = new DataTable(_data1, new SByte[RetElementCount], LargestVectorSize);
        }
Beispiel #29
0
        static SimpleBinaryOpTest__OrInt16()
        {
            var random = new Random();

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = (short)(random.Next(short.MinValue, short.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _clsVar1), ref Unsafe.As <Int16, byte>(ref _data1[0]), VectorSize);
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = (short)(random.Next(short.MinValue, short.MaxValue));
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <Int16>, byte>(ref _clsVar2), ref Unsafe.As <Int16, byte>(ref _data2[0]), VectorSize);
        }
Beispiel #30
0
        public VectorBinaryOpTest__MultiplyUInt32()
        {
            Succeeded = true;

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetUInt32();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <UInt32>, byte>(ref _fld1), ref Unsafe.As <UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf <Vector256 <UInt32> >());
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetUInt32();
            }
            Unsafe.CopyBlockUnaligned(ref Unsafe.As <Vector256 <UInt32>, byte>(ref _fld2), ref Unsafe.As <UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf <Vector256 <UInt32> >());

            for (var i = 0; i < Op1ElementCount; i++)
            {
                _data1[i] = TestLibrary.Generator.GetUInt32();
            }
            for (var i = 0; i < Op2ElementCount; i++)
            {
                _data2[i] = TestLibrary.Generator.GetUInt32();
            }
            _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize);
        }